
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + 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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))
double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + 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 = (((1.0d0 / 8.0d0) * x) - ((y * z) / 2.0d0)) + t
end function
public static double code(double x, double y, double z, double t) {
return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t;
}
def code(x, y, z, t): return (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(1.0 / 8.0) * x) - Float64(Float64(y * z) / 2.0)) + t) end
function tmp = code(x, y, z, t) tmp = (((1.0 / 8.0) * x) - ((y * z) / 2.0)) + t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(1.0 / 8.0), $MachinePrecision] * x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{1}{8} \cdot x - \frac{y \cdot z}{2}\right) + t
\end{array}
(FPCore (x y z t) :precision binary64 (fma z (/ y -2.0) (fma 0.125 x t)))
double code(double x, double y, double z, double t) {
return fma(z, (y / -2.0), fma(0.125, x, t));
}
function code(x, y, z, t) return fma(z, Float64(y / -2.0), fma(0.125, x, t)) end
code[x_, y_, z_, t_] := N[(z * N[(y / -2.0), $MachinePrecision] + N[(0.125 * x + t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \frac{y}{-2}, \mathsf{fma}\left(0.125, x, t\right)\right)
\end{array}
Initial program 100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
*-commutative100.0%
associate-*r/100.0%
distribute-rgt-neg-in100.0%
fma-def100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-*l/100.0%
associate-/l*100.0%
metadata-eval100.0%
fma-neg100.0%
remove-double-neg100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* z -0.5))))
(if (<= x -6.4e+94)
(* 0.125 x)
(if (<= x -1.42e-14)
t
(if (<= x -6.8e-192)
t_1
(if (<= x -4.1e-202)
t
(if (<= x 3.25e-279)
t_1
(if (<= x 3e-26)
t
(if (<= x 8.5e+58)
(* 0.125 x)
(if (<= x 1.26e+103)
t
(if (<= x 2.4e+110) t_1 (* 0.125 x))))))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z * -0.5);
double tmp;
if (x <= -6.4e+94) {
tmp = 0.125 * x;
} else if (x <= -1.42e-14) {
tmp = t;
} else if (x <= -6.8e-192) {
tmp = t_1;
} else if (x <= -4.1e-202) {
tmp = t;
} else if (x <= 3.25e-279) {
tmp = t_1;
} else if (x <= 3e-26) {
tmp = t;
} else if (x <= 8.5e+58) {
tmp = 0.125 * x;
} else if (x <= 1.26e+103) {
tmp = t;
} else if (x <= 2.4e+110) {
tmp = t_1;
} else {
tmp = 0.125 * 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) :: tmp
t_1 = y * (z * (-0.5d0))
if (x <= (-6.4d+94)) then
tmp = 0.125d0 * x
else if (x <= (-1.42d-14)) then
tmp = t
else if (x <= (-6.8d-192)) then
tmp = t_1
else if (x <= (-4.1d-202)) then
tmp = t
else if (x <= 3.25d-279) then
tmp = t_1
else if (x <= 3d-26) then
tmp = t
else if (x <= 8.5d+58) then
tmp = 0.125d0 * x
else if (x <= 1.26d+103) then
tmp = t
else if (x <= 2.4d+110) then
tmp = t_1
else
tmp = 0.125d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z * -0.5);
double tmp;
if (x <= -6.4e+94) {
tmp = 0.125 * x;
} else if (x <= -1.42e-14) {
tmp = t;
} else if (x <= -6.8e-192) {
tmp = t_1;
} else if (x <= -4.1e-202) {
tmp = t;
} else if (x <= 3.25e-279) {
tmp = t_1;
} else if (x <= 3e-26) {
tmp = t;
} else if (x <= 8.5e+58) {
tmp = 0.125 * x;
} else if (x <= 1.26e+103) {
tmp = t;
} else if (x <= 2.4e+110) {
tmp = t_1;
} else {
tmp = 0.125 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z * -0.5) tmp = 0 if x <= -6.4e+94: tmp = 0.125 * x elif x <= -1.42e-14: tmp = t elif x <= -6.8e-192: tmp = t_1 elif x <= -4.1e-202: tmp = t elif x <= 3.25e-279: tmp = t_1 elif x <= 3e-26: tmp = t elif x <= 8.5e+58: tmp = 0.125 * x elif x <= 1.26e+103: tmp = t elif x <= 2.4e+110: tmp = t_1 else: tmp = 0.125 * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z * -0.5)) tmp = 0.0 if (x <= -6.4e+94) tmp = Float64(0.125 * x); elseif (x <= -1.42e-14) tmp = t; elseif (x <= -6.8e-192) tmp = t_1; elseif (x <= -4.1e-202) tmp = t; elseif (x <= 3.25e-279) tmp = t_1; elseif (x <= 3e-26) tmp = t; elseif (x <= 8.5e+58) tmp = Float64(0.125 * x); elseif (x <= 1.26e+103) tmp = t; elseif (x <= 2.4e+110) tmp = t_1; else tmp = Float64(0.125 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z * -0.5); tmp = 0.0; if (x <= -6.4e+94) tmp = 0.125 * x; elseif (x <= -1.42e-14) tmp = t; elseif (x <= -6.8e-192) tmp = t_1; elseif (x <= -4.1e-202) tmp = t; elseif (x <= 3.25e-279) tmp = t_1; elseif (x <= 3e-26) tmp = t; elseif (x <= 8.5e+58) tmp = 0.125 * x; elseif (x <= 1.26e+103) tmp = t; elseif (x <= 2.4e+110) tmp = t_1; else tmp = 0.125 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e+94], N[(0.125 * x), $MachinePrecision], If[LessEqual[x, -1.42e-14], t, If[LessEqual[x, -6.8e-192], t$95$1, If[LessEqual[x, -4.1e-202], t, If[LessEqual[x, 3.25e-279], t$95$1, If[LessEqual[x, 3e-26], t, If[LessEqual[x, 8.5e+58], N[(0.125 * x), $MachinePrecision], If[LessEqual[x, 1.26e+103], t, If[LessEqual[x, 2.4e+110], t$95$1, N[(0.125 * x), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z \cdot -0.5\right)\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{+94}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;x \leq -1.42 \cdot 10^{-14}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-192}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.1 \cdot 10^{-202}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 3.25 \cdot 10^{-279}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{-26}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+58}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{+103}:\\
\;\;\;\;t\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x\\
\end{array}
\end{array}
if x < -6.40000000000000028e94 or 3.00000000000000012e-26 < x < 8.50000000000000015e58 or 2.40000000000000012e110 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around 0 85.8%
Taylor expanded in x around inf 67.8%
if -6.40000000000000028e94 < x < -1.42000000000000004e-14 or -6.80000000000000003e-192 < x < -4.1000000000000004e-202 or 3.2499999999999998e-279 < x < 3.00000000000000012e-26 or 8.50000000000000015e58 < x < 1.26000000000000006e103Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 58.3%
if -1.42000000000000004e-14 < x < -6.80000000000000003e-192 or -4.1000000000000004e-202 < x < 3.2499999999999998e-279 or 1.26000000000000006e103 < x < 2.40000000000000012e110Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 90.4%
Taylor expanded in t around 0 64.6%
*-commutative64.6%
associate-*l*64.6%
*-commutative64.6%
Simplified64.6%
Final simplification64.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z y) -10000000.0) (not (<= (* z y) 2e-10))) (- (* 0.125 x) (* (* z y) 0.5)) (+ t (* 0.125 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * y) <= -10000000.0) || !((z * y) <= 2e-10)) {
tmp = (0.125 * x) - ((z * y) * 0.5);
} else {
tmp = t + (0.125 * 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 * y) <= (-10000000.0d0)) .or. (.not. ((z * y) <= 2d-10))) then
tmp = (0.125d0 * x) - ((z * y) * 0.5d0)
else
tmp = t + (0.125d0 * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z * y) <= -10000000.0) || !((z * y) <= 2e-10)) {
tmp = (0.125 * x) - ((z * y) * 0.5);
} else {
tmp = t + (0.125 * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * y) <= -10000000.0) or not ((z * y) <= 2e-10): tmp = (0.125 * x) - ((z * y) * 0.5) else: tmp = t + (0.125 * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * y) <= -10000000.0) || !(Float64(z * y) <= 2e-10)) tmp = Float64(Float64(0.125 * x) - Float64(Float64(z * y) * 0.5)); else tmp = Float64(t + Float64(0.125 * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * y) <= -10000000.0) || ~(((z * y) <= 2e-10))) tmp = (0.125 * x) - ((z * y) * 0.5); else tmp = t + (0.125 * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * y), $MachinePrecision], -10000000.0], N[Not[LessEqual[N[(z * y), $MachinePrecision], 2e-10]], $MachinePrecision]], N[(N[(0.125 * x), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(t + N[(0.125 * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot y \leq -10000000 \lor \neg \left(z \cdot y \leq 2 \cdot 10^{-10}\right):\\
\;\;\;\;0.125 \cdot x - \left(z \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t + 0.125 \cdot x\\
\end{array}
\end{array}
if (*.f64 y z) < -1e7 or 2.00000000000000007e-10 < (*.f64 y z) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around 0 88.7%
if -1e7 < (*.f64 y z) < 2.00000000000000007e-10Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 94.8%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (* z y) -3e+126) (not (<= (* z y) 5e+86))) (- t (* (* z y) 0.5)) (+ t (* 0.125 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * y) <= -3e+126) || !((z * y) <= 5e+86)) {
tmp = t - ((z * y) * 0.5);
} else {
tmp = t + (0.125 * 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 * y) <= (-3d+126)) .or. (.not. ((z * y) <= 5d+86))) then
tmp = t - ((z * y) * 0.5d0)
else
tmp = t + (0.125d0 * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z * y) <= -3e+126) || !((z * y) <= 5e+86)) {
tmp = t - ((z * y) * 0.5);
} else {
tmp = t + (0.125 * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * y) <= -3e+126) or not ((z * y) <= 5e+86): tmp = t - ((z * y) * 0.5) else: tmp = t + (0.125 * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z * y) <= -3e+126) || !(Float64(z * y) <= 5e+86)) tmp = Float64(t - Float64(Float64(z * y) * 0.5)); else tmp = Float64(t + Float64(0.125 * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * y) <= -3e+126) || ~(((z * y) <= 5e+86))) tmp = t - ((z * y) * 0.5); else tmp = t + (0.125 * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z * y), $MachinePrecision], -3e+126], N[Not[LessEqual[N[(z * y), $MachinePrecision], 5e+86]], $MachinePrecision]], N[(t - N[(N[(z * y), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(t + N[(0.125 * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot y \leq -3 \cdot 10^{+126} \lor \neg \left(z \cdot y \leq 5 \cdot 10^{+86}\right):\\
\;\;\;\;t - \left(z \cdot y\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t + 0.125 \cdot x\\
\end{array}
\end{array}
if (*.f64 y z) < -3.0000000000000002e126 or 4.9999999999999998e86 < (*.f64 y z) Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 84.1%
if -3.0000000000000002e126 < (*.f64 y z) < 4.9999999999999998e86Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 86.9%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (+ t (- (* 0.125 x) (* z (/ y 2.0)))))
double code(double x, double y, double z, double t) {
return t + ((0.125 * x) - (z * (y / 2.0)));
}
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 = t + ((0.125d0 * x) - (z * (y / 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return t + ((0.125 * x) - (z * (y / 2.0)));
}
def code(x, y, z, t): return t + ((0.125 * x) - (z * (y / 2.0)))
function code(x, y, z, t) return Float64(t + Float64(Float64(0.125 * x) - Float64(z * Float64(y / 2.0)))) end
function tmp = code(x, y, z, t) tmp = t + ((0.125 * x) - (z * (y / 2.0))); end
code[x_, y_, z_, t_] := N[(t + N[(N[(0.125 * x), $MachinePrecision] - N[(z * N[(y / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t + \left(0.125 \cdot x - z \cdot \frac{y}{2}\right)
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.4e+25) (not (<= z 1.2e+130))) (* y (* z -0.5)) (+ t (* 0.125 x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e+25) || !(z <= 1.2e+130)) {
tmp = y * (z * -0.5);
} else {
tmp = t + (0.125 * 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 <= (-6.4d+25)) .or. (.not. (z <= 1.2d+130))) then
tmp = y * (z * (-0.5d0))
else
tmp = t + (0.125d0 * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.4e+25) || !(z <= 1.2e+130)) {
tmp = y * (z * -0.5);
} else {
tmp = t + (0.125 * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.4e+25) or not (z <= 1.2e+130): tmp = y * (z * -0.5) else: tmp = t + (0.125 * x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.4e+25) || !(z <= 1.2e+130)) tmp = Float64(y * Float64(z * -0.5)); else tmp = Float64(t + Float64(0.125 * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.4e+25) || ~((z <= 1.2e+130))) tmp = y * (z * -0.5); else tmp = t + (0.125 * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.4e+25], N[Not[LessEqual[z, 1.2e+130]], $MachinePrecision]], N[(y * N[(z * -0.5), $MachinePrecision]), $MachinePrecision], N[(t + N[(0.125 * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+25} \lor \neg \left(z \leq 1.2 \cdot 10^{+130}\right):\\
\;\;\;\;y \cdot \left(z \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t + 0.125 \cdot x\\
\end{array}
\end{array}
if z < -6.3999999999999999e25 or 1.20000000000000012e130 < z Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 64.6%
Taylor expanded in t around 0 50.0%
*-commutative50.0%
associate-*l*50.0%
*-commutative50.0%
Simplified50.0%
if -6.3999999999999999e25 < z < 1.20000000000000012e130Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around inf 77.1%
Final simplification67.7%
(FPCore (x y z t) :precision binary64 (if (<= x -6.4e+94) (* 0.125 x) (if (<= x 4e-32) t (* 0.125 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.4e+94) {
tmp = 0.125 * x;
} else if (x <= 4e-32) {
tmp = t;
} else {
tmp = 0.125 * 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 <= (-6.4d+94)) then
tmp = 0.125d0 * x
else if (x <= 4d-32) then
tmp = t
else
tmp = 0.125d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.4e+94) {
tmp = 0.125 * x;
} else if (x <= 4e-32) {
tmp = t;
} else {
tmp = 0.125 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.4e+94: tmp = 0.125 * x elif x <= 4e-32: tmp = t else: tmp = 0.125 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.4e+94) tmp = Float64(0.125 * x); elseif (x <= 4e-32) tmp = t; else tmp = Float64(0.125 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.4e+94) tmp = 0.125 * x; elseif (x <= 4e-32) tmp = t; else tmp = 0.125 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.4e+94], N[(0.125 * x), $MachinePrecision], If[LessEqual[x, 4e-32], t, N[(0.125 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{+94}:\\
\;\;\;\;0.125 \cdot x\\
\mathbf{elif}\;x \leq 4 \cdot 10^{-32}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;0.125 \cdot x\\
\end{array}
\end{array}
if x < -6.40000000000000028e94 or 4.00000000000000022e-32 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around 0 83.4%
Taylor expanded in x around inf 64.1%
if -6.40000000000000028e94 < x < 4.00000000000000022e-32Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 43.8%
Final simplification53.9%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return 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 = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
neg-sub0100.0%
associate-+l-100.0%
sub-neg100.0%
+-commutative100.0%
associate--r+100.0%
neg-sub0100.0%
distribute-rgt-neg-in100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
remove-double-neg100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around inf 30.2%
Final simplification30.2%
(FPCore (x y z t) :precision binary64 (- (+ (/ x 8.0) t) (* (/ z 2.0) y)))
double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * y);
}
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 / 8.0d0) + t) - ((z / 2.0d0) * y)
end function
public static double code(double x, double y, double z, double t) {
return ((x / 8.0) + t) - ((z / 2.0) * y);
}
def code(x, y, z, t): return ((x / 8.0) + t) - ((z / 2.0) * y)
function code(x, y, z, t) return Float64(Float64(Float64(x / 8.0) + t) - Float64(Float64(z / 2.0) * y)) end
function tmp = code(x, y, z, t) tmp = ((x / 8.0) + t) - ((z / 2.0) * y); end
code[x_, y_, z_, t_] := N[(N[(N[(x / 8.0), $MachinePrecision] + t), $MachinePrecision] - N[(N[(z / 2.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{8} + t\right) - \frac{z}{2} \cdot y
\end{array}
herbie shell --seed 2023257
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(- (+ (/ x 8.0) t) (* (/ z 2.0) y))
(+ (- (* (/ 1.0 8.0) x) (/ (* y z) 2.0)) t))