
(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 12 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
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (<= t_1 (- INFINITY))
(+ x (pow (/ (/ t (- z x)) y) -1.0))
(if (<= t_1 2e+275) t_1 (fma y (/ (- z x) t) x)))))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + pow(((t / (z - x)) / y), -1.0);
} else if (t_1 <= 2e+275) {
tmp = t_1;
} else {
tmp = fma(y, ((z - x) / t), x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + (Float64(Float64(t / Float64(z - x)) / y) ^ -1.0)); elseif (t_1 <= 2e+275) tmp = t_1; else tmp = fma(y, Float64(Float64(z - x) / t), x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[Power[N[(N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+275], t$95$1, N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + {\left(\frac{\frac{t}{z - x}}{y}\right)}^{-1}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+275}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 83.1%
clear-num83.1%
inv-pow83.1%
*-commutative83.1%
associate-/r*99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.99999999999999992e275Initial program 99.3%
if 1.99999999999999992e275 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 75.1%
+-commutative75.1%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+275)))
(fma y (/ (- z x) t) x)
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+275)) {
tmp = fma(y, ((z - x) / t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+275)) tmp = fma(y, Float64(Float64(z - x) / t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+275]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+275}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 1.99999999999999992e275 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 78.5%
+-commutative78.5%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1.99999999999999992e275Initial program 99.3%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+284)))
(* (- z x) (/ y t))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+284)) {
tmp = (z - x) * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+284)) {
tmp = (z - x) * (y / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((y * (z - x)) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+284): tmp = (z - x) * (y / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+284)) tmp = Float64(Float64(z - x) * Float64(y / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + ((y * (z - x)) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+284))) tmp = (z - x) * (y / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+284]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+284}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 2.00000000000000016e284 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 77.6%
Taylor expanded in y around -inf 77.6%
Taylor expanded in z around 0 62.9%
+-commutative62.9%
*-commutative62.9%
associate-*r/74.2%
mul-1-neg74.2%
associate-/l*76.2%
distribute-lft-neg-in76.2%
distribute-rgt-in94.9%
sub-neg94.9%
Simplified94.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.00000000000000016e284Initial program 99.3%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= y -5.9e+26)
t_1
(if (<= y -6.2e-7)
(* y (/ (- x) t))
(if (<= y 1.1e+68) x (if (<= y 4.2e+251) t_1 (* x (/ (- y) t))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (y <= -5.9e+26) {
tmp = t_1;
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 1.1e+68) {
tmp = x;
} else if (y <= 4.2e+251) {
tmp = t_1;
} else {
tmp = x * (-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) :: t_1
real(8) :: tmp
t_1 = z * (y / t)
if (y <= (-5.9d+26)) then
tmp = t_1
else if (y <= (-6.2d-7)) then
tmp = y * (-x / t)
else if (y <= 1.1d+68) then
tmp = x
else if (y <= 4.2d+251) then
tmp = t_1
else
tmp = x * (-y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (y <= -5.9e+26) {
tmp = t_1;
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 1.1e+68) {
tmp = x;
} else if (y <= 4.2e+251) {
tmp = t_1;
} else {
tmp = x * (-y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if y <= -5.9e+26: tmp = t_1 elif y <= -6.2e-7: tmp = y * (-x / t) elif y <= 1.1e+68: tmp = x elif y <= 4.2e+251: tmp = t_1 else: tmp = x * (-y / t) return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (y <= -5.9e+26) tmp = t_1; elseif (y <= -6.2e-7) tmp = Float64(y * Float64(Float64(-x) / t)); elseif (y <= 1.1e+68) tmp = x; elseif (y <= 4.2e+251) tmp = t_1; else tmp = Float64(x * Float64(Float64(-y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (y <= -5.9e+26) tmp = t_1; elseif (y <= -6.2e-7) tmp = y * (-x / t); elseif (y <= 1.1e+68) tmp = x; elseif (y <= 4.2e+251) tmp = t_1; else tmp = x * (-y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.9e+26], t$95$1, If[LessEqual[y, -6.2e-7], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1e+68], x, If[LessEqual[y, 4.2e+251], t$95$1, N[(x * N[((-y) / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -5.9 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+68}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+251}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{-y}{t}\\
\end{array}
\end{array}
if y < -5.9000000000000003e26 or 1.09999999999999994e68 < y < 4.2000000000000001e251Initial program 88.4%
Taylor expanded in y around -inf 78.0%
Taylor expanded in z around inf 52.3%
*-commutative62.9%
associate-*r/74.0%
Simplified63.3%
if -5.9000000000000003e26 < y < -6.1999999999999999e-7Initial program 99.7%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Taylor expanded in y around inf 89.6%
mul-1-neg89.6%
associate-*l/89.6%
*-commutative89.6%
distribute-rgt-neg-in89.6%
distribute-neg-frac89.6%
Simplified89.6%
if -6.1999999999999999e-7 < y < 1.09999999999999994e68Initial program 97.8%
Taylor expanded in y around 0 70.5%
if 4.2000000000000001e251 < y Initial program 74.8%
Taylor expanded in x around inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
Taylor expanded in y around inf 42.8%
associate-*r/73.4%
associate-*r*73.4%
neg-mul-173.4%
*-commutative73.4%
Simplified73.4%
Final simplification68.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= y -1.22e+27)
t_1
(if (<= y -6.2e-7) (* y (/ (- x) t)) (if (<= y 4.1e+67) x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (y <= -1.22e+27) {
tmp = t_1;
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 4.1e+67) {
tmp = x;
} else {
tmp = t_1;
}
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) :: tmp
t_1 = z * (y / t)
if (y <= (-1.22d+27)) then
tmp = t_1
else if (y <= (-6.2d-7)) then
tmp = y * (-x / t)
else if (y <= 4.1d+67) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (y <= -1.22e+27) {
tmp = t_1;
} else if (y <= -6.2e-7) {
tmp = y * (-x / t);
} else if (y <= 4.1e+67) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if y <= -1.22e+27: tmp = t_1 elif y <= -6.2e-7: tmp = y * (-x / t) elif y <= 4.1e+67: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (y <= -1.22e+27) tmp = t_1; elseif (y <= -6.2e-7) tmp = Float64(y * Float64(Float64(-x) / t)); elseif (y <= 4.1e+67) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (y <= -1.22e+27) tmp = t_1; elseif (y <= -6.2e-7) tmp = y * (-x / t); elseif (y <= 4.1e+67) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.22e+27], t$95$1, If[LessEqual[y, -6.2e-7], N[(y * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e+67], x, t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;y \leq -1.22 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{-x}{t}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+67}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.2200000000000001e27 or 4.09999999999999979e67 < y Initial program 86.6%
Taylor expanded in y around -inf 77.5%
Taylor expanded in z around inf 50.6%
*-commutative60.1%
associate-*r/70.7%
Simplified61.0%
if -1.2200000000000001e27 < y < -6.1999999999999999e-7Initial program 99.7%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Taylor expanded in y around inf 89.6%
mul-1-neg89.6%
associate-*l/89.6%
*-commutative89.6%
distribute-rgt-neg-in89.6%
distribute-neg-frac89.6%
Simplified89.6%
if -6.1999999999999999e-7 < y < 4.09999999999999979e67Initial program 97.8%
Taylor expanded in y around 0 70.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.2e-81) (not (<= z 4e-91))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.2e-81) || !(z <= 4e-91)) {
tmp = x + (z * (y / 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 ((z <= (-8.2d-81)) .or. (.not. (z <= 4d-91))) then
tmp = x + (z * (y / 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 ((z <= -8.2e-81) || !(z <= 4e-91)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.2e-81) or not (z <= 4e-91): tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.2e-81) || !(z <= 4e-91)) tmp = Float64(x + Float64(z * Float64(y / 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 ((z <= -8.2e-81) || ~((z <= 4e-91))) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.2e-81], N[Not[LessEqual[z, 4e-91]], $MachinePrecision]], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-81} \lor \neg \left(z \leq 4 \cdot 10^{-91}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -8.19999999999999968e-81 or 4.00000000000000009e-91 < z Initial program 92.2%
Taylor expanded in z around inf 83.3%
*-commutative83.3%
associate-*r/87.4%
Simplified87.4%
if -8.19999999999999968e-81 < z < 4.00000000000000009e-91Initial program 94.2%
Taylor expanded in x around inf 92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
Final simplification89.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.5e-79) (not (<= z 2.6e-96))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.5e-79) || !(z <= 2.6e-96)) {
tmp = x + (y * (z / 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 ((z <= (-3.5d-79)) .or. (.not. (z <= 2.6d-96))) then
tmp = x + (y * (z / 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 ((z <= -3.5e-79) || !(z <= 2.6e-96)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.5e-79) or not (z <= 2.6e-96): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.5e-79) || !(z <= 2.6e-96)) tmp = Float64(x + Float64(y * Float64(z / 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 ((z <= -3.5e-79) || ~((z <= 2.6e-96))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.5e-79], N[Not[LessEqual[z, 2.6e-96]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{-79} \lor \neg \left(z \leq 2.6 \cdot 10^{-96}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -3.5000000000000003e-79 or 2.6000000000000002e-96 < z Initial program 92.2%
Taylor expanded in z around inf 83.3%
associate-/l*86.1%
Simplified86.1%
if -3.5000000000000003e-79 < z < 2.6000000000000002e-96Initial program 94.2%
Taylor expanded in x around inf 92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.9e-42) (not (<= y 4.5e+66))) (* (- z x) (/ y t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.9e-42) || !(y <= 4.5e+66)) {
tmp = (z - x) * (y / 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 <= (-2.9d-42)) .or. (.not. (y <= 4.5d+66))) then
tmp = (z - x) * (y / 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 <= -2.9e-42) || !(y <= 4.5e+66)) {
tmp = (z - x) * (y / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.9e-42) or not (y <= 4.5e+66): tmp = (z - x) * (y / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.9e-42) || !(y <= 4.5e+66)) tmp = Float64(Float64(z - x) * Float64(y / 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 <= -2.9e-42) || ~((y <= 4.5e+66))) tmp = (z - x) * (y / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.9e-42], N[Not[LessEqual[y, 4.5e+66]], $MachinePrecision]], N[(N[(z - x), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-42} \lor \neg \left(y \leq 4.5 \cdot 10^{+66}\right):\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -2.9000000000000003e-42 or 4.4999999999999998e66 < y Initial program 88.0%
Taylor expanded in y around -inf 78.3%
Taylor expanded in z around 0 70.4%
+-commutative70.4%
*-commutative70.4%
associate-*r/76.3%
mul-1-neg76.3%
associate-/l*77.4%
distribute-lft-neg-in77.4%
distribute-rgt-in87.8%
sub-neg87.8%
Simplified87.8%
if -2.9000000000000003e-42 < y < 4.4999999999999998e66Initial program 97.7%
Taylor expanded in x around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
Simplified81.1%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= z -7.1e+161) (* y (/ z t)) (if (<= z 4e+149) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.1e+161) {
tmp = y * (z / t);
} else if (z <= 4e+149) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (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 <= (-7.1d+161)) then
tmp = y * (z / t)
else if (z <= 4d+149) then
tmp = x * (1.0d0 - (y / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.1e+161) {
tmp = y * (z / t);
} else if (z <= 4e+149) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.1e+161: tmp = y * (z / t) elif z <= 4e+149: tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.1e+161) tmp = Float64(y * Float64(z / t)); elseif (z <= 4e+149) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7.1e+161) tmp = y * (z / t); elseif (z <= 4e+149) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.1e+161], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+149], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+161}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+149}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -7.0999999999999997e161Initial program 87.0%
Taylor expanded in y around -inf 66.0%
Taylor expanded in z around inf 66.0%
associate-/l*93.2%
Simplified76.6%
if -7.0999999999999997e161 < z < 4.0000000000000002e149Initial program 95.4%
Taylor expanded in x around inf 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if 4.0000000000000002e149 < z Initial program 86.1%
Taylor expanded in y around -inf 65.9%
Taylor expanded in z around inf 59.4%
*-commutative78.8%
associate-*r/92.6%
Simplified70.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.5e-39) (not (<= y 1.05e+68))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.5e-39) || !(y <= 1.05e+68)) {
tmp = z * (y / 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 <= (-3.5d-39)) .or. (.not. (y <= 1.05d+68))) then
tmp = z * (y / 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 <= -3.5e-39) || !(y <= 1.05e+68)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.5e-39) or not (y <= 1.05e+68): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.5e-39) || !(y <= 1.05e+68)) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.5e-39) || ~((y <= 1.05e+68))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.5e-39], N[Not[LessEqual[y, 1.05e+68]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{-39} \lor \neg \left(y \leq 1.05 \cdot 10^{+68}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.5e-39 or 1.05e68 < y Initial program 87.9%
Taylor expanded in y around -inf 78.1%
Taylor expanded in z around inf 48.3%
*-commutative58.6%
associate-*r/68.1%
Simplified57.7%
if -3.5e-39 < y < 1.05e68Initial program 97.7%
Taylor expanded in y around 0 72.1%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.1e-39) (not (<= y 4.5e+67))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.1e-39) || !(y <= 4.5e+67)) {
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 <= (-4.1d-39)) .or. (.not. (y <= 4.5d+67))) 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 <= -4.1e-39) || !(y <= 4.5e+67)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.1e-39) or not (y <= 4.5e+67): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.1e-39) || !(y <= 4.5e+67)) 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 <= -4.1e-39) || ~((y <= 4.5e+67))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.1e-39], N[Not[LessEqual[y, 4.5e+67]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.1 \cdot 10^{-39} \lor \neg \left(y \leq 4.5 \cdot 10^{+67}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.1e-39 or 4.4999999999999998e67 < y Initial program 87.9%
Taylor expanded in y around -inf 78.1%
Taylor expanded in z around inf 48.3%
associate-/l*64.6%
Simplified54.3%
if -4.1e-39 < y < 4.4999999999999998e67Initial program 97.7%
Taylor expanded in y around 0 72.1%
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 92.9%
Taylor expanded in y around 0 43.1%
(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 2024096
(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)))