
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.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 = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.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 = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (fma x (+ (* 2.0 (+ y z)) t) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, ((2.0 * (y + z)) + t), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(Float64(2.0 * Float64(y + z)) + t), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, 2 \cdot \left(y + z\right) + t, y \cdot 5\right)
\end{array}
Initial program 99.9%
fma-define99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* x 2.0))))
(if (<= z -1.02e+136)
t_1
(if (<= z -9.5e-50)
(* x t)
(if (<= z -1.2e-179)
(* y 5.0)
(if (<= z 1.8e-46)
(* x t)
(if (<= z 3.8e+53) (* y 5.0) (if (<= z 1.85e+62) (* x t) t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x * 2.0);
double tmp;
if (z <= -1.02e+136) {
tmp = t_1;
} else if (z <= -9.5e-50) {
tmp = x * t;
} else if (z <= -1.2e-179) {
tmp = y * 5.0;
} else if (z <= 1.8e-46) {
tmp = x * t;
} else if (z <= 3.8e+53) {
tmp = y * 5.0;
} else if (z <= 1.85e+62) {
tmp = x * t;
} 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 * (x * 2.0d0)
if (z <= (-1.02d+136)) then
tmp = t_1
else if (z <= (-9.5d-50)) then
tmp = x * t
else if (z <= (-1.2d-179)) then
tmp = y * 5.0d0
else if (z <= 1.8d-46) then
tmp = x * t
else if (z <= 3.8d+53) then
tmp = y * 5.0d0
else if (z <= 1.85d+62) then
tmp = x * t
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 * (x * 2.0);
double tmp;
if (z <= -1.02e+136) {
tmp = t_1;
} else if (z <= -9.5e-50) {
tmp = x * t;
} else if (z <= -1.2e-179) {
tmp = y * 5.0;
} else if (z <= 1.8e-46) {
tmp = x * t;
} else if (z <= 3.8e+53) {
tmp = y * 5.0;
} else if (z <= 1.85e+62) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (x * 2.0) tmp = 0 if z <= -1.02e+136: tmp = t_1 elif z <= -9.5e-50: tmp = x * t elif z <= -1.2e-179: tmp = y * 5.0 elif z <= 1.8e-46: tmp = x * t elif z <= 3.8e+53: tmp = y * 5.0 elif z <= 1.85e+62: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(x * 2.0)) tmp = 0.0 if (z <= -1.02e+136) tmp = t_1; elseif (z <= -9.5e-50) tmp = Float64(x * t); elseif (z <= -1.2e-179) tmp = Float64(y * 5.0); elseif (z <= 1.8e-46) tmp = Float64(x * t); elseif (z <= 3.8e+53) tmp = Float64(y * 5.0); elseif (z <= 1.85e+62) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (x * 2.0); tmp = 0.0; if (z <= -1.02e+136) tmp = t_1; elseif (z <= -9.5e-50) tmp = x * t; elseif (z <= -1.2e-179) tmp = y * 5.0; elseif (z <= 1.8e-46) tmp = x * t; elseif (z <= 3.8e+53) tmp = y * 5.0; elseif (z <= 1.85e+62) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e+136], t$95$1, If[LessEqual[z, -9.5e-50], N[(x * t), $MachinePrecision], If[LessEqual[z, -1.2e-179], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 1.8e-46], N[(x * t), $MachinePrecision], If[LessEqual[z, 3.8e+53], N[(y * 5.0), $MachinePrecision], If[LessEqual[z, 1.85e+62], N[(x * t), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x \cdot 2\right)\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{+136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-50}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-179}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-46}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+53}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+62}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.01999999999999996e136 or 1.85000000000000007e62 < z Initial program 100.0%
Taylor expanded in z around inf 74.2%
Simplified74.2%
if -1.01999999999999996e136 < z < -9.4999999999999993e-50 or -1.2e-179 < z < 1.8e-46 or 3.79999999999999997e53 < z < 1.85000000000000007e62Initial program 99.9%
Taylor expanded in t around inf 53.2%
Simplified53.2%
if -9.4999999999999993e-50 < z < -1.2e-179 or 1.8e-46 < z < 3.79999999999999997e53Initial program 99.8%
Taylor expanded in x around 0 45.0%
Final simplification58.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ (* 2.0 (+ y z)) t))))
(if (<= x -7e-99)
t_1
(if (<= x 2.15e-193)
(+ (* y 5.0) (* x t))
(if (<= x 4.1e-75)
(+ (* y 5.0) (* 2.0 (* x z)))
(if (<= x 2.45e-45) (* t (+ x (* y (/ 5.0 t)))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -7e-99) {
tmp = t_1;
} else if (x <= 2.15e-193) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 4.1e-75) {
tmp = (y * 5.0) + (2.0 * (x * z));
} else if (x <= 2.45e-45) {
tmp = t * (x + (y * (5.0 / t)));
} 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 = x * ((2.0d0 * (y + z)) + t)
if (x <= (-7d-99)) then
tmp = t_1
else if (x <= 2.15d-193) then
tmp = (y * 5.0d0) + (x * t)
else if (x <= 4.1d-75) then
tmp = (y * 5.0d0) + (2.0d0 * (x * z))
else if (x <= 2.45d-45) then
tmp = t * (x + (y * (5.0d0 / t)))
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 = x * ((2.0 * (y + z)) + t);
double tmp;
if (x <= -7e-99) {
tmp = t_1;
} else if (x <= 2.15e-193) {
tmp = (y * 5.0) + (x * t);
} else if (x <= 4.1e-75) {
tmp = (y * 5.0) + (2.0 * (x * z));
} else if (x <= 2.45e-45) {
tmp = t * (x + (y * (5.0 / t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((2.0 * (y + z)) + t) tmp = 0 if x <= -7e-99: tmp = t_1 elif x <= 2.15e-193: tmp = (y * 5.0) + (x * t) elif x <= 4.1e-75: tmp = (y * 5.0) + (2.0 * (x * z)) elif x <= 2.45e-45: tmp = t * (x + (y * (5.0 / t))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)) tmp = 0.0 if (x <= -7e-99) tmp = t_1; elseif (x <= 2.15e-193) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); elseif (x <= 4.1e-75) tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); elseif (x <= 2.45e-45) tmp = Float64(t * Float64(x + Float64(y * Float64(5.0 / t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((2.0 * (y + z)) + t); tmp = 0.0; if (x <= -7e-99) tmp = t_1; elseif (x <= 2.15e-193) tmp = (y * 5.0) + (x * t); elseif (x <= 4.1e-75) tmp = (y * 5.0) + (2.0 * (x * z)); elseif (x <= 2.45e-45) tmp = t * (x + (y * (5.0 / t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e-99], t$95$1, If[LessEqual[x, 2.15e-193], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.1e-75], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.45e-45], N[(t * N[(x + N[(y * N[(5.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.15 \cdot 10^{-193}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-75}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{-45}:\\
\;\;\;\;t \cdot \left(x + y \cdot \frac{5}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.9999999999999997e-99 or 2.4499999999999999e-45 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 95.4%
if -6.9999999999999997e-99 < x < 2.1500000000000001e-193Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 88.5%
if 2.1500000000000001e-193 < x < 4.10000000000000002e-75Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in t around 0 86.7%
if 4.10000000000000002e-75 < x < 2.4499999999999999e-45Initial program 99.6%
Taylor expanded in y around 0 99.6%
Taylor expanded in t around inf 99.4%
Taylor expanded in x around 0 87.4%
associate-*r/87.2%
*-commutative87.2%
associate-*r/87.6%
Simplified87.6%
Final simplification92.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 (+ y z)))))
(if (<= x -7.5e-101)
t_1
(if (<= x 5.6e-86)
(* y 5.0)
(if (or (<= x 1.7e+66) (not (<= x 1.1e+122))) t_1 (* x t))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * (y + z));
double tmp;
if (x <= -7.5e-101) {
tmp = t_1;
} else if (x <= 5.6e-86) {
tmp = y * 5.0;
} else if ((x <= 1.7e+66) || !(x <= 1.1e+122)) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = x * (2.0d0 * (y + z))
if (x <= (-7.5d-101)) then
tmp = t_1
else if (x <= 5.6d-86) then
tmp = y * 5.0d0
else if ((x <= 1.7d+66) .or. (.not. (x <= 1.1d+122))) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * (y + z));
double tmp;
if (x <= -7.5e-101) {
tmp = t_1;
} else if (x <= 5.6e-86) {
tmp = y * 5.0;
} else if ((x <= 1.7e+66) || !(x <= 1.1e+122)) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * (y + z)) tmp = 0 if x <= -7.5e-101: tmp = t_1 elif x <= 5.6e-86: tmp = y * 5.0 elif (x <= 1.7e+66) or not (x <= 1.1e+122): tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * Float64(y + z))) tmp = 0.0 if (x <= -7.5e-101) tmp = t_1; elseif (x <= 5.6e-86) tmp = Float64(y * 5.0); elseif ((x <= 1.7e+66) || !(x <= 1.1e+122)) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (2.0 * (y + z)); tmp = 0.0; if (x <= -7.5e-101) tmp = t_1; elseif (x <= 5.6e-86) tmp = y * 5.0; elseif ((x <= 1.7e+66) || ~((x <= 1.1e+122))) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.5e-101], t$95$1, If[LessEqual[x, 5.6e-86], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 1.7e+66], N[Not[LessEqual[x, 1.1e+122]], $MachinePrecision]], t$95$1, N[(x * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot \left(y + z\right)\right)\\
\mathbf{if}\;x \leq -7.5 \cdot 10^{-101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-86}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+66} \lor \neg \left(x \leq 1.1 \cdot 10^{+122}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -7.5000000000000001e-101 or 5.60000000000000019e-86 < x < 1.70000000000000015e66 or 1.1e122 < x Initial program 99.9%
Taylor expanded in y around 0 95.1%
Taylor expanded in x around inf 88.2%
*-commutative88.2%
*-commutative88.2%
associate-*r*88.2%
Simplified88.2%
Taylor expanded in t around 0 61.0%
*-commutative61.0%
associate-*r*61.0%
*-commutative61.0%
associate-*r*61.0%
distribute-rgt-in65.3%
+-commutative65.3%
distribute-lft-out65.3%
Simplified65.3%
if -7.5000000000000001e-101 < x < 5.60000000000000019e-86Initial program 99.9%
Taylor expanded in x around 0 63.8%
if 1.70000000000000015e66 < x < 1.1e122Initial program 100.0%
Taylor expanded in t around inf 82.1%
Simplified82.1%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (not (<= x 1.18e-20))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* x (+ t (* 2.0 z))) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5) || !(x <= 1.18e-20)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
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 <= (-2.5d0)) .or. (.not. (x <= 1.18d-20))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5) || !(x <= 1.18e-20)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5) or not (x <= 1.18e-20): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (x * (t + (2.0 * z))) + (y * 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5) || !(x <= 1.18e-20)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.5) || ~((x <= 1.18e-20))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (x * (t + (2.0 * z))) + (y * 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5], N[Not[LessEqual[x, 1.18e-20]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \lor \neg \left(x \leq 1.18 \cdot 10^{-20}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\end{array}
\end{array}
if x < -2.5 or 1.1800000000000001e-20 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 98.8%
if -2.5 < x < 1.1800000000000001e-20Initial program 99.9%
Taylor expanded in y around 0 99.5%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* 2.0 (+ y z))))
(if (<= x -1.05e-12)
(* x (+ t (+ t_1 (* 5.0 (/ y x)))))
(if (<= x 1.18e-20)
(+ (* x (+ t (* 2.0 z))) (* y 5.0))
(* x (+ t_1 t))))))
double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (x <= -1.05e-12) {
tmp = x * (t + (t_1 + (5.0 * (y / x))));
} else if (x <= 1.18e-20) {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
} else {
tmp = x * (t_1 + 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 = 2.0d0 * (y + z)
if (x <= (-1.05d-12)) then
tmp = x * (t + (t_1 + (5.0d0 * (y / x))))
else if (x <= 1.18d-20) then
tmp = (x * (t + (2.0d0 * z))) + (y * 5.0d0)
else
tmp = x * (t_1 + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 2.0 * (y + z);
double tmp;
if (x <= -1.05e-12) {
tmp = x * (t + (t_1 + (5.0 * (y / x))));
} else if (x <= 1.18e-20) {
tmp = (x * (t + (2.0 * z))) + (y * 5.0);
} else {
tmp = x * (t_1 + t);
}
return tmp;
}
def code(x, y, z, t): t_1 = 2.0 * (y + z) tmp = 0 if x <= -1.05e-12: tmp = x * (t + (t_1 + (5.0 * (y / x)))) elif x <= 1.18e-20: tmp = (x * (t + (2.0 * z))) + (y * 5.0) else: tmp = x * (t_1 + t) return tmp
function code(x, y, z, t) t_1 = Float64(2.0 * Float64(y + z)) tmp = 0.0 if (x <= -1.05e-12) tmp = Float64(x * Float64(t + Float64(t_1 + Float64(5.0 * Float64(y / x))))); elseif (x <= 1.18e-20) tmp = Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * 5.0)); else tmp = Float64(x * Float64(t_1 + t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 2.0 * (y + z); tmp = 0.0; if (x <= -1.05e-12) tmp = x * (t + (t_1 + (5.0 * (y / x)))); elseif (x <= 1.18e-20) tmp = (x * (t + (2.0 * z))) + (y * 5.0); else tmp = x * (t_1 + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.05e-12], N[(x * N[(t + N[(t$95$1 + N[(5.0 * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.18e-20], N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$1 + t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(y + z\right)\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(t + \left(t\_1 + 5 \cdot \frac{y}{x}\right)\right)\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{-20}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right) + y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t\_1 + t\right)\\
\end{array}
\end{array}
if x < -1.04999999999999997e-12Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -1.04999999999999997e-12 < x < 1.1800000000000001e-20Initial program 99.9%
Taylor expanded in y around 0 99.9%
if 1.1800000000000001e-20 < x Initial program 100.0%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.7e-99) (not (<= x 1.05e-84))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.7e-99) || !(x <= 1.05e-84)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (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 <= (-3.7d-99)) .or. (.not. (x <= 1.05d-84))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.7e-99) || !(x <= 1.05e-84)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.7e-99) or not (x <= 1.05e-84): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.7e-99) || !(x <= 1.05e-84)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.7e-99) || ~((x <= 1.05e-84))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.7e-99], N[Not[LessEqual[x, 1.05e-84]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-99} \lor \neg \left(x \leq 1.05 \cdot 10^{-84}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -3.7e-99 or 1.04999999999999999e-84 < x Initial program 99.9%
fma-define100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 93.5%
if -3.7e-99 < x < 1.04999999999999999e-84Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around 0 84.9%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.4e-183) (not (<= x 1.15e-85))) (* x (+ t (* 2.0 z))) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-183) || !(x <= 1.15e-85)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
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 <= (-2.4d-183)) .or. (.not. (x <= 1.15d-85))) then
tmp = x * (t + (2.0d0 * z))
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.4e-183) || !(x <= 1.15e-85)) {
tmp = x * (t + (2.0 * z));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.4e-183) or not (x <= 1.15e-85): tmp = x * (t + (2.0 * z)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.4e-183) || !(x <= 1.15e-85)) tmp = Float64(x * Float64(t + Float64(2.0 * z))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.4e-183) || ~((x <= 1.15e-85))) tmp = x * (t + (2.0 * z)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.4e-183], N[Not[LessEqual[x, 1.15e-85]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-183} \lor \neg \left(x \leq 1.15 \cdot 10^{-85}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -2.39999999999999993e-183 or 1.15e-85 < x Initial program 99.9%
Taylor expanded in y around 0 76.1%
if -2.39999999999999993e-183 < x < 1.15e-85Initial program 99.8%
Taylor expanded in x around 0 67.7%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.05e+44) (not (<= y 5.1e+90))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e+44) || !(y <= 5.1e+90)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * 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 ((y <= (-1.05d+44)) .or. (.not. (y <= 5.1d+90))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (2.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.05e+44) || !(y <= 5.1e+90)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.05e+44) or not (y <= 5.1e+90): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.05e+44) || !(y <= 5.1e+90)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(2.0 * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.05e+44) || ~((y <= 5.1e+90))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.05e+44], N[Not[LessEqual[y, 5.1e+90]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+44} \lor \neg \left(y \leq 5.1 \cdot 10^{+90}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -1.04999999999999993e44 or 5.09999999999999959e90 < y Initial program 99.9%
Taylor expanded in y around inf 83.2%
Simplified83.2%
if -1.04999999999999993e44 < y < 5.09999999999999959e90Initial program 100.0%
Taylor expanded in y around 0 83.4%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (* 2.0 z))) (* y (+ 5.0 (* x 2.0)))))
double code(double x, double y, double z, double t) {
return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 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 = (x * (t + (2.0d0 * z))) + (y * (5.0d0 + (x * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)));
}
def code(x, y, z, t): return (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0)))
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(2.0 * z))) + Float64(y * Float64(5.0 + Float64(x * 2.0)))) end
function tmp = code(x, y, z, t) tmp = (x * (t + (2.0 * z))) + (y * (5.0 + (x * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + 2 \cdot z\right) + y \cdot \left(5 + x \cdot 2\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 96.8%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (+ (* x (+ t (+ y (+ z (+ y z))))) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.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 = (x * (t + (y + (z + (y + z))))) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * (t + (y + (z + (y + z))))) + (y * 5.0);
}
def code(x, y, z, t): return (x * (t + (y + (z + (y + z))))) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z))))) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * (t + (y + (z + (y + z))))) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right) + y \cdot 5
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.5e-8) (not (<= x 1.4e-20))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.5e-8) || !(x <= 1.4e-20)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-5.5d-8)) .or. (.not. (x <= 1.4d-20))) then
tmp = x * t
else
tmp = y * 5.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.5e-8) || !(x <= 1.4e-20)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -5.5e-8) or not (x <= 1.4e-20): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -5.5e-8) || !(x <= 1.4e-20)) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -5.5e-8) || ~((x <= 1.4e-20))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -5.5e-8], N[Not[LessEqual[x, 1.4e-20]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-8} \lor \neg \left(x \leq 1.4 \cdot 10^{-20}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.5000000000000003e-8 or 1.4000000000000001e-20 < x Initial program 100.0%
Taylor expanded in t around inf 43.8%
Simplified43.8%
if -5.5000000000000003e-8 < x < 1.4000000000000001e-20Initial program 99.9%
Taylor expanded in x around 0 54.5%
Final simplification48.6%
(FPCore (x y z t) :precision binary64 (* y 5.0))
double code(double x, double y, double z, double t) {
return y * 5.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 = y * 5.0d0
end function
public static double code(double x, double y, double z, double t) {
return y * 5.0;
}
def code(x, y, z, t): return y * 5.0
function code(x, y, z, t) return Float64(y * 5.0) end
function tmp = code(x, y, z, t) tmp = y * 5.0; end
code[x_, y_, z_, t_] := N[(y * 5.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 25.8%
Final simplification25.8%
herbie shell --seed 2024059
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendOutside from plot-0.2.3.4, B"
:precision binary64
(+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))