
(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 13 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 94.7%
Taylor expanded in z around 0 89.2%
+-commutative89.2%
*-commutative89.2%
associate-*r/88.7%
mul-1-neg88.7%
associate-/l*88.6%
distribute-lft-neg-in88.6%
distribute-rgt-in97.6%
sub-neg97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- y)) t)) (t_2 (* y (/ z t))) (t_3 (/ (* y z) t)))
(if (<= t -5.9e+38)
x
(if (<= t -0.29)
t_2
(if (<= t -6.1e-34)
x
(if (<= t -1.04e-66)
t_2
(if (<= t -9.6e-153)
t_1
(if (<= t -2.25e-254)
t_3
(if (<= t 4.2e-232) t_1 (if (<= t 9.5e+35) t_3 x))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * -y) / t;
double t_2 = y * (z / t);
double t_3 = (y * z) / t;
double tmp;
if (t <= -5.9e+38) {
tmp = x;
} else if (t <= -0.29) {
tmp = t_2;
} else if (t <= -6.1e-34) {
tmp = x;
} else if (t <= -1.04e-66) {
tmp = t_2;
} else if (t <= -9.6e-153) {
tmp = t_1;
} else if (t <= -2.25e-254) {
tmp = t_3;
} else if (t <= 4.2e-232) {
tmp = t_1;
} else if (t <= 9.5e+35) {
tmp = t_3;
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x * -y) / t
t_2 = y * (z / t)
t_3 = (y * z) / t
if (t <= (-5.9d+38)) then
tmp = x
else if (t <= (-0.29d0)) then
tmp = t_2
else if (t <= (-6.1d-34)) then
tmp = x
else if (t <= (-1.04d-66)) then
tmp = t_2
else if (t <= (-9.6d-153)) then
tmp = t_1
else if (t <= (-2.25d-254)) then
tmp = t_3
else if (t <= 4.2d-232) then
tmp = t_1
else if (t <= 9.5d+35) then
tmp = t_3
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * -y) / t;
double t_2 = y * (z / t);
double t_3 = (y * z) / t;
double tmp;
if (t <= -5.9e+38) {
tmp = x;
} else if (t <= -0.29) {
tmp = t_2;
} else if (t <= -6.1e-34) {
tmp = x;
} else if (t <= -1.04e-66) {
tmp = t_2;
} else if (t <= -9.6e-153) {
tmp = t_1;
} else if (t <= -2.25e-254) {
tmp = t_3;
} else if (t <= 4.2e-232) {
tmp = t_1;
} else if (t <= 9.5e+35) {
tmp = t_3;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * -y) / t t_2 = y * (z / t) t_3 = (y * z) / t tmp = 0 if t <= -5.9e+38: tmp = x elif t <= -0.29: tmp = t_2 elif t <= -6.1e-34: tmp = x elif t <= -1.04e-66: tmp = t_2 elif t <= -9.6e-153: tmp = t_1 elif t <= -2.25e-254: tmp = t_3 elif t <= 4.2e-232: tmp = t_1 elif t <= 9.5e+35: tmp = t_3 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(-y)) / t) t_2 = Float64(y * Float64(z / t)) t_3 = Float64(Float64(y * z) / t) tmp = 0.0 if (t <= -5.9e+38) tmp = x; elseif (t <= -0.29) tmp = t_2; elseif (t <= -6.1e-34) tmp = x; elseif (t <= -1.04e-66) tmp = t_2; elseif (t <= -9.6e-153) tmp = t_1; elseif (t <= -2.25e-254) tmp = t_3; elseif (t <= 4.2e-232) tmp = t_1; elseif (t <= 9.5e+35) tmp = t_3; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * -y) / t; t_2 = y * (z / t); t_3 = (y * z) / t; tmp = 0.0; if (t <= -5.9e+38) tmp = x; elseif (t <= -0.29) tmp = t_2; elseif (t <= -6.1e-34) tmp = x; elseif (t <= -1.04e-66) tmp = t_2; elseif (t <= -9.6e-153) tmp = t_1; elseif (t <= -2.25e-254) tmp = t_3; elseif (t <= 4.2e-232) tmp = t_1; elseif (t <= 9.5e+35) tmp = t_3; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * (-y)), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, If[LessEqual[t, -5.9e+38], x, If[LessEqual[t, -0.29], t$95$2, If[LessEqual[t, -6.1e-34], x, If[LessEqual[t, -1.04e-66], t$95$2, If[LessEqual[t, -9.6e-153], t$95$1, If[LessEqual[t, -2.25e-254], t$95$3, If[LessEqual[t, 4.2e-232], t$95$1, If[LessEqual[t, 9.5e+35], t$95$3, x]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \left(-y\right)}{t}\\
t_2 := y \cdot \frac{z}{t}\\
t_3 := \frac{y \cdot z}{t}\\
\mathbf{if}\;t \leq -5.9 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -0.29:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -6.1 \cdot 10^{-34}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.04 \cdot 10^{-66}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -9.6 \cdot 10^{-153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.25 \cdot 10^{-254}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-232}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+35}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.89999999999999981e38 or -0.28999999999999998 < t < -6.0999999999999998e-34 or 9.50000000000000062e35 < t Initial program 89.6%
Taylor expanded in y around 0 70.5%
if -5.89999999999999981e38 < t < -0.28999999999999998 or -6.0999999999999998e-34 < t < -1.04e-66Initial program 94.2%
Taylor expanded in y around -inf 88.0%
Taylor expanded in z around inf 72.2%
associate-/l*77.8%
Simplified77.8%
if -1.04e-66 < t < -9.6000000000000008e-153 or -2.25e-254 < t < 4.2000000000000001e-232Initial program 99.8%
Taylor expanded in z around 0 75.9%
mul-1-neg75.9%
distribute-lft-neg-out75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 75.9%
+-commutative75.9%
mul-1-neg75.9%
*-commutative75.9%
unsub-neg75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 70.8%
mul-1-neg70.8%
*-commutative70.8%
distribute-rgt-neg-in70.8%
Simplified70.8%
if -9.6000000000000008e-153 < t < -2.25e-254 or 4.2000000000000001e-232 < t < 9.50000000000000062e35Initial program 98.8%
Taylor expanded in y around -inf 81.9%
Taylor expanded in z around inf 65.3%
Final simplification69.2%
(FPCore (x y z t)
:precision binary64
(if (<= t -8e+38)
x
(if (or (<= t -0.3) (and (not (<= t -6.2e-34)) (<= t 9e+37)))
(* y (/ z t))
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e+38) {
tmp = x;
} else if ((t <= -0.3) || (!(t <= -6.2e-34) && (t <= 9e+37))) {
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 (t <= (-8d+38)) then
tmp = x
else if ((t <= (-0.3d0)) .or. (.not. (t <= (-6.2d-34))) .and. (t <= 9d+37)) 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 (t <= -8e+38) {
tmp = x;
} else if ((t <= -0.3) || (!(t <= -6.2e-34) && (t <= 9e+37))) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8e+38: tmp = x elif (t <= -0.3) or (not (t <= -6.2e-34) and (t <= 9e+37)): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8e+38) tmp = x; elseif ((t <= -0.3) || (!(t <= -6.2e-34) && (t <= 9e+37))) 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 (t <= -8e+38) tmp = x; elseif ((t <= -0.3) || (~((t <= -6.2e-34)) && (t <= 9e+37))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8e+38], x, If[Or[LessEqual[t, -0.3], And[N[Not[LessEqual[t, -6.2e-34]], $MachinePrecision], LessEqual[t, 9e+37]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -0.3 \lor \neg \left(t \leq -6.2 \cdot 10^{-34}\right) \land t \leq 9 \cdot 10^{+37}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.99999999999999982e38 or -0.299999999999999989 < t < -6.1999999999999996e-34 or 8.99999999999999923e37 < t Initial program 89.6%
Taylor expanded in y around 0 70.5%
if -7.99999999999999982e38 < t < -0.299999999999999989 or -6.1999999999999996e-34 < t < 8.99999999999999923e37Initial program 98.6%
Taylor expanded in y around -inf 86.0%
Taylor expanded in z around inf 57.0%
associate-/l*55.0%
Simplified55.0%
Final simplification61.7%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.1e+140)
(* x (/ y (- t)))
(if (or (<= x -120000000000.0) (not (<= x 5.5e-12)))
(/ (* x y) y)
(/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e+140) {
tmp = x * (y / -t);
} else if ((x <= -120000000000.0) || !(x <= 5.5e-12)) {
tmp = (x * y) / y;
} else {
tmp = (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 <= (-3.1d+140)) then
tmp = x * (y / -t)
else if ((x <= (-120000000000.0d0)) .or. (.not. (x <= 5.5d-12))) then
tmp = (x * y) / y
else
tmp = (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 <= -3.1e+140) {
tmp = x * (y / -t);
} else if ((x <= -120000000000.0) || !(x <= 5.5e-12)) {
tmp = (x * y) / y;
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.1e+140: tmp = x * (y / -t) elif (x <= -120000000000.0) or not (x <= 5.5e-12): tmp = (x * y) / y else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.1e+140) tmp = Float64(x * Float64(y / Float64(-t))); elseif ((x <= -120000000000.0) || !(x <= 5.5e-12)) tmp = Float64(Float64(x * y) / y); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.1e+140) tmp = x * (y / -t); elseif ((x <= -120000000000.0) || ~((x <= 5.5e-12))) tmp = (x * y) / y; else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.1e+140], N[(x * N[(y / (-t)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -120000000000.0], N[Not[LessEqual[x, 5.5e-12]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{+140}:\\
\;\;\;\;x \cdot \frac{y}{-t}\\
\mathbf{elif}\;x \leq -120000000000 \lor \neg \left(x \leq 5.5 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -3.1e140Initial program 93.6%
Taylor expanded in z around 0 93.6%
mul-1-neg93.6%
distribute-lft-neg-out93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in y around inf 67.1%
mul-1-neg67.1%
+-commutative67.1%
unsub-neg67.1%
Simplified67.1%
Taylor expanded in y around inf 54.0%
mul-1-neg54.0%
distribute-frac-neg254.0%
Simplified54.0%
Taylor expanded in y around 0 62.4%
associate-*r/62.4%
associate-*r*62.4%
neg-mul-162.4%
*-commutative62.4%
Simplified62.4%
if -3.1e140 < x < -1.2e11 or 5.5000000000000004e-12 < x Initial program 92.8%
Taylor expanded in z around 0 79.0%
mul-1-neg79.0%
distribute-lft-neg-out79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in y around inf 60.8%
mul-1-neg60.8%
+-commutative60.8%
unsub-neg60.8%
Simplified60.8%
Taylor expanded in y around 0 35.7%
associate-*r/57.2%
Applied egg-rr57.2%
if -1.2e11 < x < 5.5000000000000004e-12Initial program 96.3%
Taylor expanded in y around -inf 71.9%
Taylor expanded in z around inf 59.2%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1e-94) (not (<= x 2.25e-85))) (* x (- 1.0 (/ y t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1e-94) || !(x <= 2.25e-85)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (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 <= (-1d-94)) .or. (.not. (x <= 2.25d-85))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (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 <= -1e-94) || !(x <= 2.25e-85)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1e-94) or not (x <= 2.25e-85): tmp = x * (1.0 - (y / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1e-94) || !(x <= 2.25e-85)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1e-94) || ~((x <= 2.25e-85))) tmp = x * (1.0 - (y / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1e-94], N[Not[LessEqual[x, 2.25e-85]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-94} \lor \neg \left(x \leq 2.25 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -9.9999999999999996e-95 or 2.25000000000000002e-85 < x Initial program 94.2%
Taylor expanded in x around inf 80.5%
mul-1-neg80.5%
unsub-neg80.5%
Simplified80.5%
if -9.9999999999999996e-95 < x < 2.25000000000000002e-85Initial program 95.6%
Taylor expanded in y around -inf 72.8%
Taylor expanded in z around inf 68.0%
Final simplification76.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -25000000000.0) (not (<= x 2.3e-15))) (* x (- 1.0 (/ y t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -25000000000.0) || !(x <= 2.3e-15)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - 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 ((x <= (-25000000000.0d0)) .or. (.not. (x <= 2.3d-15))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = (y / t) * (z - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -25000000000.0) || !(x <= 2.3e-15)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -25000000000.0) or not (x <= 2.3e-15): tmp = x * (1.0 - (y / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -25000000000.0) || !(x <= 2.3e-15)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(y / t) * Float64(z - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -25000000000.0) || ~((x <= 2.3e-15))) tmp = x * (1.0 - (y / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -25000000000.0], N[Not[LessEqual[x, 2.3e-15]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -25000000000 \lor \neg \left(x \leq 2.3 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if x < -2.5e10 or 2.2999999999999999e-15 < x Initial program 93.1%
Taylor expanded in x around inf 89.0%
mul-1-neg89.0%
unsub-neg89.0%
Simplified89.0%
if -2.5e10 < x < 2.2999999999999999e-15Initial program 96.2%
Taylor expanded in y around -inf 71.6%
Taylor expanded in z around 0 67.8%
+-commutative92.4%
*-commutative92.4%
associate-*r/91.5%
mul-1-neg91.5%
associate-/l*85.4%
distribute-lft-neg-in85.4%
distribute-rgt-in95.4%
sub-neg95.4%
Simplified70.8%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4300000000.0) (not (<= x 1.3e-14))) (* x (- 1.0 (/ y t))) (* y (/ (- z x) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4300000000.0) || !(x <= 1.3e-14)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / 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 <= (-4300000000.0d0)) .or. (.not. (x <= 1.3d-14))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = y * ((z - x) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4300000000.0) || !(x <= 1.3e-14)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = y * ((z - x) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4300000000.0) or not (x <= 1.3e-14): tmp = x * (1.0 - (y / t)) else: tmp = y * ((z - x) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4300000000.0) || !(x <= 1.3e-14)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(y * Float64(Float64(z - x) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4300000000.0) || ~((x <= 1.3e-14))) tmp = x * (1.0 - (y / t)); else tmp = y * ((z - x) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4300000000.0], N[Not[LessEqual[x, 1.3e-14]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4300000000 \lor \neg \left(x \leq 1.3 \cdot 10^{-14}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\end{array}
\end{array}
if x < -4.3e9 or 1.29999999999999998e-14 < x Initial program 93.1%
Taylor expanded in x around inf 89.0%
mul-1-neg89.0%
unsub-neg89.0%
Simplified89.0%
if -4.3e9 < x < 1.29999999999999998e-14Initial program 96.2%
Taylor expanded in y around -inf 71.6%
associate-/l*71.7%
*-commutative71.7%
Applied egg-rr71.7%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e-48) (not (<= t 4.8e-88))) (+ x (* y (/ z t))) (* (/ y t) (- z x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e-48) || !(t <= 4.8e-88)) {
tmp = x + (y * (z / t));
} else {
tmp = (y / t) * (z - 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 ((t <= (-3.8d-48)) .or. (.not. (t <= 4.8d-88))) then
tmp = x + (y * (z / t))
else
tmp = (y / t) * (z - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e-48) || !(t <= 4.8e-88)) {
tmp = x + (y * (z / t));
} else {
tmp = (y / t) * (z - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.8e-48) or not (t <= 4.8e-88): tmp = x + (y * (z / t)) else: tmp = (y / t) * (z - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.8e-48) || !(t <= 4.8e-88)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(Float64(y / t) * Float64(z - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.8e-48) || ~((t <= 4.8e-88))) tmp = x + (y * (z / t)); else tmp = (y / t) * (z - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.8e-48], N[Not[LessEqual[t, 4.8e-88]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{-48} \lor \neg \left(t \leq 4.8 \cdot 10^{-88}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\end{array}
\end{array}
if t < -3.80000000000000002e-48 or 4.7999999999999999e-88 < t Initial program 92.1%
Taylor expanded in z around inf 85.1%
associate-/l*33.9%
Simplified87.4%
if -3.80000000000000002e-48 < t < 4.7999999999999999e-88Initial program 98.9%
Taylor expanded in y around -inf 91.3%
Taylor expanded in z around 0 77.9%
+-commutative85.5%
*-commutative85.5%
associate-*r/81.5%
mul-1-neg81.5%
associate-/l*73.2%
distribute-lft-neg-in73.2%
distribute-rgt-in96.1%
sub-neg96.1%
Simplified88.5%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= t -3.5e-45) (+ x (* y (/ z t))) (if (<= t 2.4e-87) (* (/ y t) (- z x)) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.5e-45) {
tmp = x + (y * (z / t));
} else if (t <= 2.4e-87) {
tmp = (y / t) * (z - x);
} 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 (t <= (-3.5d-45)) then
tmp = x + (y * (z / t))
else if (t <= 2.4d-87) then
tmp = (y / t) * (z - x)
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 (t <= -3.5e-45) {
tmp = x + (y * (z / t));
} else if (t <= 2.4e-87) {
tmp = (y / t) * (z - x);
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.5e-45: tmp = x + (y * (z / t)) elif t <= 2.4e-87: tmp = (y / t) * (z - x) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.5e-45) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 2.4e-87) tmp = Float64(Float64(y / t) * Float64(z - x)); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.5e-45) tmp = x + (y * (z / t)); elseif (t <= 2.4e-87) tmp = (y / t) * (z - x); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.5e-45], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.4e-87], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{-45}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 2.4 \cdot 10^{-87}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -3.5e-45Initial program 89.5%
Taylor expanded in z around inf 83.3%
associate-/l*30.3%
Simplified86.6%
if -3.5e-45 < t < 2.4e-87Initial program 98.9%
Taylor expanded in y around -inf 91.3%
Taylor expanded in z around 0 77.9%
+-commutative85.5%
*-commutative85.5%
associate-*r/81.5%
mul-1-neg81.5%
associate-/l*73.2%
distribute-lft-neg-in73.2%
distribute-rgt-in96.1%
sub-neg96.1%
Simplified88.5%
if 2.4e-87 < t Initial program 95.1%
Taylor expanded in z around inf 87.2%
associate-/l*38.0%
Simplified88.4%
clear-num88.4%
un-div-inv89.0%
Applied egg-rr89.0%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (<= t -1.5e-34) (+ x (* y (/ z t))) (if (<= t 7.5e-87) (/ (* y (- z x)) t) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.5e-34) {
tmp = x + (y * (z / t));
} else if (t <= 7.5e-87) {
tmp = (y * (z - x)) / 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 (t <= (-1.5d-34)) then
tmp = x + (y * (z / t))
else if (t <= 7.5d-87) then
tmp = (y * (z - x)) / 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 (t <= -1.5e-34) {
tmp = x + (y * (z / t));
} else if (t <= 7.5e-87) {
tmp = (y * (z - x)) / t;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.5e-34: tmp = x + (y * (z / t)) elif t <= 7.5e-87: tmp = (y * (z - x)) / t else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.5e-34) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (t <= 7.5e-87) tmp = Float64(Float64(y * Float64(z - x)) / t); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.5e-34) tmp = x + (y * (z / t)); elseif (t <= 7.5e-87) tmp = (y * (z - x)) / t; else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.5e-34], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.5e-87], N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-34}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-87}:\\
\;\;\;\;\frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if t < -1.5e-34Initial program 89.4%
Taylor expanded in z around inf 83.1%
associate-/l*29.4%
Simplified86.4%
if -1.5e-34 < t < 7.5000000000000002e-87Initial program 98.9%
Taylor expanded in y around -inf 91.4%
if 7.5000000000000002e-87 < t Initial program 95.1%
Taylor expanded in z around inf 87.2%
associate-/l*38.0%
Simplified88.4%
clear-num88.4%
un-div-inv89.0%
Applied egg-rr89.0%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -660000000000.0) (not (<= x 8e-5))) (/ (* x y) y) (* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -660000000000.0) || !(x <= 8e-5)) {
tmp = (x * y) / y;
} else {
tmp = 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 <= (-660000000000.0d0)) .or. (.not. (x <= 8d-5))) then
tmp = (x * y) / y
else
tmp = 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 <= -660000000000.0) || !(x <= 8e-5)) {
tmp = (x * y) / y;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -660000000000.0) or not (x <= 8e-5): tmp = (x * y) / y else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -660000000000.0) || !(x <= 8e-5)) tmp = Float64(Float64(x * y) / y); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -660000000000.0) || ~((x <= 8e-5))) tmp = (x * y) / y; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -660000000000.0], N[Not[LessEqual[x, 8e-5]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -660000000000 \lor \neg \left(x \leq 8 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -6.6e11 or 8.00000000000000065e-5 < x Initial program 93.0%
Taylor expanded in z around 0 82.7%
mul-1-neg82.7%
distribute-lft-neg-out82.7%
*-commutative82.7%
Simplified82.7%
Taylor expanded in y around inf 62.4%
mul-1-neg62.4%
+-commutative62.4%
unsub-neg62.4%
Simplified62.4%
Taylor expanded in y around 0 31.2%
associate-*r/54.6%
Applied egg-rr54.6%
if -6.6e11 < x < 8.00000000000000065e-5Initial program 96.3%
Taylor expanded in y around -inf 71.9%
Taylor expanded in z around inf 59.2%
associate-/l*59.2%
Simplified59.2%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -135000000000.0) (not (<= x 1.55e-8))) (/ (* x y) y) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -135000000000.0) || !(x <= 1.55e-8)) {
tmp = (x * y) / y;
} else {
tmp = (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 <= (-135000000000.0d0)) .or. (.not. (x <= 1.55d-8))) then
tmp = (x * y) / y
else
tmp = (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 <= -135000000000.0) || !(x <= 1.55e-8)) {
tmp = (x * y) / y;
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -135000000000.0) or not (x <= 1.55e-8): tmp = (x * y) / y else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -135000000000.0) || !(x <= 1.55e-8)) tmp = Float64(Float64(x * y) / y); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -135000000000.0) || ~((x <= 1.55e-8))) tmp = (x * y) / y; else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -135000000000.0], N[Not[LessEqual[x, 1.55e-8]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -135000000000 \lor \neg \left(x \leq 1.55 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{x \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -1.35e11 or 1.55e-8 < x Initial program 93.0%
Taylor expanded in z around 0 82.7%
mul-1-neg82.7%
distribute-lft-neg-out82.7%
*-commutative82.7%
Simplified82.7%
Taylor expanded in y around inf 62.4%
mul-1-neg62.4%
+-commutative62.4%
unsub-neg62.4%
Simplified62.4%
Taylor expanded in y around 0 31.2%
associate-*r/54.6%
Applied egg-rr54.6%
if -1.35e11 < x < 1.55e-8Initial program 96.3%
Taylor expanded in y around -inf 71.9%
Taylor expanded in z around inf 59.2%
Final simplification57.0%
(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 94.7%
Taylor expanded in y around 0 38.9%
Final simplification38.9%
(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 2024055
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))