
(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 y 5.0 (* x (fma (+ y z) 2.0 t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma((y + z), 2.0, t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(Float64(y + z), 2.0, t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(N[(y + z), $MachinePrecision] * 2.0 + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(y + z, 2, t\right)\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
fma-def99.6%
distribute-rgt-in94.1%
associate-+l+94.1%
+-commutative94.1%
count-294.1%
distribute-rgt-in99.6%
*-commutative99.6%
fma-def99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (fma x (+ t (* (+ y z) 2.0)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return fma(x, (t + ((y + z) * 2.0)), (y * 5.0));
}
function code(x, y, z, t) return fma(x, Float64(t + Float64(Float64(y + z) * 2.0)), Float64(y * 5.0)) end
code[x_, y_, z_, t_] := N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, t + \left(y + z\right) \cdot 2, y \cdot 5\right)
\end{array}
Initial program 99.5%
fma-def99.6%
associate-+l+99.6%
+-commutative99.6%
count-299.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* z 2.0))))
(if (<= y -5.3e+188)
(* y 5.0)
(if (<= y -2.2e+148)
(* y (* x 2.0))
(if (<= y -7.2e+74)
(* y 5.0)
(if (<= y -4.4e-19)
t_1
(if (<= y -2e-238)
(* x t)
(if (<= y 4.2e-119)
t_1
(if (<= y 3.1e+45) (* x t) (* y 5.0))))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z * 2.0);
double tmp;
if (y <= -5.3e+188) {
tmp = y * 5.0;
} else if (y <= -2.2e+148) {
tmp = y * (x * 2.0);
} else if (y <= -7.2e+74) {
tmp = y * 5.0;
} else if (y <= -4.4e-19) {
tmp = t_1;
} else if (y <= -2e-238) {
tmp = x * t;
} else if (y <= 4.2e-119) {
tmp = t_1;
} else if (y <= 3.1e+45) {
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) :: t_1
real(8) :: tmp
t_1 = x * (z * 2.0d0)
if (y <= (-5.3d+188)) then
tmp = y * 5.0d0
else if (y <= (-2.2d+148)) then
tmp = y * (x * 2.0d0)
else if (y <= (-7.2d+74)) then
tmp = y * 5.0d0
else if (y <= (-4.4d-19)) then
tmp = t_1
else if (y <= (-2d-238)) then
tmp = x * t
else if (y <= 4.2d-119) then
tmp = t_1
else if (y <= 3.1d+45) 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 t_1 = x * (z * 2.0);
double tmp;
if (y <= -5.3e+188) {
tmp = y * 5.0;
} else if (y <= -2.2e+148) {
tmp = y * (x * 2.0);
} else if (y <= -7.2e+74) {
tmp = y * 5.0;
} else if (y <= -4.4e-19) {
tmp = t_1;
} else if (y <= -2e-238) {
tmp = x * t;
} else if (y <= 4.2e-119) {
tmp = t_1;
} else if (y <= 3.1e+45) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z * 2.0) tmp = 0 if y <= -5.3e+188: tmp = y * 5.0 elif y <= -2.2e+148: tmp = y * (x * 2.0) elif y <= -7.2e+74: tmp = y * 5.0 elif y <= -4.4e-19: tmp = t_1 elif y <= -2e-238: tmp = x * t elif y <= 4.2e-119: tmp = t_1 elif y <= 3.1e+45: tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z * 2.0)) tmp = 0.0 if (y <= -5.3e+188) tmp = Float64(y * 5.0); elseif (y <= -2.2e+148) tmp = Float64(y * Float64(x * 2.0)); elseif (y <= -7.2e+74) tmp = Float64(y * 5.0); elseif (y <= -4.4e-19) tmp = t_1; elseif (y <= -2e-238) tmp = Float64(x * t); elseif (y <= 4.2e-119) tmp = t_1; elseif (y <= 3.1e+45) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z * 2.0); tmp = 0.0; if (y <= -5.3e+188) tmp = y * 5.0; elseif (y <= -2.2e+148) tmp = y * (x * 2.0); elseif (y <= -7.2e+74) tmp = y * 5.0; elseif (y <= -4.4e-19) tmp = t_1; elseif (y <= -2e-238) tmp = x * t; elseif (y <= 4.2e-119) tmp = t_1; elseif (y <= 3.1e+45) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.3e+188], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -2.2e+148], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -7.2e+74], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -4.4e-19], t$95$1, If[LessEqual[y, -2e-238], N[(x * t), $MachinePrecision], If[LessEqual[y, 4.2e-119], t$95$1, If[LessEqual[y, 3.1e+45], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z \cdot 2\right)\\
\mathbf{if}\;y \leq -5.3 \cdot 10^{+188}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;y \leq -7.2 \cdot 10^{+74}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -4.4 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{-238}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-119}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -5.29999999999999988e188 or -2.1999999999999999e148 < y < -7.19999999999999975e74 or 3.09999999999999988e45 < y Initial program 98.9%
Taylor expanded in x around 0 53.0%
Simplified53.0%
if -5.29999999999999988e188 < y < -2.1999999999999999e148Initial program 99.9%
Taylor expanded in y around 0 79.9%
Taylor expanded in x around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-*r*60.1%
Simplified60.1%
Taylor expanded in y around inf 66.8%
associate-*r*66.8%
Simplified66.8%
if -7.19999999999999975e74 < y < -4.3999999999999997e-19 or -2e-238 < y < 4.2e-119Initial program 100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in z around inf 62.1%
associate-*r*62.1%
*-commutative62.1%
associate-*r*62.1%
Simplified62.1%
if -4.3999999999999997e-19 < y < -2e-238 or 4.2e-119 < y < 3.09999999999999988e45Initial program 99.9%
Taylor expanded in y around 0 100.0%
Taylor expanded in t around inf 52.9%
*-commutative52.9%
Simplified52.9%
Final simplification56.1%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.8e+187)
(* y 5.0)
(if (<= y -7e+148)
(* y (* x 2.0))
(if (<= y -8.3e+93)
(* y 5.0)
(if (<= y 7e+63)
(* x (+ t (* z 2.0)))
(if (<= y 1.36e+119) (* x (+ t (* y 2.0))) (* y 5.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.8e+187) {
tmp = y * 5.0;
} else if (y <= -7e+148) {
tmp = y * (x * 2.0);
} else if (y <= -8.3e+93) {
tmp = y * 5.0;
} else if (y <= 7e+63) {
tmp = x * (t + (z * 2.0));
} else if (y <= 1.36e+119) {
tmp = x * (t + (y * 2.0));
} 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 (y <= (-2.8d+187)) then
tmp = y * 5.0d0
else if (y <= (-7d+148)) then
tmp = y * (x * 2.0d0)
else if (y <= (-8.3d+93)) then
tmp = y * 5.0d0
else if (y <= 7d+63) then
tmp = x * (t + (z * 2.0d0))
else if (y <= 1.36d+119) then
tmp = x * (t + (y * 2.0d0))
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 (y <= -2.8e+187) {
tmp = y * 5.0;
} else if (y <= -7e+148) {
tmp = y * (x * 2.0);
} else if (y <= -8.3e+93) {
tmp = y * 5.0;
} else if (y <= 7e+63) {
tmp = x * (t + (z * 2.0));
} else if (y <= 1.36e+119) {
tmp = x * (t + (y * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.8e+187: tmp = y * 5.0 elif y <= -7e+148: tmp = y * (x * 2.0) elif y <= -8.3e+93: tmp = y * 5.0 elif y <= 7e+63: tmp = x * (t + (z * 2.0)) elif y <= 1.36e+119: tmp = x * (t + (y * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.8e+187) tmp = Float64(y * 5.0); elseif (y <= -7e+148) tmp = Float64(y * Float64(x * 2.0)); elseif (y <= -8.3e+93) tmp = Float64(y * 5.0); elseif (y <= 7e+63) tmp = Float64(x * Float64(t + Float64(z * 2.0))); elseif (y <= 1.36e+119) tmp = Float64(x * Float64(t + Float64(y * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.8e+187) tmp = y * 5.0; elseif (y <= -7e+148) tmp = y * (x * 2.0); elseif (y <= -8.3e+93) tmp = y * 5.0; elseif (y <= 7e+63) tmp = x * (t + (z * 2.0)); elseif (y <= 1.36e+119) tmp = x * (t + (y * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.8e+187], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -7e+148], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.3e+93], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 7e+63], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.36e+119], N[(x * N[(t + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{+187}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;y \leq -8.3 \cdot 10^{+93}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{+119}:\\
\;\;\;\;x \cdot \left(t + y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -2.79999999999999989e187 or -6.9999999999999998e148 < y < -8.2999999999999997e93 or 1.35999999999999995e119 < y Initial program 98.6%
Taylor expanded in x around 0 60.3%
Simplified60.3%
if -2.79999999999999989e187 < y < -6.9999999999999998e148Initial program 99.9%
Taylor expanded in y around 0 79.9%
Taylor expanded in x around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-*r*60.1%
Simplified60.1%
Taylor expanded in y around inf 66.8%
associate-*r*66.8%
Simplified66.8%
if -8.2999999999999997e93 < y < 7.00000000000000059e63Initial program 99.9%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around 0 79.4%
if 7.00000000000000059e63 < y < 1.35999999999999995e119Initial program 99.9%
Taylor expanded in y around 0 99.9%
Taylor expanded in x around inf 76.3%
*-commutative76.3%
*-commutative76.3%
associate-*r*76.3%
Simplified76.3%
Taylor expanded in z around 0 66.2%
+-commutative66.2%
*-commutative66.2%
associate-*r*66.2%
*-commutative66.2%
associate-*r*66.2%
distribute-lft-out66.2%
*-commutative66.2%
Simplified66.2%
Final simplification72.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1e+148) (* x (+ t (* (+ y z) 2.0))) (+ (* x (+ t (* z 2.0))) (* y (+ 5.0 (* x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1e+148) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z * 2.0))) + (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 <= (-1d+148)) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (x * (t + (z * 2.0d0))) + (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 <= -1e+148) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1e+148: tmp = x * (t + ((y + z) * 2.0)) else: tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1e+148) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(x * Float64(t + Float64(z * 2.0))) + 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 <= -1e+148) tmp = x * (t + ((y + z) * 2.0)); else tmp = (x * (t + (z * 2.0))) + (y * (5.0 + (x * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1e+148], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+148}:\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right) + y \cdot \left(5 + x \cdot 2\right)\\
\end{array}
\end{array}
if x < -1e148Initial program 99.9%
fma-def99.9%
associate-+l+99.9%
+-commutative99.9%
count-299.9%
Simplified99.9%
Taylor expanded in x around inf 99.9%
if -1e148 < x Initial program 99.5%
Taylor expanded in y around 0 97.8%
Final simplification98.0%
(FPCore (x y z t)
:precision binary64
(if (<= y -2.75e+187)
(* y 5.0)
(if (<= y -7e+148)
(* y (* x 2.0))
(if (<= y -2.15e+96)
(* y 5.0)
(if (<= y 8e+106) (* x (+ t (* z 2.0))) (* y 5.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.75e+187) {
tmp = y * 5.0;
} else if (y <= -7e+148) {
tmp = y * (x * 2.0);
} else if (y <= -2.15e+96) {
tmp = y * 5.0;
} else if (y <= 8e+106) {
tmp = x * (t + (z * 2.0));
} 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 (y <= (-2.75d+187)) then
tmp = y * 5.0d0
else if (y <= (-7d+148)) then
tmp = y * (x * 2.0d0)
else if (y <= (-2.15d+96)) then
tmp = y * 5.0d0
else if (y <= 8d+106) then
tmp = x * (t + (z * 2.0d0))
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 (y <= -2.75e+187) {
tmp = y * 5.0;
} else if (y <= -7e+148) {
tmp = y * (x * 2.0);
} else if (y <= -2.15e+96) {
tmp = y * 5.0;
} else if (y <= 8e+106) {
tmp = x * (t + (z * 2.0));
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.75e+187: tmp = y * 5.0 elif y <= -7e+148: tmp = y * (x * 2.0) elif y <= -2.15e+96: tmp = y * 5.0 elif y <= 8e+106: tmp = x * (t + (z * 2.0)) else: tmp = y * 5.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.75e+187) tmp = Float64(y * 5.0); elseif (y <= -7e+148) tmp = Float64(y * Float64(x * 2.0)); elseif (y <= -2.15e+96) tmp = Float64(y * 5.0); elseif (y <= 8e+106) tmp = Float64(x * Float64(t + Float64(z * 2.0))); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.75e+187) tmp = y * 5.0; elseif (y <= -7e+148) tmp = y * (x * 2.0); elseif (y <= -2.15e+96) tmp = y * 5.0; elseif (y <= 8e+106) tmp = x * (t + (z * 2.0)); else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.75e+187], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -7e+148], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.15e+96], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, 8e+106], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{+187}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -7 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{elif}\;y \leq -2.15 \cdot 10^{+96}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+106}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -2.74999999999999999e187 or -6.9999999999999998e148 < y < -2.15000000000000001e96 or 8.00000000000000073e106 < y Initial program 98.7%
Taylor expanded in x around 0 58.0%
Simplified58.0%
if -2.74999999999999999e187 < y < -6.9999999999999998e148Initial program 99.9%
Taylor expanded in y around 0 79.9%
Taylor expanded in x around inf 60.1%
*-commutative60.1%
*-commutative60.1%
associate-*r*60.1%
Simplified60.1%
Taylor expanded in y around inf 66.8%
associate-*r*66.8%
Simplified66.8%
if -2.15000000000000001e96 < y < 8.00000000000000073e106Initial program 99.9%
Taylor expanded in y around 0 99.3%
Taylor expanded in y around 0 76.6%
Final simplification70.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.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* z 2.0))))
(if (<= y -7e+74)
(* y 5.0)
(if (<= y -3.6e-21)
t_1
(if (<= y -1.35e-244)
(* x t)
(if (<= y 1.45e-113) t_1 (if (<= y 4.2e+45) (* x t) (* y 5.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z * 2.0);
double tmp;
if (y <= -7e+74) {
tmp = y * 5.0;
} else if (y <= -3.6e-21) {
tmp = t_1;
} else if (y <= -1.35e-244) {
tmp = x * t;
} else if (y <= 1.45e-113) {
tmp = t_1;
} else if (y <= 4.2e+45) {
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) :: t_1
real(8) :: tmp
t_1 = x * (z * 2.0d0)
if (y <= (-7d+74)) then
tmp = y * 5.0d0
else if (y <= (-3.6d-21)) then
tmp = t_1
else if (y <= (-1.35d-244)) then
tmp = x * t
else if (y <= 1.45d-113) then
tmp = t_1
else if (y <= 4.2d+45) 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 t_1 = x * (z * 2.0);
double tmp;
if (y <= -7e+74) {
tmp = y * 5.0;
} else if (y <= -3.6e-21) {
tmp = t_1;
} else if (y <= -1.35e-244) {
tmp = x * t;
} else if (y <= 1.45e-113) {
tmp = t_1;
} else if (y <= 4.2e+45) {
tmp = x * t;
} else {
tmp = y * 5.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z * 2.0) tmp = 0 if y <= -7e+74: tmp = y * 5.0 elif y <= -3.6e-21: tmp = t_1 elif y <= -1.35e-244: tmp = x * t elif y <= 1.45e-113: tmp = t_1 elif y <= 4.2e+45: tmp = x * t else: tmp = y * 5.0 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z * 2.0)) tmp = 0.0 if (y <= -7e+74) tmp = Float64(y * 5.0); elseif (y <= -3.6e-21) tmp = t_1; elseif (y <= -1.35e-244) tmp = Float64(x * t); elseif (y <= 1.45e-113) tmp = t_1; elseif (y <= 4.2e+45) tmp = Float64(x * t); else tmp = Float64(y * 5.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z * 2.0); tmp = 0.0; if (y <= -7e+74) tmp = y * 5.0; elseif (y <= -3.6e-21) tmp = t_1; elseif (y <= -1.35e-244) tmp = x * t; elseif (y <= 1.45e-113) tmp = t_1; elseif (y <= 4.2e+45) tmp = x * t; else tmp = y * 5.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e+74], N[(y * 5.0), $MachinePrecision], If[LessEqual[y, -3.6e-21], t$95$1, If[LessEqual[y, -1.35e-244], N[(x * t), $MachinePrecision], If[LessEqual[y, 1.45e-113], t$95$1, If[LessEqual[y, 4.2e+45], N[(x * t), $MachinePrecision], N[(y * 5.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z \cdot 2\right)\\
\mathbf{if}\;y \leq -7 \cdot 10^{+74}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-21}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -1.35 \cdot 10^{-244}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{+45}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5\\
\end{array}
\end{array}
if y < -7.00000000000000029e74 or 4.1999999999999999e45 < y Initial program 99.0%
Taylor expanded in x around 0 49.0%
Simplified49.0%
if -7.00000000000000029e74 < y < -3.59999999999999989e-21 or -1.35e-244 < y < 1.45000000000000002e-113Initial program 100.0%
Taylor expanded in y around 0 98.4%
Taylor expanded in z around inf 62.1%
associate-*r*62.1%
*-commutative62.1%
associate-*r*62.1%
Simplified62.1%
if -3.59999999999999989e-21 < y < -1.35e-244 or 1.45000000000000002e-113 < y < 4.1999999999999999e45Initial program 99.9%
Taylor expanded in y around 0 100.0%
Taylor expanded in t around inf 52.9%
*-commutative52.9%
Simplified52.9%
Final simplification53.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.4e-16) (not (<= x 1.18e-26))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.4e-16) || !(x <= 1.18e-26)) {
tmp = x * (t + ((y + z) * 2.0));
} 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.4d-16)) .or. (.not. (x <= 1.18d-26))) then
tmp = x * (t + ((y + z) * 2.0d0))
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.4e-16) || !(x <= 1.18e-26)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (x * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.4e-16) or not (x <= 1.18e-26): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (x * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.4e-16) || !(x <= 1.18e-26)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); 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.4e-16) || ~((x <= 1.18e-26))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (x * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.4e-16], N[Not[LessEqual[x, 1.18e-26]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-16} \lor \neg \left(x \leq 1.18 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\end{array}
\end{array}
if x < -3.4e-16 or 1.17999999999999996e-26 < 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 98.1%
if -3.4e-16 < x < 1.17999999999999996e-26Initial program 99.1%
Taylor expanded in t around inf 79.2%
Final simplification88.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.3e-21) (not (<= x 4.1e-26))) (* x (+ t (* (+ y z) 2.0))) (+ (* y 5.0) (* 2.0 (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.3e-21) || !(x <= 4.1e-26)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (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 <= (-3.3d-21)) .or. (.not. (x <= 4.1d-26))) then
tmp = x * (t + ((y + z) * 2.0d0))
else
tmp = (y * 5.0d0) + (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 <= -3.3e-21) || !(x <= 4.1e-26)) {
tmp = x * (t + ((y + z) * 2.0));
} else {
tmp = (y * 5.0) + (2.0 * (x * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.3e-21) or not (x <= 4.1e-26): tmp = x * (t + ((y + z) * 2.0)) else: tmp = (y * 5.0) + (2.0 * (x * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.3e-21) || !(x <= 4.1e-26)) tmp = Float64(x * Float64(t + Float64(Float64(y + z) * 2.0))); else tmp = Float64(Float64(y * 5.0) + Float64(2.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.3e-21) || ~((x <= 4.1e-26))) tmp = x * (t + ((y + z) * 2.0)); else tmp = (y * 5.0) + (2.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.3e-21], N[Not[LessEqual[x, 4.1e-26]], $MachinePrecision]], N[(x * N[(t + N[(N[(y + z), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 5.0), $MachinePrecision] + N[(2.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-21} \lor \neg \left(x \leq 4.1 \cdot 10^{-26}\right):\\
\;\;\;\;x \cdot \left(t + \left(y + z\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 5 + 2 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -3.30000000000000009e-21 or 4.0999999999999999e-26 < 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 98.1%
if -3.30000000000000009e-21 < x < 4.0999999999999999e-26Initial program 99.1%
Taylor expanded in z around inf 81.2%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.1e+28) (not (<= y 5e+51))) (* y (+ 5.0 (* x 2.0))) (* x (+ t (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e+28) || !(y <= 5e+51)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 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 ((y <= (-2.1d+28)) .or. (.not. (y <= 5d+51))) then
tmp = y * (5.0d0 + (x * 2.0d0))
else
tmp = x * (t + (z * 2.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.1e+28) || !(y <= 5e+51)) {
tmp = y * (5.0 + (x * 2.0));
} else {
tmp = x * (t + (z * 2.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.1e+28) or not (y <= 5e+51): tmp = y * (5.0 + (x * 2.0)) else: tmp = x * (t + (z * 2.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.1e+28) || !(y <= 5e+51)) tmp = Float64(y * Float64(5.0 + Float64(x * 2.0))); else tmp = Float64(x * Float64(t + Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.1e+28) || ~((y <= 5e+51))) tmp = y * (5.0 + (x * 2.0)); else tmp = x * (t + (z * 2.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.1e+28], N[Not[LessEqual[y, 5e+51]], $MachinePrecision]], N[(y * N[(5.0 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t + N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{+28} \lor \neg \left(y \leq 5 \cdot 10^{+51}\right):\\
\;\;\;\;y \cdot \left(5 + x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t + z \cdot 2\right)\\
\end{array}
\end{array}
if y < -2.09999999999999989e28 or 5e51 < y Initial program 99.1%
Taylor expanded in y around inf 82.1%
Simplified82.1%
if -2.09999999999999989e28 < y < 5e51Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in y around 0 84.2%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (if (<= x -9.5e-21) (* x t) (if (<= x 9.5e-23) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e-21) {
tmp = x * t;
} else if (x <= 9.5e-23) {
tmp = y * 5.0;
} 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) :: tmp
if (x <= (-9.5d-21)) then
tmp = x * t
else if (x <= 9.5d-23) then
tmp = y * 5.0d0
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9.5e-21) {
tmp = x * t;
} else if (x <= 9.5e-23) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -9.5e-21: tmp = x * t elif x <= 9.5e-23: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -9.5e-21) tmp = Float64(x * t); elseif (x <= 9.5e-23) tmp = Float64(y * 5.0); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -9.5e-21) tmp = x * t; elseif (x <= 9.5e-23) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -9.5e-21], N[(x * t), $MachinePrecision], If[LessEqual[x, 9.5e-23], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-21}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-23}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -9.4999999999999994e-21 or 9.50000000000000058e-23 < x Initial program 100.0%
Taylor expanded in y around 0 91.6%
Taylor expanded in t around inf 34.4%
*-commutative34.4%
Simplified34.4%
if -9.4999999999999994e-21 < x < 9.50000000000000058e-23Initial program 99.1%
Taylor expanded in x around 0 60.2%
Simplified60.2%
Final simplification46.9%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return 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 * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.5%
Taylor expanded in y around 0 95.3%
Taylor expanded in t around inf 27.4%
*-commutative27.4%
Simplified27.4%
Final simplification27.4%
herbie shell --seed 2023290
(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)))