
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y / t) * (z - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y / t) * (z - x));
}
def code(x, y, z, t): return x + ((y / t) * (z - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y / t) * Float64(z - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y / t) * (z - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{t} \cdot \left(z - x\right)
\end{array}
Initial program 90.8%
Taylor expanded in z around 0 85.7%
+-commutative85.7%
*-commutative85.7%
associate-*r/88.3%
mul-1-neg88.3%
associate-/l*90.9%
distribute-lft-neg-in90.9%
distribute-rgt-in98.3%
sub-neg98.3%
Simplified98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e+67) (not (<= x 1.3e+130))) (* x (- 1.0 (/ y t))) (+ x (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+67) || !(x <= 1.3e+130)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-4.4d+67)) .or. (.not. (x <= 1.3d+130))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + ((y / t) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+67) || !(x <= 1.3e+130)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + ((y / t) * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.4e+67) or not (x <= 1.3e+130): tmp = x * (1.0 - (y / t)) else: tmp = x + ((y / t) * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e+67) || !(x <= 1.3e+130)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(Float64(y / t) * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.4e+67) || ~((x <= 1.3e+130))) tmp = x * (1.0 - (y / t)); else tmp = x + ((y / t) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e+67], N[Not[LessEqual[x, 1.3e+130]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+67} \lor \neg \left(x \leq 1.3 \cdot 10^{+130}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\end{array}
\end{array}
if x < -4.4e67 or 1.2999999999999999e130 < x Initial program 87.3%
Taylor expanded in x around inf 90.9%
mul-1-neg90.9%
unsub-neg90.9%
Simplified90.9%
if -4.4e67 < x < 1.2999999999999999e130Initial program 92.5%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
*-commutative89.0%
associate-*r/92.8%
mul-1-neg92.8%
associate-/l*90.8%
distribute-lft-neg-in90.8%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 91.3%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.4e+65) (not (<= x 1.72e+131))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.4e+65) || !(x <= 1.72e+131)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-7.4d+65)) .or. (.not. (x <= 1.72d+131))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.4e+65) || !(x <= 1.72e+131)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.4e+65) or not (x <= 1.72e+131): tmp = x * (1.0 - (y / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.4e+65) || !(x <= 1.72e+131)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.4e+65) || ~((x <= 1.72e+131))) tmp = x * (1.0 - (y / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.4e+65], N[Not[LessEqual[x, 1.72e+131]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.4 \cdot 10^{+65} \lor \neg \left(x \leq 1.72 \cdot 10^{+131}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -7.39999999999999989e65 or 1.71999999999999994e131 < x Initial program 87.3%
Taylor expanded in x around inf 90.9%
mul-1-neg90.9%
unsub-neg90.9%
Simplified90.9%
if -7.39999999999999989e65 < x < 1.71999999999999994e131Initial program 92.5%
Taylor expanded in z around inf 87.0%
associate-/l*87.0%
Simplified87.0%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5.3e-48) (not (<= y 4.6e-35))) (* y (/ (- z x) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.3e-48) || !(y <= 4.6e-35)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-5.3d-48)) .or. (.not. (y <= 4.6d-35))) then
tmp = y * ((z - x) / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -5.3e-48) || !(y <= 4.6e-35)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -5.3e-48) or not (y <= 4.6e-35): tmp = y * ((z - x) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -5.3e-48) || !(y <= 4.6e-35)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -5.3e-48) || ~((y <= 4.6e-35))) tmp = y * ((z - x) / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -5.3e-48], N[Not[LessEqual[y, 4.6e-35]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.3 \cdot 10^{-48} \lor \neg \left(y \leq 4.6 \cdot 10^{-35}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -5.3e-48 or 4.5999999999999998e-35 < y Initial program 86.5%
Taylor expanded in y around inf 77.9%
Taylor expanded in t around 0 80.6%
if -5.3e-48 < y < 4.5999999999999998e-35Initial program 96.7%
Taylor expanded in x around inf 75.1%
mul-1-neg75.1%
unsub-neg75.1%
Simplified75.1%
Final simplification78.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.3e+14) (not (<= z 2.2e+40))) (/ z (/ t y)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+14) || !(z <= 2.2e+40)) {
tmp = z / (t / y);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.3d+14)) .or. (.not. (z <= 2.2d+40))) then
tmp = z / (t / y)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.3e+14) || !(z <= 2.2e+40)) {
tmp = z / (t / y);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.3e+14) or not (z <= 2.2e+40): tmp = z / (t / y) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.3e+14) || !(z <= 2.2e+40)) tmp = Float64(z / Float64(t / y)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.3e+14) || ~((z <= 2.2e+40))) tmp = z / (t / y); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.3e+14], N[Not[LessEqual[z, 2.2e+40]], $MachinePrecision]], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+14} \lor \neg \left(z \leq 2.2 \cdot 10^{+40}\right):\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -1.3e14 or 2.1999999999999999e40 < z Initial program 89.0%
Taylor expanded in y around inf 66.4%
Taylor expanded in z around inf 63.4%
*-commutative63.4%
associate-/r/71.2%
Applied egg-rr71.2%
if -1.3e14 < z < 2.1999999999999999e40Initial program 92.7%
Taylor expanded in x around inf 82.0%
mul-1-neg82.0%
unsub-neg82.0%
Simplified82.0%
Final simplification76.5%
(FPCore (x y z t) :precision binary64 (if (<= x -3.2e+65) (- x (/ x (/ t y))) (if (<= x 1.05e+130) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.2e+65) {
tmp = x - (x / (t / y));
} else if (x <= 1.05e+130) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.2d+65)) then
tmp = x - (x / (t / y))
else if (x <= 1.05d+130) then
tmp = x + ((y / t) * z)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.2e+65) {
tmp = x - (x / (t / y));
} else if (x <= 1.05e+130) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.2e+65: tmp = x - (x / (t / y)) elif x <= 1.05e+130: tmp = x + ((y / t) * z) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.2e+65) tmp = Float64(x - Float64(x / Float64(t / y))); elseif (x <= 1.05e+130) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.2e+65) tmp = x - (x / (t / y)); elseif (x <= 1.05e+130) tmp = x + ((y / t) * z); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.2e+65], N[(x - N[(x / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.05e+130], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{+65}:\\
\;\;\;\;x - \frac{x}{\frac{t}{y}}\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+130}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if x < -3.20000000000000007e65Initial program 86.0%
Taylor expanded in z around 0 79.3%
+-commutative79.3%
*-commutative79.3%
associate-*r/79.4%
mul-1-neg79.4%
associate-/l*93.5%
distribute-lft-neg-in93.5%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 91.1%
neg-mul-191.1%
Simplified91.1%
if -3.20000000000000007e65 < x < 1.04999999999999995e130Initial program 92.5%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
*-commutative89.0%
associate-*r/92.8%
mul-1-neg92.8%
associate-/l*90.8%
distribute-lft-neg-in90.8%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 91.3%
if 1.04999999999999995e130 < x Initial program 89.0%
Taylor expanded in x around inf 90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (if (<= x -5.8e+66) (- x (* x (/ y t))) (if (<= x 4.8e+131) (+ x (* (/ y t) z)) (* x (- 1.0 (/ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e+66) {
tmp = x - (x * (y / t));
} else if (x <= 4.8e+131) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-5.8d+66)) then
tmp = x - (x * (y / t))
else if (x <= 4.8d+131) then
tmp = x + ((y / t) * z)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.8e+66) {
tmp = x - (x * (y / t));
} else if (x <= 4.8e+131) {
tmp = x + ((y / t) * z);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.8e+66: tmp = x - (x * (y / t)) elif x <= 4.8e+131: tmp = x + ((y / t) * z) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.8e+66) tmp = Float64(x - Float64(x * Float64(y / t))); elseif (x <= 4.8e+131) tmp = Float64(x + Float64(Float64(y / t) * z)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5.8e+66) tmp = x - (x * (y / t)); elseif (x <= 4.8e+131) tmp = x + ((y / t) * z); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.8e+66], N[(x - N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e+131], N[(x + N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.8 \cdot 10^{+66}:\\
\;\;\;\;x - x \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+131}:\\
\;\;\;\;x + \frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if x < -5.79999999999999972e66Initial program 86.0%
Taylor expanded in z around 0 79.3%
+-commutative79.3%
*-commutative79.3%
associate-*r/79.4%
mul-1-neg79.4%
associate-/l*93.5%
distribute-lft-neg-in93.5%
distribute-rgt-in99.9%
sub-neg99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 91.1%
neg-mul-191.1%
Simplified91.1%
Taylor expanded in x around 0 91.1%
neg-mul-191.1%
unsub-neg91.1%
distribute-lft-out--91.1%
*-rgt-identity91.1%
Simplified91.1%
if -5.79999999999999972e66 < x < 4.7999999999999999e131Initial program 92.5%
Taylor expanded in z around 0 89.0%
+-commutative89.0%
*-commutative89.0%
associate-*r/92.8%
mul-1-neg92.8%
associate-/l*90.8%
distribute-lft-neg-in90.8%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around inf 91.3%
if 4.7999999999999999e131 < x Initial program 89.0%
Taylor expanded in x around inf 90.7%
mul-1-neg90.7%
unsub-neg90.7%
Simplified90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2000000000000.0) (not (<= z 5.2e-39))) (/ z (/ t y)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2000000000000.0) || !(z <= 5.2e-39)) {
tmp = z / (t / y);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2000000000000.0d0)) .or. (.not. (z <= 5.2d-39))) then
tmp = z / (t / y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2000000000000.0) || !(z <= 5.2e-39)) {
tmp = z / (t / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2000000000000.0) or not (z <= 5.2e-39): tmp = z / (t / y) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2000000000000.0) || !(z <= 5.2e-39)) tmp = Float64(z / Float64(t / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2000000000000.0) || ~((z <= 5.2e-39))) tmp = z / (t / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2000000000000.0], N[Not[LessEqual[z, 5.2e-39]], $MachinePrecision]], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2000000000000 \lor \neg \left(z \leq 5.2 \cdot 10^{-39}\right):\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2e12 or 5.2e-39 < z Initial program 89.7%
Taylor expanded in y around inf 66.7%
Taylor expanded in z around inf 61.8%
*-commutative61.8%
associate-/r/69.1%
Applied egg-rr69.1%
if -2e12 < z < 5.2e-39Initial program 92.1%
Taylor expanded in y around 0 59.9%
Final simplification65.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -0.11) (not (<= y 3.05e-43))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.11) || !(y <= 3.05e-43)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-0.11d0)) .or. (.not. (y <= 3.05d-43))) then
tmp = y * (z / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -0.11) || !(y <= 3.05e-43)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -0.11) or not (y <= 3.05e-43): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -0.11) || !(y <= 3.05e-43)) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -0.11) || ~((y <= 3.05e-43))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -0.11], N[Not[LessEqual[y, 3.05e-43]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.11 \lor \neg \left(y \leq 3.05 \cdot 10^{-43}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -0.110000000000000001 or 3.05000000000000019e-43 < y Initial program 86.0%
Taylor expanded in y around inf 78.6%
Taylor expanded in z around inf 61.9%
if -0.110000000000000001 < y < 3.05000000000000019e-43Initial program 96.9%
Taylor expanded in y around 0 65.2%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 90.8%
Taylor expanded in y around 0 39.3%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024170
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(! :herbie-platform default (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
(+ x (/ (* y (- z x)) t)))