
(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%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* z x) 2.0)) (t_2 (* (fma 2.0 x 5.0) y)))
(if (<= z -2.75e+77)
t_1
(if (<= z -2.2e-233)
t_2
(if (<= z 1.3e-6) (* (fma 2.0 y t) x) (if (<= z 7e+99) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * x) * 2.0;
double t_2 = fma(2.0, x, 5.0) * y;
double tmp;
if (z <= -2.75e+77) {
tmp = t_1;
} else if (z <= -2.2e-233) {
tmp = t_2;
} else if (z <= 1.3e-6) {
tmp = fma(2.0, y, t) * x;
} else if (z <= 7e+99) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z * x) * 2.0) t_2 = Float64(fma(2.0, x, 5.0) * y) tmp = 0.0 if (z <= -2.75e+77) tmp = t_1; elseif (z <= -2.2e-233) tmp = t_2; elseif (z <= 1.3e-6) tmp = Float64(fma(2.0, y, t) * x); elseif (z <= 7e+99) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[z, -2.75e+77], t$95$1, If[LessEqual[z, -2.2e-233], t$95$2, If[LessEqual[z, 1.3e-6], N[(N[(2.0 * y + t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 7e+99], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot 2\\
t_2 := \mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{if}\;z \leq -2.75 \cdot 10^{+77}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-233}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(2, y, t\right) \cdot x\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+99}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.75000000000000018e77 or 6.9999999999999995e99 < z Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6467.3
Applied rewrites67.3%
if -2.75000000000000018e77 < z < -2.2e-233 or 1.30000000000000005e-6 < z < 6.9999999999999995e99Initial 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.f6468.5
Applied rewrites68.5%
if -2.2e-233 < z < 1.30000000000000005e-6Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6498.4
Applied rewrites98.4%
Taylor expanded in x around inf
Applied rewrites71.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5) (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.5) || !(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.5) || !(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.5], 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.5 \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.5 or 2.5 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
if -2.5 < 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
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
count-2N/A
lower-fma.f6499.2
Applied rewrites99.2%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -600.0) (not (<= x 1.8e-136))) (* (fma 2.0 (+ z y) t) x) (fma (fma 2.0 y t) x (* 5.0 y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -600.0) || !(x <= 1.8e-136)) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = fma(fma(2.0, y, t), x, (5.0 * y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -600.0) || !(x <= 1.8e-136)) tmp = Float64(fma(2.0, Float64(z + y), t) * x); 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[x, -600.0], N[Not[LessEqual[x, 1.8e-136]], $MachinePrecision]], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(N[(2.0 * y + t), $MachinePrecision] * x + N[(5.0 * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -600 \lor \neg \left(x \leq 1.8 \cdot 10^{-136}\right):\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, y, t\right), x, 5 \cdot y\right)\\
\end{array}
\end{array}
if x < -600 or 1.7999999999999999e-136 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
if -600 < x < 1.7999999999999999e-136Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f6485.6
Applied rewrites85.6%
Final simplification91.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* z x) 2.0)))
(if (<= x -2.5e-8)
t_1
(if (<= x 7.1e-134) (* 5.0 y) (if (<= x 2.3e+66) t_1 (* (* 2.0 x) y))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * x) * 2.0;
double tmp;
if (x <= -2.5e-8) {
tmp = t_1;
} else if (x <= 7.1e-134) {
tmp = 5.0 * y;
} else if (x <= 2.3e+66) {
tmp = t_1;
} else {
tmp = (2.0 * x) * 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) :: t_1
real(8) :: tmp
t_1 = (z * x) * 2.0d0
if (x <= (-2.5d-8)) then
tmp = t_1
else if (x <= 7.1d-134) then
tmp = 5.0d0 * y
else if (x <= 2.3d+66) then
tmp = t_1
else
tmp = (2.0d0 * x) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * x) * 2.0;
double tmp;
if (x <= -2.5e-8) {
tmp = t_1;
} else if (x <= 7.1e-134) {
tmp = 5.0 * y;
} else if (x <= 2.3e+66) {
tmp = t_1;
} else {
tmp = (2.0 * x) * y;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * x) * 2.0 tmp = 0 if x <= -2.5e-8: tmp = t_1 elif x <= 7.1e-134: tmp = 5.0 * y elif x <= 2.3e+66: tmp = t_1 else: tmp = (2.0 * x) * y return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * x) * 2.0) tmp = 0.0 if (x <= -2.5e-8) tmp = t_1; elseif (x <= 7.1e-134) tmp = Float64(5.0 * y); elseif (x <= 2.3e+66) tmp = t_1; else tmp = Float64(Float64(2.0 * x) * y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * x) * 2.0; tmp = 0.0; if (x <= -2.5e-8) tmp = t_1; elseif (x <= 7.1e-134) tmp = 5.0 * y; elseif (x <= 2.3e+66) tmp = t_1; else tmp = (2.0 * x) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[x, -2.5e-8], t$95$1, If[LessEqual[x, 7.1e-134], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 2.3e+66], t$95$1, N[(N[(2.0 * x), $MachinePrecision] * y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot 2\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.1 \cdot 10^{-134}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot x\right) \cdot y\\
\end{array}
\end{array}
if x < -2.4999999999999999e-8 or 7.10000000000000022e-134 < x < 2.3e66Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6448.0
Applied rewrites48.0%
if -2.4999999999999999e-8 < x < 7.10000000000000022e-134Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6463.2
Applied rewrites63.2%
if 2.3e66 < x Initial program 100.0%
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.f6446.9
Applied rewrites46.9%
Taylor expanded in x around inf
Applied rewrites46.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.8e-6) (not (<= x 1.8e-136))) (* (fma 2.0 (+ z y) t) x) (fma y 5.0 (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.8e-6) || !(x <= 1.8e-136)) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = fma(y, 5.0, (t * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.8e-6) || !(x <= 1.8e-136)) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = fma(y, 5.0, Float64(t * x)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.8e-6], N[Not[LessEqual[x, 1.8e-136]], $MachinePrecision]], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-6} \lor \neg \left(x \leq 1.8 \cdot 10^{-136}\right):\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\end{array}
\end{array}
if x < -4.7999999999999998e-6 or 1.7999999999999999e-136 < x Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
if -4.7999999999999998e-6 < x < 1.7999999999999999e-136Initial 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
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
count-2N/A
lower-fma.f6499.0
Applied rewrites99.0%
Taylor expanded in z around 0
lower-*.f6484.6
Applied rewrites84.6%
Final simplification90.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.82) (not (<= x 4.1e-35))) (* (* 2.0 (+ y z)) x) (fma y 5.0 (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.82) || !(x <= 4.1e-35)) {
tmp = (2.0 * (y + z)) * x;
} else {
tmp = fma(y, 5.0, (t * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.82) || !(x <= 4.1e-35)) tmp = Float64(Float64(2.0 * Float64(y + z)) * x); else tmp = fma(y, 5.0, Float64(t * x)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.82], N[Not[LessEqual[x, 4.1e-35]], $MachinePrecision]], N[(N[(2.0 * N[(y + z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.82 \lor \neg \left(x \leq 4.1 \cdot 10^{-35}\right):\\
\;\;\;\;\left(2 \cdot \left(y + z\right)\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\end{array}
\end{array}
if x < -0.819999999999999951 or 4.10000000000000026e-35 < x Initial program 100.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6497.3
Applied rewrites97.3%
Taylor expanded in t around 0
Applied rewrites76.2%
if -0.819999999999999951 < x < 4.10000000000000026e-35Initial 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
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
count-2N/A
lower-fma.f6499.1
Applied rewrites99.1%
Taylor expanded in z around 0
lower-*.f6482.6
Applied rewrites82.6%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -5e-40) (not (<= y 3.48e+26))) (* (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 <= -5e-40) || !(y <= 3.48e+26)) {
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 <= -5e-40) || !(y <= 3.48e+26)) 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, -5e-40], N[Not[LessEqual[y, 3.48e+26]], $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 -5 \cdot 10^{-40} \lor \neg \left(y \leq 3.48 \cdot 10^{+26}\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 < -4.99999999999999965e-40 or 3.4799999999999997e26 < 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.f6472.5
Applied rewrites72.5%
if -4.99999999999999965e-40 < y < 3.4799999999999997e26Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.55e+147) (not (<= z 6e+65))) (* (* z x) 2.0) (* (fma 2.0 y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.55e+147) || !(z <= 6e+65)) {
tmp = (z * x) * 2.0;
} else {
tmp = fma(2.0, y, t) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.55e+147) || !(z <= 6e+65)) tmp = Float64(Float64(z * x) * 2.0); else tmp = Float64(fma(2.0, y, t) * x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.55e+147], N[Not[LessEqual[z, 6e+65]], $MachinePrecision]], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(2.0 * y + t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+147} \lor \neg \left(z \leq 6 \cdot 10^{+65}\right):\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, y, t\right) \cdot x\\
\end{array}
\end{array}
if z < -1.55e147 or 6.0000000000000004e65 < z Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6470.9
Applied rewrites70.9%
if -1.55e147 < z < 6.0000000000000004e65Initial 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.7
Applied rewrites90.7%
Taylor expanded in x around inf
Applied rewrites57.7%
Final simplification62.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.6e-6) (not (<= x 1.2e-12))) (* (* 2.0 x) y) (* 5.0 y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.6e-6) || !(x <= 1.2e-12)) {
tmp = (2.0 * x) * y;
} 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 <= (-4.6d-6)) .or. (.not. (x <= 1.2d-12))) then
tmp = (2.0d0 * x) * y
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 <= -4.6e-6) || !(x <= 1.2e-12)) {
tmp = (2.0 * x) * y;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.6e-6) or not (x <= 1.2e-12): tmp = (2.0 * x) * y else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.6e-6) || !(x <= 1.2e-12)) tmp = Float64(Float64(2.0 * x) * y); else tmp = Float64(5.0 * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.6e-6) || ~((x <= 1.2e-12))) tmp = (2.0 * x) * y; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.6e-6], N[Not[LessEqual[x, 1.2e-12]], $MachinePrecision]], N[(N[(2.0 * x), $MachinePrecision] * y), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{-6} \lor \neg \left(x \leq 1.2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(2 \cdot x\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if x < -4.6e-6 or 1.19999999999999994e-12 < x Initial program 100.0%
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.f6441.7
Applied rewrites41.7%
Taylor expanded in x around inf
Applied rewrites39.8%
if -4.6e-6 < x < 1.19999999999999994e-12Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6456.6
Applied rewrites56.6%
Final simplification48.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6e+23) (not (<= t 1.9e+199))) (* t x) (* 5.0 y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6e+23) || !(t <= 1.9e+199)) {
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 ((t <= (-6d+23)) .or. (.not. (t <= 1.9d+199))) 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 ((t <= -6e+23) || !(t <= 1.9e+199)) {
tmp = t * x;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6e+23) or not (t <= 1.9e+199): tmp = t * x else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6e+23) || !(t <= 1.9e+199)) 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 ((t <= -6e+23) || ~((t <= 1.9e+199))) tmp = t * x; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6e+23], N[Not[LessEqual[t, 1.9e+199]], $MachinePrecision]], N[(t * x), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+23} \lor \neg \left(t \leq 1.9 \cdot 10^{+199}\right):\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if t < -6.0000000000000002e23 or 1.9e199 < t Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6462.4
Applied rewrites62.4%
if -6.0000000000000002e23 < t < 1.9e199Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6435.8
Applied rewrites35.8%
Final simplification44.9%
(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-*.f6430.0
Applied rewrites30.0%
herbie shell --seed 2024313
(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)))