
(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 15 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-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(if (<= x -7e+163)
(* x y)
(if (<= x -0.00072)
(* x t)
(if (<= x 0.11)
(* y 5.0)
(if (or (<= x 7.3e+211) (not (<= x 7.4e+281)))
(* x t)
(* 2.0 (* x z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+163) {
tmp = x * y;
} else if (x <= -0.00072) {
tmp = x * t;
} else if (x <= 0.11) {
tmp = y * 5.0;
} else if ((x <= 7.3e+211) || !(x <= 7.4e+281)) {
tmp = x * t;
} else {
tmp = 2.0 * (x * 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 (x <= (-7d+163)) then
tmp = x * y
else if (x <= (-0.00072d0)) then
tmp = x * t
else if (x <= 0.11d0) then
tmp = y * 5.0d0
else if ((x <= 7.3d+211) .or. (.not. (x <= 7.4d+281))) then
tmp = x * t
else
tmp = 2.0d0 * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e+163) {
tmp = x * y;
} else if (x <= -0.00072) {
tmp = x * t;
} else if (x <= 0.11) {
tmp = y * 5.0;
} else if ((x <= 7.3e+211) || !(x <= 7.4e+281)) {
tmp = x * t;
} else {
tmp = 2.0 * (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e+163: tmp = x * y elif x <= -0.00072: tmp = x * t elif x <= 0.11: tmp = y * 5.0 elif (x <= 7.3e+211) or not (x <= 7.4e+281): tmp = x * t else: tmp = 2.0 * (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e+163) tmp = Float64(x * y); elseif (x <= -0.00072) tmp = Float64(x * t); elseif (x <= 0.11) tmp = Float64(y * 5.0); elseif ((x <= 7.3e+211) || !(x <= 7.4e+281)) tmp = Float64(x * t); else tmp = Float64(2.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7e+163) tmp = x * y; elseif (x <= -0.00072) tmp = x * t; elseif (x <= 0.11) tmp = y * 5.0; elseif ((x <= 7.3e+211) || ~((x <= 7.4e+281))) tmp = x * t; else tmp = 2.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e+163], N[(x * y), $MachinePrecision], If[LessEqual[x, -0.00072], N[(x * t), $MachinePrecision], If[LessEqual[x, 0.11], N[(y * 5.0), $MachinePrecision], If[Or[LessEqual[x, 7.3e+211], N[Not[LessEqual[x, 7.4e+281]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+163}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -0.00072:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 0.11:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 7.3 \cdot 10^{+211} \lor \neg \left(x \leq 7.4 \cdot 10^{+281}\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -7.0000000000000005e163Initial program 100.0%
Taylor expanded in y around 0 91.9%
Taylor expanded in z around 0 75.5%
Simplified75.5%
Taylor expanded in y around inf 59.2%
+-commutative59.2%
Simplified59.2%
Taylor expanded in x around inf 59.2%
*-commutative59.2%
Simplified59.2%
if -7.0000000000000005e163 < x < -7.20000000000000045e-4 or 0.110000000000000001 < x < 7.3000000000000001e211 or 7.3999999999999996e281 < x Initial program 100.0%
Taylor expanded in t around inf 42.1%
Simplified42.1%
if -7.20000000000000045e-4 < x < 0.110000000000000001Initial program 99.9%
Taylor expanded in x around 0 67.0%
if 7.3000000000000001e211 < x < 7.3999999999999996e281Initial program 100.0%
Taylor expanded in z around inf 67.5%
Final simplification57.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ x 5.0))))
(if (<= y -3e-84)
t_1
(if (<= y 4.1e-173)
(* x t)
(if (<= y 6.2e-82) (* 2.0 (* x z)) (if (<= y 1.7e-12) (* x t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (x + 5.0);
double tmp;
if (y <= -3e-84) {
tmp = t_1;
} else if (y <= 4.1e-173) {
tmp = x * t;
} else if (y <= 6.2e-82) {
tmp = 2.0 * (x * z);
} else if (y <= 1.7e-12) {
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 = y * (x + 5.0d0)
if (y <= (-3d-84)) then
tmp = t_1
else if (y <= 4.1d-173) then
tmp = x * t
else if (y <= 6.2d-82) then
tmp = 2.0d0 * (x * z)
else if (y <= 1.7d-12) 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 = y * (x + 5.0);
double tmp;
if (y <= -3e-84) {
tmp = t_1;
} else if (y <= 4.1e-173) {
tmp = x * t;
} else if (y <= 6.2e-82) {
tmp = 2.0 * (x * z);
} else if (y <= 1.7e-12) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (x + 5.0) tmp = 0 if y <= -3e-84: tmp = t_1 elif y <= 4.1e-173: tmp = x * t elif y <= 6.2e-82: tmp = 2.0 * (x * z) elif y <= 1.7e-12: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(x + 5.0)) tmp = 0.0 if (y <= -3e-84) tmp = t_1; elseif (y <= 4.1e-173) tmp = Float64(x * t); elseif (y <= 6.2e-82) tmp = Float64(2.0 * Float64(x * z)); elseif (y <= 1.7e-12) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (x + 5.0); tmp = 0.0; if (y <= -3e-84) tmp = t_1; elseif (y <= 4.1e-173) tmp = x * t; elseif (y <= 6.2e-82) tmp = 2.0 * (x * z); elseif (y <= 1.7e-12) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3e-84], t$95$1, If[LessEqual[y, 4.1e-173], N[(x * t), $MachinePrecision], If[LessEqual[y, 6.2e-82], N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e-12], N[(x * t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(x + 5\right)\\
\mathbf{if}\;y \leq -3 \cdot 10^{-84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-173}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-82}:\\
\;\;\;\;2 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-12}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.0000000000000001e-84 or 1.7e-12 < y Initial program 99.9%
Taylor expanded in y around 0 91.1%
Taylor expanded in y around inf 70.8%
if -3.0000000000000001e-84 < y < 4.0999999999999997e-173 or 6.19999999999999999e-82 < y < 1.7e-12Initial program 100.0%
Taylor expanded in t around inf 51.0%
Simplified51.0%
if 4.0999999999999997e-173 < y < 6.19999999999999999e-82Initial program 100.0%
Taylor expanded in z around inf 73.6%
Final simplification64.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -62000.0) (not (<= x 5.0))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (+ y (* 2.0 z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -62000.0) || !(x <= 5.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + (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 ((x <= (-62000.0d0)) .or. (.not. (x <= 5.0d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (t + (y + (2.0d0 * z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -62000.0) || !(x <= 5.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + (2.0 * z))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -62000.0) or not (x <= 5.0): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (y + (2.0 * z)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -62000.0) || !(x <= 5.0)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(2.0 * z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -62000.0) || ~((x <= 5.0))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (y + (2.0 * z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -62000.0], N[Not[LessEqual[x, 5.0]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -62000 \lor \neg \left(x \leq 5\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + 2 \cdot z\right)\right)\\
\end{array}
\end{array}
if x < -62000 or 5 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.1%
if -62000 < x < 5Initial program 99.9%
Taylor expanded in y around 0 98.9%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.05e+16) (not (<= x 50000.0))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ t (+ y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e+16) || !(x <= 50000.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
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 <= (-1.05d+16)) .or. (.not. (x <= 50000.0d0))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (t + (y + y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.05e+16) || !(x <= 50000.0)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (t + (y + y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.05e+16) or not (x <= 50000.0): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (t + (y + y))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.05e+16) || !(x <= 50000.0)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.05e+16) || ~((x <= 50000.0))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (t + (y + y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.05e+16], N[Not[LessEqual[x, 50000.0]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{+16} \lor \neg \left(x \leq 50000\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\end{array}
\end{array}
if x < -1.05e16 or 5e4 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
if -1.05e16 < x < 5e4Initial program 99.9%
Taylor expanded in y around inf 85.3%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.8e-15) (not (<= t 2.6e-10))) (+ (* y 5.0) (* x (+ t (+ y y)))) (+ (* y 5.0) (* (+ y z) (* x 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.8e-15) || !(t <= 2.6e-10)) {
tmp = (y * 5.0) + (x * (t + (y + y)));
} else {
tmp = (y * 5.0) + ((y + z) * (x * 2.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 ((t <= (-5.8d-15)) .or. (.not. (t <= 2.6d-10))) then
tmp = (y * 5.0d0) + (x * (t + (y + y)))
else
tmp = (y * 5.0d0) + ((y + z) * (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.8e-15) || !(t <= 2.6e-10)) {
tmp = (y * 5.0) + (x * (t + (y + y)));
} else {
tmp = (y * 5.0) + ((y + z) * (x * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.8e-15) or not (t <= 2.6e-10): tmp = (y * 5.0) + (x * (t + (y + y))) else: tmp = (y * 5.0) + ((y + z) * (x * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.8e-15) || !(t <= 2.6e-10)) tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + y)))); else tmp = Float64(Float64(y * 5.0) + Float64(Float64(y + z) * Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.8e-15) || ~((t <= 2.6e-10))) tmp = (y * 5.0) + (x * (t + (y + y))); else tmp = (y * 5.0) + ((y + z) * (x * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.8e-15], N[Not[LessEqual[t, 2.6e-10]], $MachinePrecision]], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(N[(y + z), $MachinePrecision] * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{-15} \lor \neg \left(t \leq 2.6 \cdot 10^{-10}\right):\\
\;\;\;\;y \cdot 5 + x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + \left(y + z\right) \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if t < -5.80000000000000037e-15 or 2.59999999999999981e-10 < t Initial program 100.0%
Taylor expanded in y around inf 91.1%
if -5.80000000000000037e-15 < t < 2.59999999999999981e-10Initial program 99.9%
Taylor expanded in t around 0 96.2%
Simplified96.2%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00023) (not (<= x 2.1e-46))) (* x (+ (* 2.0 (+ y z)) t)) (* y (+ 5.0 (* x 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00023) || !(x <= 2.1e-46)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = y * (5.0 + (x * 2.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 <= (-0.00023d0)) .or. (.not. (x <= 2.1d-46))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = y * (5.0d0 + (x * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00023) || !(x <= 2.1e-46)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = y * (5.0 + (x * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00023) or not (x <= 2.1e-46): tmp = x * ((2.0 * (y + z)) + t) else: tmp = y * (5.0 + (x * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00023) || !(x <= 2.1e-46)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.00023) || ~((x <= 2.1e-46))) tmp = x * ((2.0 * (y + z)) + t); else tmp = y * (5.0 + (x * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00023], N[Not[LessEqual[x, 2.1e-46]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00023 \lor \neg \left(x \leq 2.1 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -2.3000000000000001e-4 or 2.09999999999999987e-46 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.2%
if -2.3000000000000001e-4 < x < 2.09999999999999987e-46Initial program 99.8%
Taylor expanded in y around inf 69.9%
Simplified69.9%
Final simplification84.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.25e-10) (not (<= x 4.4e-46))) (* x (+ (* 2.0 (+ y z)) t)) (+ (* y 5.0) (* x (+ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.25e-10) || !(x <= 4.4e-46)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (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) :: tmp
if ((x <= (-3.25d-10)) .or. (.not. (x <= 4.4d-46))) then
tmp = x * ((2.0d0 * (y + z)) + t)
else
tmp = (y * 5.0d0) + (x * (y + t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.25e-10) || !(x <= 4.4e-46)) {
tmp = x * ((2.0 * (y + z)) + t);
} else {
tmp = (y * 5.0) + (x * (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.25e-10) or not (x <= 4.4e-46): tmp = x * ((2.0 * (y + z)) + t) else: tmp = (y * 5.0) + (x * (y + t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.25e-10) || !(x <= 4.4e-46)) tmp = Float64(x * Float64(Float64(2.0 * Float64(y + z)) + t)); else tmp = Float64(Float64(y * 5.0) + Float64(x * Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.25e-10) || ~((x <= 4.4e-46))) tmp = x * ((2.0 * (y + z)) + t); else tmp = (y * 5.0) + (x * (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.25e-10], N[Not[LessEqual[x, 4.4e-46]], $MachinePrecision]], N[(x * N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.25 \cdot 10^{-10} \lor \neg \left(x \leq 4.4 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + z\right) + t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot \left(y + t\right)\\
\end{array}
\end{array}
if x < -3.2500000000000002e-10 or 4.4000000000000002e-46 < x Initial program 100.0%
fma-def100.0%
associate-+l+100.0%
+-commutative100.0%
count-2100.0%
Simplified100.0%
Taylor expanded in x around inf 96.5%
if -3.2500000000000002e-10 < x < 4.4000000000000002e-46Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around 0 86.4%
Simplified86.4%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (<= x -5.2e+163) (* x y) (if (or (<= x -0.00024) (not (<= x 0.105))) (* x t) (* y 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.2e+163) {
tmp = x * y;
} else if ((x <= -0.00024) || !(x <= 0.105)) {
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.2d+163)) then
tmp = x * y
else if ((x <= (-0.00024d0)) .or. (.not. (x <= 0.105d0))) 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.2e+163) {
tmp = x * y;
} else if ((x <= -0.00024) || !(x <= 0.105)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.2e+163: tmp = x * y elif (x <= -0.00024) or not (x <= 0.105): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.2e+163) tmp = Float64(x * y); elseif ((x <= -0.00024) || !(x <= 0.105)) 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.2e+163) tmp = x * y; elseif ((x <= -0.00024) || ~((x <= 0.105))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.2e+163], N[(x * y), $MachinePrecision], If[Or[LessEqual[x, -0.00024], N[Not[LessEqual[x, 0.105]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{+163}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -0.00024 \lor \neg \left(x \leq 0.105\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -5.2000000000000003e163Initial program 100.0%
Taylor expanded in y around 0 91.9%
Taylor expanded in z around 0 75.5%
Simplified75.5%
Taylor expanded in y around inf 59.2%
+-commutative59.2%
Simplified59.2%
Taylor expanded in x around inf 59.2%
*-commutative59.2%
Simplified59.2%
if -5.2000000000000003e163 < x < -2.40000000000000006e-4 or 0.104999999999999996 < x Initial program 100.0%
Taylor expanded in t around inf 39.2%
Simplified39.2%
if -2.40000000000000006e-4 < x < 0.104999999999999996Initial program 99.9%
Taylor expanded in x around 0 67.0%
Final simplification55.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00018) (not (<= x 5.8e-46))) (* x (+ t (* 2.0 y))) (* y (+ x 5.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00018) || !(x <= 5.8e-46)) {
tmp = x * (t + (2.0 * y));
} else {
tmp = y * (x + 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 <= (-0.00018d0)) .or. (.not. (x <= 5.8d-46))) then
tmp = x * (t + (2.0d0 * y))
else
tmp = y * (x + 5.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00018) || !(x <= 5.8e-46)) {
tmp = x * (t + (2.0 * y));
} else {
tmp = y * (x + 5.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00018) or not (x <= 5.8e-46): tmp = x * (t + (2.0 * y)) else: tmp = y * (x + 5.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00018) || !(x <= 5.8e-46)) tmp = Float64(x * Float64(t + Float64(2.0 * y))); else tmp = Float64(y * Float64(x + 5.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.00018) || ~((x <= 5.8e-46))) tmp = x * (t + (2.0 * y)); else tmp = y * (x + 5.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00018], N[Not[LessEqual[x, 5.8e-46]], $MachinePrecision]], N[(x * N[(t + N[(2.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + 5.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00018 \lor \neg \left(x \leq 5.8 \cdot 10^{-46}\right):\\
\;\;\;\;x \cdot \left(t + 2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + 5\right)\\
\end{array}
\end{array}
if x < -1.80000000000000011e-4 or 5.80000000000000009e-46 < x Initial program 100.0%
Taylor expanded in y around inf 76.0%
Taylor expanded in x around inf 73.2%
if -1.80000000000000011e-4 < x < 5.80000000000000009e-46Initial program 99.8%
Taylor expanded in y around 0 99.4%
Taylor expanded in y around inf 69.5%
Final simplification71.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.1e-50) (not (<= y 6.2e+46))) (* y (+ x 5.0)) (* x (+ t (* 2.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e-50) || !(y <= 6.2e+46)) {
tmp = y * (x + 5.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 <= (-2.1d-50)) .or. (.not. (y <= 6.2d+46))) then
tmp = y * (x + 5.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 <= -2.1e-50) || !(y <= 6.2e+46)) {
tmp = y * (x + 5.0);
} else {
tmp = x * (t + (2.0 * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.1e-50) or not (y <= 6.2e+46): tmp = y * (x + 5.0) else: tmp = x * (t + (2.0 * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.1e-50) || !(y <= 6.2e+46)) tmp = Float64(y * Float64(x + 5.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 <= -2.1e-50) || ~((y <= 6.2e+46))) tmp = y * (x + 5.0); else tmp = x * (t + (2.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.1e-50], N[Not[LessEqual[y, 6.2e+46]], $MachinePrecision]], N[(y * N[(x + 5.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(2.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-50} \lor \neg \left(y \leq 6.2 \cdot 10^{+46}\right):\\
\;\;\;\;y \cdot \left(x + 5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + 2 \cdot z\right)\\
\end{array}
\end{array}
if y < -2.1000000000000001e-50 or 6.1999999999999995e46 < y Initial program 99.9%
Taylor expanded in y around 0 91.3%
Taylor expanded in y around inf 75.8%
if -2.1000000000000001e-50 < y < 6.1999999999999995e46Initial program 100.0%
Taylor expanded in y around 0 75.0%
Final simplification75.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.2e-83) (not (<= y 6.9e+41))) (* 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 <= -3.2e-83) || !(y <= 6.9e+41)) {
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 <= (-3.2d-83)) .or. (.not. (y <= 6.9d+41))) 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 <= -3.2e-83) || !(y <= 6.9e+41)) {
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 <= -3.2e-83) or not (y <= 6.9e+41): 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 <= -3.2e-83) || !(y <= 6.9e+41)) 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 <= -3.2e-83) || ~((y <= 6.9e+41))) 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, -3.2e-83], N[Not[LessEqual[y, 6.9e+41]], $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 -3.2 \cdot 10^{-83} \lor \neg \left(y \leq 6.9 \cdot 10^{+41}\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 < -3.2000000000000001e-83 or 6.9000000000000003e41 < y Initial program 99.9%
Taylor expanded in y around inf 81.4%
Simplified81.4%
if -3.2000000000000001e-83 < y < 6.9000000000000003e41Initial program 100.0%
Taylor expanded in y around 0 78.6%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (+ (* y 5.0) (* x (+ t (+ y (+ z (+ y z)))))))
double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
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) + (x * (t + (y + (z + (y + z)))))
end function
public static double code(double x, double y, double z, double t) {
return (y * 5.0) + (x * (t + (y + (z + (y + z)))));
}
def code(x, y, z, t): return (y * 5.0) + (x * (t + (y + (z + (y + z)))))
function code(x, y, z, t) return Float64(Float64(y * 5.0) + Float64(x * Float64(t + Float64(y + Float64(z + Float64(y + z)))))) end
function tmp = code(x, y, z, t) tmp = (y * 5.0) + (x * (t + (y + (z + (y + z))))); end
code[x_, y_, z_, t_] := N[(N[(y * 5.0), $MachinePrecision] + N[(x * N[(t + N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 5 + x \cdot \left(t + \left(y + \left(z + \left(y + z\right)\right)\right)\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00018) (not (<= x 0.14))) (* x t) (* y 5.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00018) || !(x <= 0.14)) {
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 <= (-0.00018d0)) .or. (.not. (x <= 0.14d0))) 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 <= -0.00018) || !(x <= 0.14)) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00018) or not (x <= 0.14): tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00018) || !(x <= 0.14)) 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 <= -0.00018) || ~((x <= 0.14))) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00018], N[Not[LessEqual[x, 0.14]], $MachinePrecision]], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00018 \lor \neg \left(x \leq 0.14\right):\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if x < -1.80000000000000011e-4 or 0.14000000000000001 < x Initial program 100.0%
Taylor expanded in t around inf 39.8%
Simplified39.8%
if -1.80000000000000011e-4 < x < 0.14000000000000001Initial program 99.9%
Taylor expanded in x around 0 67.0%
Final simplification53.7%
(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 35.7%
Final simplification35.7%
herbie shell --seed 2024027
(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)))