
(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 11 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 (+ (* x (+ (+ y (+ z (+ y z))) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((y + (z + (y + z))) + 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 + (y + z))) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((y + (z + (y + z))) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((y + (z + (y + z))) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(y + Float64(z + Float64(y + z))) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((y + (z + (y + z))) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(y + N[(z + N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(y + \left(z + \left(y + z\right)\right)\right) + t\right) + y \cdot 5
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ y y))))
(if (<= x -1.35e+83)
t_1
(if (<= x -2.2e-30)
(* x t)
(if (<= x 2.65e-145)
(* y 5.0)
(if (<= x 3.7e+144) (* x t) (if (<= x 7.2e+227) t_1 (* x t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y + y);
double tmp;
if (x <= -1.35e+83) {
tmp = t_1;
} else if (x <= -2.2e-30) {
tmp = x * t;
} else if (x <= 2.65e-145) {
tmp = y * 5.0;
} else if (x <= 3.7e+144) {
tmp = x * t;
} else if (x <= 7.2e+227) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y + y)
if (x <= (-1.35d+83)) then
tmp = t_1
else if (x <= (-2.2d-30)) then
tmp = x * t
else if (x <= 2.65d-145) then
tmp = y * 5.0d0
else if (x <= 3.7d+144) then
tmp = x * t
else if (x <= 7.2d+227) then
tmp = t_1
else
tmp = x * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y + y);
double tmp;
if (x <= -1.35e+83) {
tmp = t_1;
} else if (x <= -2.2e-30) {
tmp = x * t;
} else if (x <= 2.65e-145) {
tmp = y * 5.0;
} else if (x <= 3.7e+144) {
tmp = x * t;
} else if (x <= 7.2e+227) {
tmp = t_1;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y + y) tmp = 0 if x <= -1.35e+83: tmp = t_1 elif x <= -2.2e-30: tmp = x * t elif x <= 2.65e-145: tmp = y * 5.0 elif x <= 3.7e+144: tmp = x * t elif x <= 7.2e+227: tmp = t_1 else: tmp = x * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y + y)) tmp = 0.0 if (x <= -1.35e+83) tmp = t_1; elseif (x <= -2.2e-30) tmp = Float64(x * t); elseif (x <= 2.65e-145) tmp = Float64(y * 5.0); elseif (x <= 3.7e+144) tmp = Float64(x * t); elseif (x <= 7.2e+227) tmp = t_1; else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y + y); tmp = 0.0; if (x <= -1.35e+83) tmp = t_1; elseif (x <= -2.2e-30) tmp = x * t; elseif (x <= 2.65e-145) tmp = y * 5.0; elseif (x <= 3.7e+144) tmp = x * t; elseif (x <= 7.2e+227) tmp = t_1; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+83], t$95$1, If[LessEqual[x, -2.2e-30], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.65e-145], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 3.7e+144], N[(x * t), $MachinePrecision], If[LessEqual[x, 7.2e+227], t$95$1, N[(x * t), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y + y\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-30}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-145}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+144}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 7.2 \cdot 10^{+227}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.35000000000000003e83 or 3.6999999999999997e144 < x < 7.19999999999999983e227Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites55.2%
if -1.35000000000000003e83 < x < -2.19999999999999983e-30 or 2.65e-145 < x < 3.6999999999999997e144 or 7.19999999999999983e227 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6451.9
Applied rewrites51.9%
if -2.19999999999999983e-30 < x < 2.65e-145Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6468.7
Applied rewrites68.7%
Final simplification59.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (fma x 2.0 5.0))))
(if (<= y -1.3e+52)
t_1
(if (<= y -1.65e-51)
(fma x t (* y 5.0))
(if (<= y 3.3e+52) (* x (fma 2.0 z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -1.3e+52) {
tmp = t_1;
} else if (y <= -1.65e-51) {
tmp = fma(x, t, (y * 5.0));
} else if (y <= 3.3e+52) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -1.3e+52) tmp = t_1; elseif (y <= -1.65e-51) tmp = fma(x, t, Float64(y * 5.0)); elseif (y <= 3.3e+52) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e+52], t$95$1, If[LessEqual[y, -1.65e-51], N[(x * t + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+52], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{+52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.65 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(x, t, y \cdot 5\right)\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+52}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.3e52 or 3.3e52 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
if -1.3e52 < y < -1.64999999999999986e-51Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.9
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6489.9
Applied rewrites89.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6482.5
Applied rewrites82.5%
if -1.64999999999999986e-51 < y < 3.3e52Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.6
Applied rewrites80.6%
Final simplification81.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ t (+ y y)))))
(if (<= x -2.2e-30)
t_1
(if (<= x 7.5e-180)
(* y 5.0)
(if (<= x 1.4e+93) (* x (fma 2.0 z t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y + y));
double tmp;
if (x <= -2.2e-30) {
tmp = t_1;
} else if (x <= 7.5e-180) {
tmp = y * 5.0;
} else if (x <= 1.4e+93) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y + y))) tmp = 0.0 if (x <= -2.2e-30) tmp = t_1; elseif (x <= 7.5e-180) tmp = Float64(y * 5.0); elseif (x <= 1.4e+93) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e-30], t$95$1, If[LessEqual[x, 7.5e-180], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.4e+93], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-180}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+93}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.19999999999999983e-30 or 1.39999999999999994e93 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6497.4
Applied rewrites97.4%
Taylor expanded in z around 0
Applied rewrites76.7%
if -2.19999999999999983e-30 < x < 7.50000000000000015e-180Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6470.4
Applied rewrites70.4%
if 7.50000000000000015e-180 < x < 1.39999999999999994e93Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6470.6
Applied rewrites70.6%
Final simplification73.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -9.2e+24)
t_1
(if (<= x 2.5) (fma y 5.0 (* x (+ t (+ z z)))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -9.2e+24) {
tmp = t_1;
} else if (x <= 2.5) {
tmp = fma(y, 5.0, (x * (t + (z + z))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -9.2e+24) tmp = t_1; elseif (x <= 2.5) tmp = fma(y, 5.0, Float64(x * Float64(t + Float64(z + z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.2e+24], t$95$1, If[LessEqual[x, 2.5], N[(y * 5.0 + N[(x * N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.1999999999999996e24 or 2.5 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
if -9.1999999999999996e24 < x < 2.5Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6498.5
Applied rewrites98.5%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -2.2e-30)
t_1
(if (<= x 2.65e-145) (fma y 5.0 (* x (* z 2.0))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -2.2e-30) {
tmp = t_1;
} else if (x <= 2.65e-145) {
tmp = fma(y, 5.0, (x * (z * 2.0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -2.2e-30) tmp = t_1; elseif (x <= 2.65e-145) tmp = fma(y, 5.0, Float64(x * Float64(z * 2.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e-30], t$95$1, If[LessEqual[x, 2.65e-145], N[(y * 5.0 + N[(x * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-145}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(z \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.19999999999999983e-30 or 2.65e-145 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6493.4
Applied rewrites93.4%
if -2.19999999999999983e-30 < x < 2.65e-145Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
lower-*.f6486.6
Applied rewrites86.6%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -700000000.0) t_1 (if (<= x 1.45e-109) (fma x t (* y 5.0)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, (y + z), t);
double tmp;
if (x <= -700000000.0) {
tmp = t_1;
} else if (x <= 1.45e-109) {
tmp = fma(x, t, (y * 5.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, Float64(y + z), t)) tmp = 0.0 if (x <= -700000000.0) tmp = t_1; elseif (x <= 1.45e-109) tmp = fma(x, t, Float64(y * 5.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -700000000.0], t$95$1, If[LessEqual[x, 1.45e-109], N[(x * t + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y + z, t\right)\\
\mathbf{if}\;x \leq -700000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(x, t, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7e8 or 1.45e-109 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6496.0
Applied rewrites96.0%
if -7e8 < x < 1.45e-109Initial program 99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6498.9
Applied rewrites98.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6482.8
Applied rewrites82.8%
Final simplification90.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -1.12e+18) t_1 (if (<= y 3.3e+52) (* x (fma 2.0 z t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * fma(x, 2.0, 5.0);
double tmp;
if (y <= -1.12e+18) {
tmp = t_1;
} else if (y <= 3.3e+52) {
tmp = x * fma(2.0, z, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * fma(x, 2.0, 5.0)) tmp = 0.0 if (y <= -1.12e+18) tmp = t_1; elseif (y <= 3.3e+52) tmp = Float64(x * fma(2.0, z, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(x * 2.0 + 5.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.12e+18], t$95$1, If[LessEqual[y, 3.3e+52], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \mathsf{fma}\left(x, 2, 5\right)\\
\mathbf{if}\;y \leq -1.12 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+52}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.12e18 or 3.3e52 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6480.4
Applied rewrites80.4%
if -1.12e18 < y < 3.3e52Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6477.6
Applied rewrites77.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ t (+ y y))))) (if (<= x -2.2e-30) t_1 (if (<= x 2.65e-145) (* y 5.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y + y));
double tmp;
if (x <= -2.2e-30) {
tmp = t_1;
} else if (x <= 2.65e-145) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t + (y + y))
if (x <= (-2.2d-30)) then
tmp = t_1
else if (x <= 2.65d-145) then
tmp = y * 5.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t + (y + y));
double tmp;
if (x <= -2.2e-30) {
tmp = t_1;
} else if (x <= 2.65e-145) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t + (y + y)) tmp = 0 if x <= -2.2e-30: tmp = t_1 elif x <= 2.65e-145: tmp = y * 5.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t + Float64(y + y))) tmp = 0.0 if (x <= -2.2e-30) tmp = t_1; elseif (x <= 2.65e-145) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t + (y + y)); tmp = 0.0; if (x <= -2.2e-30) tmp = t_1; elseif (x <= 2.65e-145) tmp = y * 5.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t + N[(y + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.2e-30], t$95$1, If[LessEqual[x, 2.65e-145], N[(y * 5.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(t + \left(y + y\right)\right)\\
\mathbf{if}\;x \leq -2.2 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-145}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.19999999999999983e-30 or 2.65e-145 < x Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6493.4
Applied rewrites93.4%
Taylor expanded in z around 0
Applied rewrites69.6%
if -2.19999999999999983e-30 < x < 2.65e-145Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6468.7
Applied rewrites68.7%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.2e-30) (* x t) (if (<= x 2.65e-145) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-30) {
tmp = x * t;
} else if (x <= 2.65e-145) {
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 <= (-2.2d-30)) then
tmp = x * t
else if (x <= 2.65d-145) 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 <= -2.2e-30) {
tmp = x * t;
} else if (x <= 2.65e-145) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e-30: tmp = x * t elif x <= 2.65e-145: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e-30) tmp = Float64(x * t); elseif (x <= 2.65e-145) 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 <= -2.2e-30) tmp = x * t; elseif (x <= 2.65e-145) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e-30], N[(x * t), $MachinePrecision], If[LessEqual[x, 2.65e-145], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-30}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 2.65 \cdot 10^{-145}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -2.19999999999999983e-30 or 2.65e-145 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6440.9
Applied rewrites40.9%
if -2.19999999999999983e-30 < x < 2.65e-145Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6468.7
Applied rewrites68.7%
Final simplification51.1%
(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 100.0%
Taylor expanded in x around 0
lower-*.f6430.1
Applied rewrites30.1%
Final simplification30.1%
herbie shell --seed 2024238
(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)))