
(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 99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -1.05e-54)
t_1
(if (<= x 9e-95)
(fma x (* z 2.0) (* y 5.0))
(if (<= x 5e-18) (fma 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 <= -1.05e-54) {
tmp = t_1;
} else if (x <= 9e-95) {
tmp = fma(x, (z * 2.0), (y * 5.0));
} else if (x <= 5e-18) {
tmp = fma(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 <= -1.05e-54) tmp = t_1; elseif (x <= 9e-95) tmp = fma(x, Float64(z * 2.0), Float64(y * 5.0)); elseif (x <= 5e-18) tmp = fma(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, -1.05e-54], t$95$1, If[LessEqual[x, 9e-95], N[(x * N[(z * 2.0), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5e-18], N[(y * 5.0 + 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 -1.05 \cdot 10^{-54}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(x, z \cdot 2, y \cdot 5\right)\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.05e-54 or 5.00000000000000036e-18 < 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-+.f6498.2
Applied rewrites98.2%
if -1.05e-54 < x < 9e-95Initial program 99.8%
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 t around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6484.5
Applied rewrites84.5%
if 9e-95 < x < 5.00000000000000036e-18Initial program 100.0%
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-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Final simplification93.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (fma x 2.0 5.0))))
(if (<= y -1.05e+83)
t_1
(if (<= y -5.2e-12)
(fma y 5.0 (* x t))
(if (<= y 1.56e+133) (* 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.05e+83) {
tmp = t_1;
} else if (y <= -5.2e-12) {
tmp = fma(y, 5.0, (x * t));
} else if (y <= 1.56e+133) {
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.05e+83) tmp = t_1; elseif (y <= -5.2e-12) tmp = fma(y, 5.0, Float64(x * t)); elseif (y <= 1.56e+133) 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.05e+83], t$95$1, If[LessEqual[y, -5.2e-12], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.56e+133], 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.05 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -5.2 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{elif}\;y \leq 1.56 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.05000000000000001e83 or 1.56e133 < y Initial program 99.8%
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.f6478.1
Applied rewrites78.1%
if -1.05000000000000001e83 < y < -5.19999999999999965e-12Initial program 99.9%
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-+.f6494.2
Applied rewrites94.2%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6492.0
Applied rewrites92.0%
if -5.19999999999999965e-12 < y < 1.56e133Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.6
Applied rewrites79.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (fma 2.0 (+ y z) t))))
(if (<= x -34000000000000.0)
t_1
(if (<= x 6.4e-18) (fma y 5.0 (* x (+ z (+ z 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 <= -34000000000000.0) {
tmp = t_1;
} else if (x <= 6.4e-18) {
tmp = fma(y, 5.0, (x * (z + (z + 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 <= -34000000000000.0) tmp = t_1; elseif (x <= 6.4e-18) tmp = fma(y, 5.0, Float64(x * Float64(z + Float64(z + 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, -34000000000000.0], t$95$1, If[LessEqual[x, 6.4e-18], N[(y * 5.0 + N[(x * N[(z + N[(z + t), $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 -34000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(z + \left(z + t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.4e13 or 6.3999999999999998e-18 < 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.4
Applied rewrites99.4%
if -3.4e13 < x < 6.3999999999999998e-18Initial 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%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 (+ y z) t)))) (if (<= x -2.5e-56) t_1 (if (<= x 5e-18) (fma 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-56) {
tmp = t_1;
} else if (x <= 5e-18) {
tmp = fma(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-56) tmp = t_1; elseif (x <= 5e-18) tmp = fma(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-56], t$95$1, If[LessEqual[x, 5e-18], N[(y * 5.0 + 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^{-56}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.49999999999999999e-56 or 5.00000000000000036e-18 < 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-+.f6498.2
Applied rewrites98.2%
if -2.49999999999999999e-56 < x < 5.00000000000000036e-18Initial 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 0
*-commutativeN/A
lower-*.f6476.7
Applied rewrites76.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -1e-23) t_1 (if (<= y 1.56e+133) (* 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 <= -1e-23) {
tmp = t_1;
} else if (y <= 1.56e+133) {
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 <= -1e-23) tmp = t_1; elseif (y <= 1.56e+133) 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, -1e-23], t$95$1, If[LessEqual[y, 1.56e+133], 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 \cdot 10^{-23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.56 \cdot 10^{+133}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.9999999999999996e-24 or 1.56e133 < y Initial program 99.8%
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.f6475.0
Applied rewrites75.0%
if -9.9999999999999996e-24 < y < 1.56e133Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.0
Applied rewrites80.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (fma 2.0 z t)))) (if (<= z -1.3e-43) t_1 (if (<= z 6.6e+96) (* x (fma 2.0 y 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 <= -1.3e-43) {
tmp = t_1;
} else if (z <= 6.6e+96) {
tmp = x * fma(2.0, y, 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 <= -1.3e-43) tmp = t_1; elseif (z <= 6.6e+96) tmp = Float64(x * fma(2.0, y, 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, -1.3e-43], t$95$1, If[LessEqual[z, 6.6e+96], N[(x * N[(2.0 * y + 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 -1.3 \cdot 10^{-43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+96}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3e-43 or 6.59999999999999969e96 < z Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6476.1
Applied rewrites76.1%
if -1.3e-43 < z < 6.59999999999999969e96Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6471.4
Applied rewrites71.4%
Taylor expanded in z around 0
Applied rewrites65.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ z z)))) (if (<= z -2e+89) t_1 (if (<= z 2.25e+112) (* x (fma 2.0 y t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (z <= -2e+89) {
tmp = t_1;
} else if (z <= 2.25e+112) {
tmp = x * fma(2.0, y, 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 <= -2e+89) tmp = t_1; elseif (z <= 2.25e+112) tmp = Float64(x * fma(2.0, y, 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, -2e+89], t$95$1, If[LessEqual[z, 2.25e+112], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + z\right)\\
\mathbf{if}\;z \leq -2 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+112}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.99999999999999999e89 or 2.24999999999999995e112 < 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-*.f6465.9
Applied rewrites65.9%
Applied rewrites65.9%
if -1.99999999999999999e89 < z < 2.24999999999999995e112Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6474.1
Applied rewrites74.1%
Taylor expanded in z around 0
Applied rewrites64.2%
Final simplification64.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (+ z z)))) (if (<= z -3.9e-29) t_1 (if (<= z 2.25e+112) (* x t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + z);
double tmp;
if (z <= -3.9e-29) {
tmp = t_1;
} else if (z <= 2.25e+112) {
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 <= (-3.9d-29)) then
tmp = t_1
else if (z <= 2.25d+112) 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 <= -3.9e-29) {
tmp = t_1;
} else if (z <= 2.25e+112) {
tmp = x * t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (z + z) tmp = 0 if z <= -3.9e-29: tmp = t_1 elif z <= 2.25e+112: 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 <= -3.9e-29) tmp = t_1; elseif (z <= 2.25e+112) 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 <= -3.9e-29) tmp = t_1; elseif (z <= 2.25e+112) 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, -3.9e-29], t$95$1, If[LessEqual[z, 2.25e+112], 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 -3.9 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.25 \cdot 10^{+112}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.8999999999999998e-29 or 2.24999999999999995e112 < 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-*.f6461.9
Applied rewrites61.9%
Applied rewrites61.9%
if -3.8999999999999998e-29 < z < 2.24999999999999995e112Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6446.2
Applied rewrites46.2%
Final simplification53.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1.05e-54) (* x t) (if (<= x 9e-68) (* y 5.0) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.05e-54) {
tmp = x * t;
} else if (x <= 9e-68) {
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 <= (-1.05d-54)) then
tmp = x * t
else if (x <= 9d-68) 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 <= -1.05e-54) {
tmp = x * t;
} else if (x <= 9e-68) {
tmp = y * 5.0;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.05e-54: tmp = x * t elif x <= 9e-68: tmp = y * 5.0 else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.05e-54) tmp = Float64(x * t); elseif (x <= 9e-68) 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 <= -1.05e-54) tmp = x * t; elseif (x <= 9e-68) tmp = y * 5.0; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.05e-54], N[(x * t), $MachinePrecision], If[LessEqual[x, 9e-68], N[(y * 5.0), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-54}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-68}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -1.05e-54 or 8.99999999999999998e-68 < x Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6444.2
Applied rewrites44.2%
if -1.05e-54 < x < 8.99999999999999998e-68Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6458.3
Applied rewrites58.3%
Final simplification49.3%
(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 99.9%
Taylor expanded in x around 0
lower-*.f6425.3
Applied rewrites25.3%
Final simplification25.3%
herbie shell --seed 2024220
(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)))