
(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 12 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 (* (fma 2.0 (+ z y) t) x)))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (fma(2.0, (z + y), t) * x));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(fma(2.0, Float64(z + y), t) * x)) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z + y, t\right) \cdot x\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -2.9e-26)
t_1
(if (<= x -1e-254)
(fma 5.0 y (* t x))
(if (<= x 7e-73) (fma y 5.0 (* (* 2.0 z) x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (z + y), t) * x;
double tmp;
if (x <= -2.9e-26) {
tmp = t_1;
} else if (x <= -1e-254) {
tmp = fma(5.0, y, (t * x));
} else if (x <= 7e-73) {
tmp = fma(y, 5.0, ((2.0 * z) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(z + y), t) * x) tmp = 0.0 if (x <= -2.9e-26) tmp = t_1; elseif (x <= -1e-254) tmp = fma(5.0, y, Float64(t * x)); elseif (x <= 7e-73) tmp = fma(y, 5.0, Float64(Float64(2.0 * z) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.9e-26], t$95$1, If[LessEqual[x, -1e-254], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-73], N[(y * 5.0 + N[(N[(2.0 * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{if}\;x \leq -2.9 \cdot 10^{-26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-254}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-73}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \left(2 \cdot z\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.8999999999999998e-26 or 6.9999999999999995e-73 < x Initial program 100.0%
Taylor expanded in x around 0
lower-*.f643.5
Applied rewrites3.5%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
if -2.8999999999999998e-26 < x < -9.9999999999999991e-255Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites99.8%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6482.2
Applied rewrites82.2%
Taylor expanded in x around 0
Applied rewrites82.2%
if -9.9999999999999991e-255 < x < 6.9999999999999995e-73Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f6492.3
Applied rewrites92.3%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.3e+34) (not (<= x 2.5))) (* (fma 2.0 (+ z y) t) x) (fma y 5.0 (* (fma 2.0 z t) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e+34) || !(x <= 2.5)) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.3e+34) || !(x <= 2.5)) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = fma(y, 5.0, Float64(fma(2.0, z, t) * x)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.3e+34], N[Not[LessEqual[x, 2.5]], $MachinePrecision]], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+34} \lor \neg \left(x \leq 2.5\right):\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\end{array}
\end{array}
if x < -2.2999999999999998e34 or 2.5 < x Initial program 100.0%
Taylor expanded in x around 0
lower-*.f642.6
Applied rewrites2.6%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.2
Applied rewrites99.2%
if -2.2999999999999998e34 < x < 2.5Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6499.4
Applied rewrites99.4%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.4e+90) (not (<= z 14.2))) (fma (+ x x) (+ z y) (* 5.0 y)) (fma (fma 2.0 y t) x (* 5.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.4e+90) || !(z <= 14.2)) {
tmp = fma((x + x), (z + y), (5.0 * y));
} else {
tmp = fma(fma(2.0, y, t), x, (5.0 * y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.4e+90) || !(z <= 14.2)) tmp = fma(Float64(x + x), Float64(z + y), Float64(5.0 * y)); else tmp = fma(fma(2.0, y, t), x, Float64(5.0 * y)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.4e+90], N[Not[LessEqual[z, 14.2]], $MachinePrecision]], N[(N[(x + x), $MachinePrecision] * N[(z + y), $MachinePrecision] + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{+90} \lor \neg \left(z \leq 14.2\right):\\
\;\;\;\;\mathsf{fma}\left(x + x, z + y, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\end{array}
\end{array}
if z < -3.40000000000000018e90 or 14.199999999999999 < z Initial program 99.9%
Taylor expanded in t around 0
+-commutativeN/A
distribute-lft-outN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6489.9
Applied rewrites89.9%
Applied rewrites89.9%
if -3.40000000000000018e90 < z < 14.199999999999999Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
Final simplification92.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 x 5.0) y)))
(if (<= y -8.5e+127)
t_1
(if (<= y -1.12e-38)
(fma 5.0 y (* t x))
(if (<= y 2.3e-33) (* (fma 2.0 z t) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, x, 5.0) * y;
double tmp;
if (y <= -8.5e+127) {
tmp = t_1;
} else if (y <= -1.12e-38) {
tmp = fma(5.0, y, (t * x));
} else if (y <= 2.3e-33) {
tmp = fma(2.0, z, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, x, 5.0) * y) tmp = 0.0 if (y <= -8.5e+127) tmp = t_1; elseif (y <= -1.12e-38) tmp = fma(5.0, y, Float64(t * x)); elseif (y <= 2.3e-33) tmp = Float64(fma(2.0, z, t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -8.5e+127], t$95$1, If[LessEqual[y, -1.12e-38], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.3e-33], N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{if}\;y \leq -8.5 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(2, z, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.4999999999999997e127 or 2.29999999999999986e-33 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6487.1
Applied rewrites87.1%
if -8.4999999999999997e127 < y < -1.1200000000000001e-38Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites97.1%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.9
Applied rewrites85.9%
Taylor expanded in x around 0
Applied rewrites77.8%
if -1.1200000000000001e-38 < y < 2.29999999999999986e-33Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6485.7
Applied rewrites85.7%
Final simplification85.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 x 5.0) y)))
(if (<= y -1.95e-57)
t_1
(if (<= y -2.1e-261) (* (* z x) 2.0) (if (<= y 4.2e-34) (* t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, x, 5.0) * y;
double tmp;
if (y <= -1.95e-57) {
tmp = t_1;
} else if (y <= -2.1e-261) {
tmp = (z * x) * 2.0;
} else if (y <= 4.2e-34) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, x, 5.0) * y) tmp = 0.0 if (y <= -1.95e-57) tmp = t_1; elseif (y <= -2.1e-261) tmp = Float64(Float64(z * x) * 2.0); elseif (y <= 4.2e-34) tmp = Float64(t * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -1.95e-57], t$95$1, If[LessEqual[y, -2.1e-261], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[y, 4.2e-34], N[(t * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{if}\;y \leq -1.95 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-261}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-34}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.95000000000000003e-57 or 4.2000000000000002e-34 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6478.7
Applied rewrites78.7%
if -1.95000000000000003e-57 < y < -2.09999999999999996e-261Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -2.09999999999999996e-261 < y < 4.2000000000000002e-34Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6453.3
Applied rewrites53.3%
Final simplification67.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -1.1e+33)
(* (* x y) 2.0)
(if (<= x -6.2e-22)
(* t x)
(if (<= x 1.06e-80) (* 5.0 y) (* (* z x) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e+33) {
tmp = (x * y) * 2.0;
} else if (x <= -6.2e-22) {
tmp = t * x;
} else if (x <= 1.06e-80) {
tmp = 5.0 * y;
} else {
tmp = (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 (x <= (-1.1d+33)) then
tmp = (x * y) * 2.0d0
else if (x <= (-6.2d-22)) then
tmp = t * x
else if (x <= 1.06d-80) then
tmp = 5.0d0 * y
else
tmp = (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 (x <= -1.1e+33) {
tmp = (x * y) * 2.0;
} else if (x <= -6.2e-22) {
tmp = t * x;
} else if (x <= 1.06e-80) {
tmp = 5.0 * y;
} else {
tmp = (z * x) * 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.1e+33: tmp = (x * y) * 2.0 elif x <= -6.2e-22: tmp = t * x elif x <= 1.06e-80: tmp = 5.0 * y else: tmp = (z * x) * 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.1e+33) tmp = Float64(Float64(x * y) * 2.0); elseif (x <= -6.2e-22) tmp = Float64(t * x); elseif (x <= 1.06e-80) tmp = Float64(5.0 * y); else tmp = Float64(Float64(z * x) * 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.1e+33) tmp = (x * y) * 2.0; elseif (x <= -6.2e-22) tmp = t * x; elseif (x <= 1.06e-80) tmp = 5.0 * y; else tmp = (z * x) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.1e+33], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[x, -6.2e-22], N[(t * x), $MachinePrecision], If[LessEqual[x, 1.06e-80], N[(5.0 * y), $MachinePrecision], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+33}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-22}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-80}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\end{array}
\end{array}
if x < -1.09999999999999997e33Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
distribute-lft-outN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6469.9
Applied rewrites69.9%
Taylor expanded in x around inf
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites49.5%
if -1.09999999999999997e33 < x < -6.20000000000000025e-22Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6464.4
Applied rewrites64.4%
if -6.20000000000000025e-22 < x < 1.0600000000000001e-80Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6465.8
Applied rewrites65.8%
if 1.0600000000000001e-80 < x Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.9e-26) (not (<= x 1.06e-80))) (* (fma 2.0 (+ z y) t) x) (fma 5.0 y (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.9e-26) || !(x <= 1.06e-80)) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = fma(5.0, y, (t * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.9e-26) || !(x <= 1.06e-80)) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = fma(5.0, y, Float64(t * x)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.9e-26], N[Not[LessEqual[x, 1.06e-80]], $MachinePrecision]], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-26} \lor \neg \left(x \leq 1.06 \cdot 10^{-80}\right):\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\end{array}
\end{array}
if x < -2.8999999999999998e-26 or 1.0600000000000001e-80 < x Initial program 100.0%
Taylor expanded in x around 0
lower-*.f644.2
Applied rewrites4.2%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6497.3
Applied rewrites97.3%
if -2.8999999999999998e-26 < x < 1.0600000000000001e-80Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lower-fma.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-fma.f64N/A
count-2-revN/A
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
associate-+l+N/A
*-commutativeN/A
distribute-rgt-inN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
count-2-revN/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
*-commutativeN/A
Applied rewrites99.9%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6481.6
Applied rewrites81.6%
Taylor expanded in x around 0
Applied rewrites81.6%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.1e+33) (* (* x y) 2.0) (if (or (<= x -6.2e-22) (not (<= x 7e-73))) (* t x) (* 5.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e+33) {
tmp = (x * y) * 2.0;
} else if ((x <= -6.2e-22) || !(x <= 7e-73)) {
tmp = t * x;
} else {
tmp = 5.0 * 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.1d+33)) then
tmp = (x * y) * 2.0d0
else if ((x <= (-6.2d-22)) .or. (.not. (x <= 7d-73))) then
tmp = t * x
else
tmp = 5.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.1e+33) {
tmp = (x * y) * 2.0;
} else if ((x <= -6.2e-22) || !(x <= 7e-73)) {
tmp = t * x;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.1e+33: tmp = (x * y) * 2.0 elif (x <= -6.2e-22) or not (x <= 7e-73): tmp = t * x else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.1e+33) tmp = Float64(Float64(x * y) * 2.0); elseif ((x <= -6.2e-22) || !(x <= 7e-73)) tmp = Float64(t * x); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.1e+33) tmp = (x * y) * 2.0; elseif ((x <= -6.2e-22) || ~((x <= 7e-73))) tmp = t * x; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.1e+33], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], If[Or[LessEqual[x, -6.2e-22], N[Not[LessEqual[x, 7e-73]], $MachinePrecision]], N[(t * x), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{+33}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{elif}\;x \leq -6.2 \cdot 10^{-22} \lor \neg \left(x \leq 7 \cdot 10^{-73}\right):\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if x < -1.09999999999999997e33Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
distribute-lft-outN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6469.9
Applied rewrites69.9%
Taylor expanded in x around inf
Applied rewrites69.9%
Taylor expanded in y around inf
Applied rewrites49.5%
if -1.09999999999999997e33 < x < -6.20000000000000025e-22 or 6.9999999999999995e-73 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6438.4
Applied rewrites38.4%
if -6.20000000000000025e-22 < x < 6.9999999999999995e-73Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6465.5
Applied rewrites65.5%
Final simplification53.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -57.0) (not (<= y 2.3e-33))) (* (fma 2.0 x 5.0) y) (* (fma 2.0 z t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -57.0) || !(y <= 2.3e-33)) {
tmp = fma(2.0, x, 5.0) * y;
} else {
tmp = fma(2.0, z, t) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -57.0) || !(y <= 2.3e-33)) tmp = Float64(fma(2.0, x, 5.0) * y); else tmp = Float64(fma(2.0, z, t) * x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -57.0], N[Not[LessEqual[y, 2.3e-33]], $MachinePrecision]], N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -57 \lor \neg \left(y \leq 2.3 \cdot 10^{-33}\right):\\
\;\;\;\;\mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, z, t\right) \cdot x\\
\end{array}
\end{array}
if y < -57 or 2.29999999999999986e-33 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6483.6
Applied rewrites83.6%
if -57 < y < 2.29999999999999986e-33Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6483.6
Applied rewrites83.6%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -6.2e-22) (not (<= x 7e-73))) (* t x) (* 5.0 y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e-22) || !(x <= 7e-73)) {
tmp = t * x;
} else {
tmp = 5.0 * 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 <= (-6.2d-22)) .or. (.not. (x <= 7d-73))) then
tmp = t * x
else
tmp = 5.0d0 * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -6.2e-22) || !(x <= 7e-73)) {
tmp = t * x;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -6.2e-22) or not (x <= 7e-73): tmp = t * x else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -6.2e-22) || !(x <= 7e-73)) tmp = Float64(t * x); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -6.2e-22) || ~((x <= 7e-73))) tmp = t * x; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -6.2e-22], N[Not[LessEqual[x, 7e-73]], $MachinePrecision]], N[(t * x), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{-22} \lor \neg \left(x \leq 7 \cdot 10^{-73}\right):\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if x < -6.20000000000000025e-22 or 6.9999999999999995e-73 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6437.4
Applied rewrites37.4%
if -6.20000000000000025e-22 < x < 6.9999999999999995e-73Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6465.5
Applied rewrites65.5%
Final simplification50.7%
(FPCore (x y z t) :precision binary64 (* 5.0 y))
double code(double x, double y, double z, double t) {
return 5.0 * y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 5.0d0 * y
end function
public static double code(double x, double y, double z, double t) {
return 5.0 * y;
}
def code(x, y, z, t): return 5.0 * y
function code(x, y, z, t) return Float64(5.0 * y) end
function tmp = code(x, y, z, t) tmp = 5.0 * y; end
code[x_, y_, z_, t_] := N[(5.0 * y), $MachinePrecision]
\begin{array}{l}
\\
5 \cdot y
\end{array}
Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6432.8
Applied rewrites32.8%
Final simplification32.8%
herbie shell --seed 2024338
(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)))