
(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 10 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 2.0 (+ z y) t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma(2.0, (z + y), t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(2.0, Float64(z + y), t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(2, z + y, t\right)\right)
\end{array}
Initial program 99.6%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6497.7
lift-fma.f64N/A
+-commutativeN/A
count-2N/A
associate-+l+N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lower-*.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
lower-+.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* x z) 2.0)) (t_2 (* (fma 2.0 y t) x)))
(if (<= z -5.7e+179)
t_1
(if (<= z -7.6e+127)
t_2
(if (<= z -1.22e-207)
(* (fma 2.0 x 5.0) y)
(if (<= z 8.8e+161) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) * 2.0;
double t_2 = fma(2.0, y, t) * x;
double tmp;
if (z <= -5.7e+179) {
tmp = t_1;
} else if (z <= -7.6e+127) {
tmp = t_2;
} else if (z <= -1.22e-207) {
tmp = fma(2.0, x, 5.0) * y;
} else if (z <= 8.8e+161) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * z) * 2.0) t_2 = Float64(fma(2.0, y, t) * x) tmp = 0.0 if (z <= -5.7e+179) tmp = t_1; elseif (z <= -7.6e+127) tmp = t_2; elseif (z <= -1.22e-207) tmp = Float64(fma(2.0, x, 5.0) * y); elseif (z <= 8.8e+161) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 * y + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -5.7e+179], t$95$1, If[LessEqual[z, -7.6e+127], t$95$2, If[LessEqual[z, -1.22e-207], N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 8.8e+161], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot z\right) \cdot 2\\
t_2 := \mathsf{fma}\left(2, y, t\right) \cdot x\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{+179}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.6 \cdot 10^{+127}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-207}:\\
\;\;\;\;\mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+161}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.7e179 or 8.7999999999999999e161 < z Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.7
Applied rewrites84.7%
if -5.7e179 < z < -7.59999999999999961e127 or -1.22e-207 < z < 8.7999999999999999e161Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in x around inf
Applied rewrites66.3%
if -7.59999999999999961e127 < z < -1.22e-207Initial 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
*-commutativeN/A
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f6462.9
Applied rewrites62.9%
Final simplification69.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma y 5.0 (* (fma 2.0 z t) x))))
(if (<= z -1.95e+90)
t_1
(if (<= z 2.5e-130) (fma (fma 2.0 y t) x (* 5.0 y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, 5.0, (fma(2.0, z, t) * x));
double tmp;
if (z <= -1.95e+90) {
tmp = t_1;
} else if (z <= 2.5e-130) {
tmp = fma(fma(2.0, y, t), x, (5.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, 5.0, Float64(fma(2.0, z, t) * x)) tmp = 0.0 if (z <= -1.95e+90) tmp = t_1; elseif (z <= 2.5e-130) tmp = fma(fma(2.0, y, t), x, Float64(5.0 * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e+90], t$95$1, If[LessEqual[z, 2.5e-130], N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-130}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9500000000000001e90 or 2.4999999999999998e-130 < z Initial program 99.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
lift-+.f64N/A
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
count-2N/A
lower-fma.f6495.6
Applied rewrites95.6%
if -1.9500000000000001e90 < z < 2.4999999999999998e-130Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6496.1
Applied rewrites96.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 z t) x)))
(if (<= z -1.4e+206)
t_1
(if (<= z 1.7e+98) (fma (fma 2.0 y t) x (* 5.0 y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, z, t) * x;
double tmp;
if (z <= -1.4e+206) {
tmp = t_1;
} else if (z <= 1.7e+98) {
tmp = fma(fma(2.0, y, t), x, (5.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, z, t) * x) tmp = 0.0 if (z <= -1.4e+206) tmp = t_1; elseif (z <= 1.7e+98) tmp = fma(fma(2.0, y, t), x, Float64(5.0 * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.4e+206], t$95$1, If[LessEqual[z, 1.7e+98], N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, z, t\right) \cdot x\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+206}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3999999999999999e206 or 1.69999999999999986e98 < z Initial program 98.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6496.0
Applied rewrites96.0%
if -1.3999999999999999e206 < z < 1.69999999999999986e98Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6490.1
Applied rewrites90.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* x z) 2.0)))
(if (<= z -2.2e+90)
t_1
(if (<= z -7.4e-203) (* 5.0 y) (if (<= z 7.6e+117) (* x t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) * 2.0;
double tmp;
if (z <= -2.2e+90) {
tmp = t_1;
} else if (z <= -7.4e-203) {
tmp = 5.0 * y;
} else if (z <= 7.6e+117) {
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 = (x * z) * 2.0d0
if (z <= (-2.2d+90)) then
tmp = t_1
else if (z <= (-7.4d-203)) then
tmp = 5.0d0 * y
else if (z <= 7.6d+117) 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 = (x * z) * 2.0;
double tmp;
if (z <= -2.2e+90) {
tmp = t_1;
} else if (z <= -7.4e-203) {
tmp = 5.0 * y;
} else if (z <= 7.6e+117) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * z) * 2.0 tmp = 0 if z <= -2.2e+90: tmp = t_1 elif z <= -7.4e-203: tmp = 5.0 * y elif z <= 7.6e+117: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * z) * 2.0) tmp = 0.0 if (z <= -2.2e+90) tmp = t_1; elseif (z <= -7.4e-203) tmp = Float64(5.0 * y); elseif (z <= 7.6e+117) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * z) * 2.0; tmp = 0.0; if (z <= -2.2e+90) tmp = t_1; elseif (z <= -7.4e-203) tmp = 5.0 * y; elseif (z <= 7.6e+117) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[z, -2.2e+90], t$95$1, If[LessEqual[z, -7.4e-203], N[(5.0 * y), $MachinePrecision], If[LessEqual[z, 7.6e+117], N[(x * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot z\right) \cdot 2\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -7.4 \cdot 10^{-203}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+117}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1999999999999999e90 or 7.6000000000000003e117 < z Initial program 98.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.9
Applied rewrites71.9%
if -2.1999999999999999e90 < z < -7.40000000000000004e-203Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6443.3
Applied rewrites43.3%
if -7.40000000000000004e-203 < z < 7.6000000000000003e117Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6444.0
Applied rewrites44.0%
Final simplification53.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y 5.0 (* (* 2.0 y) x)))) (if (<= y -5.5e-11) t_1 (if (<= y 1.2e+74) (* (fma 2.0 z t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, 5.0, ((2.0 * y) * x));
double tmp;
if (y <= -5.5e-11) {
tmp = t_1;
} else if (y <= 1.2e+74) {
tmp = fma(2.0, z, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, 5.0, Float64(Float64(2.0 * y) * x)) tmp = 0.0 if (y <= -5.5e-11) tmp = t_1; elseif (y <= 1.2e+74) 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[(y * 5.0 + N[(N[(2.0 * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.5e-11], t$95$1, If[LessEqual[y, 1.2e+74], N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 5, \left(2 \cdot y\right) \cdot x\right)\\
\mathbf{if}\;y \leq -5.5 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(2, z, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.49999999999999975e-11 or 1.20000000000000004e74 < y Initial program 99.9%
lift-*.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6496.8
Applied rewrites96.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6496.9
lift-fma.f64N/A
+-commutativeN/A
count-2N/A
associate-+l+N/A
lower-fma.f64N/A
lift-*.f64N/A
distribute-rgt-inN/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
lower-*.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
lower-*.f6483.9
Applied rewrites83.9%
if -5.49999999999999975e-11 < y < 1.20000000000000004e74Initial program 99.3%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6485.6
Applied rewrites85.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma 2.0 x 5.0) y))) (if (<= y -5.5e-11) t_1 (if (<= y 1.2e+74) (* (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 <= -5.5e-11) {
tmp = t_1;
} else if (y <= 1.2e+74) {
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 <= -5.5e-11) tmp = t_1; elseif (y <= 1.2e+74) 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, -5.5e-11], t$95$1, If[LessEqual[y, 1.2e+74], 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 -5.5 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+74}:\\
\;\;\;\;\mathsf{fma}\left(2, z, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.49999999999999975e-11 or 1.20000000000000004e74 < 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
*-commutativeN/A
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f6483.8
Applied rewrites83.8%
if -5.49999999999999975e-11 < y < 1.20000000000000004e74Initial program 99.3%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6485.6
Applied rewrites85.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (* x z) 2.0))) (if (<= z -5.7e+179) t_1 (if (<= z 8.8e+161) (* (fma 2.0 y t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) * 2.0;
double tmp;
if (z <= -5.7e+179) {
tmp = t_1;
} else if (z <= 8.8e+161) {
tmp = fma(2.0, y, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * z) * 2.0) tmp = 0.0 if (z <= -5.7e+179) tmp = t_1; elseif (z <= 8.8e+161) tmp = Float64(fma(2.0, y, t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * z), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[z, -5.7e+179], t$95$1, If[LessEqual[z, 8.8e+161], N[(N[(2.0 * y + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot z\right) \cdot 2\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{+179}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+161}:\\
\;\;\;\;\mathsf{fma}\left(2, y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.7e179 or 8.7999999999999999e161 < z Initial program 98.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6484.7
Applied rewrites84.7%
if -5.7e179 < z < 8.7999999999999999e161Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.3
Applied rewrites88.3%
Taylor expanded in x around inf
Applied rewrites59.0%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (<= y -3.2e-26) (* 5.0 y) (if (<= y 7e+38) (* x t) (* 5.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.2e-26) {
tmp = 5.0 * y;
} else if (y <= 7e+38) {
tmp = x * t;
} 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 (y <= (-3.2d-26)) then
tmp = 5.0d0 * y
else if (y <= 7d+38) then
tmp = x * t
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 (y <= -3.2e-26) {
tmp = 5.0 * y;
} else if (y <= 7e+38) {
tmp = x * t;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.2e-26: tmp = 5.0 * y elif y <= 7e+38: tmp = x * t else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.2e-26) tmp = Float64(5.0 * y); elseif (y <= 7e+38) tmp = Float64(x * t); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.2e-26) tmp = 5.0 * y; elseif (y <= 7e+38) tmp = x * t; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.2e-26], N[(5.0 * y), $MachinePrecision], If[LessEqual[y, 7e+38], N[(x * t), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{-26}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+38}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if y < -3.2000000000000001e-26 or 7.00000000000000003e38 < y Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6449.5
Applied rewrites49.5%
if -3.2000000000000001e-26 < y < 7.00000000000000003e38Initial program 99.3%
Taylor expanded in t around inf
lower-*.f6448.0
Applied rewrites48.0%
Final simplification48.6%
(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.6%
Taylor expanded in x around 0
lower-*.f6426.4
Applied rewrites26.4%
herbie shell --seed 2024332
(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)))