
(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 9 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 (/ (- z x) t)) (t_2 (+ x (/ (* y (- z x)) t))))
(if (<= t_2 (- INFINITY))
(+ x (* y t_1))
(if (<= t_2 2e+279) t_2 (fma y t_1 x)))))
double code(double x, double y, double z, double t) {
double t_1 = (z - x) / t;
double t_2 = x + ((y * (z - x)) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = x + (y * t_1);
} else if (t_2 <= 2e+279) {
tmp = t_2;
} else {
tmp = fma(y, t_1, x);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z - x) / t) t_2 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(x + Float64(y * t_1)); elseif (t_2 <= 2e+279) tmp = t_2; else tmp = fma(y, t_1, x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(x + N[(y * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+279], t$95$2, N[(y * t$95$1 + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - x}{t}\\
t_2 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;x + y \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+279}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t\_1, x\right)\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 80.3%
+-commutative80.3%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.00000000000000012e279Initial program 99.8%
if 2.00000000000000012e279 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 88.3%
+-commutative88.3%
associate-/l*99.9%
fma-define100.0%
Simplified100.0%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+279)))
(+ x (* y (/ (- z x) 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+279)) {
tmp = x + (y * ((z - x) / 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+279)) {
tmp = x + (y * ((z - x) / 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+279): tmp = x + (y * ((z - x) / 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+279)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / 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+279))) tmp = x + (y * ((z - x) / 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+279]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $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^{+279}\right):\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 2.00000000000000012e279 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 84.8%
+-commutative84.8%
associate-/l*99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.00000000000000012e279Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+279)))
(* y (/ (- z x) 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 <= 5e+279)) {
tmp = y * ((z - x) / 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 <= 5e+279)) {
tmp = y * ((z - x) / 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 <= 5e+279): tmp = y * ((z - x) / 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 <= 5e+279)) tmp = Float64(y * Float64(Float64(z - x) / 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 <= 5e+279))) tmp = y * ((z - x) / 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, 5e+279]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / 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 5 \cdot 10^{+279}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 5.0000000000000002e279 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 84.6%
Taylor expanded in y around -inf 84.6%
associate-/l*95.3%
*-commutative95.3%
Applied egg-rr95.3%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 5.0000000000000002e279Initial program 99.8%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.15e-45) (not (<= z 1.65e-13))) (+ x (* z (/ y t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e-45) || !(z <= 1.65e-13)) {
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 <= (-2.15d-45)) .or. (.not. (z <= 1.65d-13))) 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 <= -2.15e-45) || !(z <= 1.65e-13)) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.15e-45) or not (z <= 1.65e-13): 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 <= -2.15e-45) || !(z <= 1.65e-13)) 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 <= -2.15e-45) || ~((z <= 1.65e-13))) 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, -2.15e-45], N[Not[LessEqual[z, 1.65e-13]], $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 -2.15 \cdot 10^{-45} \lor \neg \left(z \leq 1.65 \cdot 10^{-13}\right):\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.1499999999999999e-45 or 1.65e-13 < z Initial program 94.7%
Taylor expanded in z around inf 88.6%
*-commutative88.6%
associate-*r/92.2%
Simplified92.2%
if -2.1499999999999999e-45 < z < 1.65e-13Initial program 94.7%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3e-46) (not (<= z 5.8e-18))) (+ x (* y (/ z t))) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3e-46) || !(z <= 5.8e-18)) {
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 <= (-3d-46)) .or. (.not. (z <= 5.8d-18))) 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 <= -3e-46) || !(z <= 5.8e-18)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3e-46) or not (z <= 5.8e-18): 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 <= -3e-46) || !(z <= 5.8e-18)) 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 <= -3e-46) || ~((z <= 5.8e-18))) 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, -3e-46], N[Not[LessEqual[z, 5.8e-18]], $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 \cdot 10^{-46} \lor \neg \left(z \leq 5.8 \cdot 10^{-18}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if z < -2.99999999999999987e-46 or 5.8e-18 < z Initial program 94.7%
Taylor expanded in z around inf 88.6%
associate-/l*87.9%
Simplified87.9%
if -2.99999999999999987e-46 < z < 5.8e-18Initial program 94.7%
Taylor expanded in x around inf 89.1%
mul-1-neg89.1%
unsub-neg89.1%
Simplified89.1%
Final simplification88.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.65e+103) (/ z (/ t y)) (if (<= z 3.7e+30) (* x (- 1.0 (/ y t))) (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.65e+103) {
tmp = z / (t / y);
} else if (z <= 3.7e+30) {
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 <= (-1.65d+103)) then
tmp = z / (t / y)
else if (z <= 3.7d+30) 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 <= -1.65e+103) {
tmp = z / (t / y);
} else if (z <= 3.7e+30) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.65e+103: tmp = z / (t / y) elif z <= 3.7e+30: tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.65e+103) tmp = Float64(z / Float64(t / y)); elseif (z <= 3.7e+30) 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 <= -1.65e+103) tmp = z / (t / y); elseif (z <= 3.7e+30) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.65e+103], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+30], 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 -1.65 \cdot 10^{+103}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -1.65000000000000004e103Initial program 94.3%
Taylor expanded in y around -inf 74.6%
Taylor expanded in z around inf 72.0%
*-commutative91.6%
associate-*r/94.2%
Simplified74.6%
Taylor expanded in z around 0 72.0%
*-commutative72.0%
associate-*l/66.4%
associate-/r/74.7%
Simplified74.7%
if -1.65000000000000004e103 < z < 3.70000000000000016e30Initial program 95.4%
Taylor expanded in x around inf 84.5%
mul-1-neg84.5%
unsub-neg84.5%
Simplified84.5%
if 3.70000000000000016e30 < z Initial program 92.4%
Taylor expanded in y around -inf 77.0%
Taylor expanded in z around inf 69.6%
*-commutative84.4%
associate-*r/91.8%
Simplified77.0%
(FPCore (x y z t) :precision binary64 (if (<= t -1.22e-21) x (if (<= t 2.15e+86) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.22e-21) {
tmp = x;
} else if (t <= 2.15e+86) {
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 (t <= (-1.22d-21)) then
tmp = x
else if (t <= 2.15d+86) 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 (t <= -1.22e-21) {
tmp = x;
} else if (t <= 2.15e+86) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.22e-21: tmp = x elif t <= 2.15e+86: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.22e-21) tmp = x; elseif (t <= 2.15e+86) 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 (t <= -1.22e-21) tmp = x; elseif (t <= 2.15e+86) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.22e-21], x, If[LessEqual[t, 2.15e+86], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.15 \cdot 10^{+86}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.21999999999999991e-21 or 2.1500000000000001e86 < t Initial program 86.9%
Taylor expanded in y around 0 72.2%
if -1.21999999999999991e-21 < t < 2.1500000000000001e86Initial program 99.7%
Taylor expanded in y around -inf 83.8%
Taylor expanded in z around inf 52.3%
*-commutative66.6%
associate-*r/70.2%
Simplified55.9%
(FPCore (x y z t) :precision binary64 (if (<= t -4.3e-22) x (if (<= t 8.5e+82) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.3e-22) {
tmp = x;
} else if (t <= 8.5e+82) {
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 <= (-4.3d-22)) then
tmp = x
else if (t <= 8.5d+82) 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 <= -4.3e-22) {
tmp = x;
} else if (t <= 8.5e+82) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.3e-22: tmp = x elif t <= 8.5e+82: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.3e-22) tmp = x; elseif (t <= 8.5e+82) 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 <= -4.3e-22) tmp = x; elseif (t <= 8.5e+82) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.3e-22], x, If[LessEqual[t, 8.5e+82], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{+82}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.30000000000000037e-22 or 8.4999999999999995e82 < t Initial program 86.9%
Taylor expanded in y around 0 72.2%
if -4.30000000000000037e-22 < t < 8.4999999999999995e82Initial program 99.7%
Taylor expanded in y around -inf 83.8%
Taylor expanded in z around inf 52.3%
associate-/l*62.5%
Simplified48.6%
(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.6%
(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 2024084
(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)))