
(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 (fma y 5.0 (* x (fma 2.0 (+ y z) t))))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (x * fma(2.0, (y + z), t)));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(x * fma(2.0, Float64(y + z), t))) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(x * N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, x \cdot \mathsf{fma}\left(2, y + z, t\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in x around 0
lower-*.f6426.7
Applied rewrites26.7%
Taylor expanded in t around inf
Applied rewrites88.4%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
*-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
distribute-lft-inN/A
lower-fma.f64N/A
distribute-lft-inN/A
*-commutativeN/A
distribute-rgt-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -2.5) t_1 (if (<= x 2.5) (fma (+ t (+ z z)) x (* 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 <= -2.5) {
tmp = t_1;
} else if (x <= 2.5) {
tmp = fma((t + (z + z)), x, (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 <= -2.5) tmp = t_1; elseif (x <= 2.5) tmp = fma(Float64(t + Float64(z + z)), x, 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, -2.5], t$95$1, If[LessEqual[x, 2.5], N[(N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision] * x + 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 -2.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\mathsf{fma}\left(t + \left(z + z\right), x, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.5 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-+.f6499.7
Applied rewrites99.7%
if -2.5 < x < 2.5Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/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-+.f6499.1
Applied rewrites99.1%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -2.5) 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 <= -2.5) {
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 <= -2.5) 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, -2.5], 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 -2.5:\\
\;\;\;\;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 < -2.5 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-+.f6499.7
Applied rewrites99.7%
if -2.5 < 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-+.f6499.1
Applied rewrites99.1%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.45e+47)
(fma y 5.0 (* x (+ z z)))
(if (<= z 1.4e+83)
(fma x (fma y 2.0 t) (* y 5.0))
(fma (+ z z) x (* y 5.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+47) {
tmp = fma(y, 5.0, (x * (z + z)));
} else if (z <= 1.4e+83) {
tmp = fma(x, fma(y, 2.0, t), (y * 5.0));
} else {
tmp = fma((z + z), x, (y * 5.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+47) tmp = fma(y, 5.0, Float64(x * Float64(z + z))); elseif (z <= 1.4e+83) tmp = fma(x, fma(y, 2.0, t), Float64(y * 5.0)); else tmp = fma(Float64(z + z), x, Float64(y * 5.0)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+47], N[(y * 5.0 + N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+83], N[(x * N[(y * 2.0 + t), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], N[(N[(z + z), $MachinePrecision] * x + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(z + z\right)\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(y, 2, t\right), y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z + z, x, y \cdot 5\right)\\
\end{array}
\end{array}
if z < -1.4499999999999999e47Initial program 100.0%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/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-+.f6496.0
Applied rewrites96.0%
Taylor expanded in t around inf
lower-*.f6412.7
Applied rewrites12.7%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6487.2
Applied rewrites87.2%
Applied rewrites87.2%
if -1.4499999999999999e47 < z < 1.4e83Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
if 1.4e83 < z Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/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-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around inf
lower-*.f6415.8
Applied rewrites15.8%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6491.3
Applied rewrites91.3%
Applied rewrites91.3%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -2.5e-148) t_1 (if (<= x 4.8e-5) (+ (* y 5.0) (* x t)) 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.5e-148) {
tmp = t_1;
} else if (x <= 4.8e-5) {
tmp = (y * 5.0) + (x * t);
} 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.5e-148) tmp = t_1; elseif (x <= 4.8e-5) tmp = Float64(Float64(y * 5.0) + Float64(x * t)); 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.5e-148], t$95$1, If[LessEqual[x, 4.8e-5], N[(N[(y * 5.0), $MachinePrecision] + N[(x * t), $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.5 \cdot 10^{-148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-5}:\\
\;\;\;\;y \cdot 5 + x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.4999999999999999e-148 or 4.8000000000000001e-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-+.f6495.1
Applied rewrites95.1%
if -2.4999999999999999e-148 < x < 4.8000000000000001e-5Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6482.4
Applied rewrites82.4%
Final simplification90.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -1.1e+56) t_1 (if (<= y 7.5e+24) (* 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.1e+56) {
tmp = t_1;
} else if (y <= 7.5e+24) {
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.1e+56) tmp = t_1; elseif (y <= 7.5e+24) 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.1e+56], t$95$1, If[LessEqual[y, 7.5e+24], 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.1 \cdot 10^{+56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+24}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.10000000000000008e56 or 7.50000000000000014e24 < 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.f6479.9
Applied rewrites79.9%
if -1.10000000000000008e56 < y < 7.50000000000000014e24Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6483.3
Applied rewrites83.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 z t)))) (if (<= z -5.5e-45) t_1 (if (<= z 1.36e+23) (* x (fma y 2.0 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, z, t);
double tmp;
if (z <= -5.5e-45) {
tmp = t_1;
} else if (z <= 1.36e+23) {
tmp = x * fma(y, 2.0, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, z, t)) tmp = 0.0 if (z <= -5.5e-45) tmp = t_1; elseif (z <= 1.36e+23) tmp = Float64(x * fma(y, 2.0, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e-45], t$95$1, If[LessEqual[z, 1.36e+23], N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.36 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.5000000000000003e-45 or 1.36e23 < z Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6476.6
Applied rewrites76.6%
if -5.5000000000000003e-45 < z < 1.36e23Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6471.2
Applied rewrites71.2%
Taylor expanded in z around 0
Applied rewrites69.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ z z)))) (if (<= z -3.6e+47) t_1 (if (<= z 1.4e+83) (* x (fma y 2.0 t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (z <= -3.6e+47) {
tmp = t_1;
} else if (z <= 1.4e+83) {
tmp = x * fma(y, 2.0, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(z + z)) tmp = 0.0 if (z <= -3.6e+47) tmp = t_1; elseif (z <= 1.4e+83) tmp = Float64(x * fma(y, 2.0, t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+47], t$95$1, If[LessEqual[z, 1.4e+83], N[(x * N[(y * 2.0 + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+83}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(y, 2, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.60000000000000008e47 or 1.4e83 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -3.60000000000000008e47 < z < 1.4e83Initial program 100.0%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6472.2
Applied rewrites72.2%
Taylor expanded in z around 0
Applied rewrites66.4%
Final simplification67.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ z z)))) (if (<= z -2.2e+40) t_1 (if (<= z 2.15e+82) (* x t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (z <= -2.2e+40) {
tmp = t_1;
} else if (z <= 2.15e+82) {
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 + z)
if (z <= (-2.2d+40)) then
tmp = t_1
else if (z <= 2.15d+82) 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 + z);
double tmp;
if (z <= -2.2e+40) {
tmp = t_1;
} else if (z <= 2.15e+82) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + z) tmp = 0 if z <= -2.2e+40: tmp = t_1 elif z <= 2.15e+82: tmp = x * t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(z + z)) tmp = 0.0 if (z <= -2.2e+40) tmp = t_1; elseif (z <= 2.15e+82) tmp = Float64(x * t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (z + z); tmp = 0.0; if (z <= -2.2e+40) tmp = t_1; elseif (z <= 2.15e+82) tmp = x * t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+40], t$95$1, If[LessEqual[z, 2.15e+82], N[(x * t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.15 \cdot 10^{+82}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1999999999999999e40 or 2.15000000000000007e82 < z Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -2.1999999999999999e40 < z < 2.15000000000000007e82Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6445.8
Applied rewrites45.8%
Final simplification54.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1.4e-10) (* x t) (if (<= t 3.3e+77) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.4e-10) {
tmp = x * t;
} else if (t <= 3.3e+77) {
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 (t <= (-1.4d-10)) then
tmp = x * t
else if (t <= 3.3d+77) 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 (t <= -1.4e-10) {
tmp = x * t;
} else if (t <= 3.3e+77) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.4e-10: tmp = x * t elif t <= 3.3e+77: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.4e-10) tmp = Float64(x * t); elseif (t <= 3.3e+77) 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 (t <= -1.4e-10) tmp = x * t; elseif (t <= 3.3e+77) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.4e-10], N[(x * t), $MachinePrecision], If[LessEqual[t, 3.3e+77], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-10}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+77}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if t < -1.40000000000000008e-10 or 3.2999999999999998e77 < t Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
if -1.40000000000000008e-10 < t < 3.2999999999999998e77Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6435.8
Applied rewrites35.8%
Final simplification48.6%
(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-*.f6426.7
Applied rewrites26.7%
Final simplification26.7%
herbie shell --seed 2024219
(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)))