
(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-+.f6498.0
Applied rewrites98.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.1
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 (* (fma 2.0 x 5.0) y)))
(if (<= y -2.6e-8)
t_1
(if (<= y -6.5e-207) (* (* x z) 2.0) (if (<= y 1.2e-41) (* x t) 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 <= -2.6e-8) {
tmp = t_1;
} else if (y <= -6.5e-207) {
tmp = (x * z) * 2.0;
} else if (y <= 1.2e-41) {
tmp = x * t;
} 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 <= -2.6e-8) tmp = t_1; elseif (y <= -6.5e-207) tmp = Float64(Float64(x * z) * 2.0); elseif (y <= 1.2e-41) tmp = Float64(x * t); 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, -2.6e-8], t$95$1, If[LessEqual[y, -6.5e-207], N[(N[(x * z), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[y, 1.2e-41], N[(x * t), $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 -2.6 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -6.5 \cdot 10^{-207}:\\
\;\;\;\;\left(x \cdot z\right) \cdot 2\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-41}:\\
\;\;\;\;x \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.6000000000000001e-8 or 1.20000000000000011e-41 < y Initial program 99.3%
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.f6471.9
Applied rewrites71.9%
if -2.6000000000000001e-8 < y < -6.5000000000000001e-207Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6451.9
Applied rewrites51.9%
if -6.5000000000000001e-207 < y < 1.20000000000000011e-41Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6453.4
Applied rewrites53.4%
Final simplification64.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma (+ z y) 2.0 t) x)))
(if (<= x -2.5)
t_1
(if (<= x 1.35e-8) (fma y 5.0 (* (fma 2.0 z t) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z + y), 2.0, t) * x;
double tmp;
if (x <= -2.5) {
tmp = t_1;
} else if (x <= 1.35e-8) {
tmp = fma(y, 5.0, (fma(2.0, z, t) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(z + y), 2.0, t) * x) tmp = 0.0 if (x <= -2.5) tmp = t_1; elseif (x <= 1.35e-8) tmp = fma(y, 5.0, 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[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.5], t$95$1, If[LessEqual[x, 1.35e-8], N[(y * 5.0 + N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z + y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -2.5:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, z, t\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.5 or 1.35000000000000001e-8 < x Initial program 100.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.0
Applied rewrites99.0%
if -2.5 < x < 1.35000000000000001e-8Initial program 99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.3
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.3
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%
(FPCore (x y z t) :precision binary64 (if (<= x -6.2e+91) (* (* 2.0 y) x) (if (<= x -3.9e-24) (* x t) (if (<= x 1.7e-13) (* 5.0 y) (* (* x z) 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+91) {
tmp = (2.0 * y) * x;
} else if (x <= -3.9e-24) {
tmp = x * t;
} else if (x <= 1.7e-13) {
tmp = 5.0 * y;
} else {
tmp = (x * z) * 2.0;
}
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 <= (-6.2d+91)) then
tmp = (2.0d0 * y) * x
else if (x <= (-3.9d-24)) then
tmp = x * t
else if (x <= 1.7d-13) then
tmp = 5.0d0 * y
else
tmp = (x * z) * 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6.2e+91) {
tmp = (2.0 * y) * x;
} else if (x <= -3.9e-24) {
tmp = x * t;
} else if (x <= 1.7e-13) {
tmp = 5.0 * y;
} else {
tmp = (x * z) * 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6.2e+91: tmp = (2.0 * y) * x elif x <= -3.9e-24: tmp = x * t elif x <= 1.7e-13: tmp = 5.0 * y else: tmp = (x * z) * 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6.2e+91) tmp = Float64(Float64(2.0 * y) * x); elseif (x <= -3.9e-24) tmp = Float64(x * t); elseif (x <= 1.7e-13) tmp = Float64(5.0 * y); else tmp = Float64(Float64(x * z) * 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6.2e+91) tmp = (2.0 * y) * x; elseif (x <= -3.9e-24) tmp = x * t; elseif (x <= 1.7e-13) tmp = 5.0 * y; else tmp = (x * z) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6.2e+91], N[(N[(2.0 * y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[x, -3.9e-24], N[(x * t), $MachinePrecision], If[LessEqual[x, 1.7e-13], N[(5.0 * y), $MachinePrecision], N[(N[(x * z), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+91}:\\
\;\;\;\;\left(2 \cdot y\right) \cdot x\\
\mathbf{elif}\;x \leq -3.9 \cdot 10^{-24}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-13}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot z\right) \cdot 2\\
\end{array}
\end{array}
if x < -6.19999999999999995e91Initial program 100.0%
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-+.f6495.6
Applied rewrites95.6%
Taylor expanded in x around inf
*-commutativeN/A
associate-+r+N/A
count-2N/A
associate-+l+N/A
associate-+r+N/A
lower-*.f64N/A
associate-+r+N/A
associate-+l+N/A
count-2N/A
associate-+r+N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites51.7%
if -6.19999999999999995e91 < x < -3.9e-24Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6453.2
Applied rewrites53.2%
if -3.9e-24 < x < 1.70000000000000008e-13Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6461.3
Applied rewrites61.3%
if 1.70000000000000008e-13 < x Initial program 98.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.7
Applied rewrites42.7%
Final simplification54.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* x z) 2.0)))
(if (<= z -2.05e+94)
t_1
(if (<= z -1.25e-299) (* x t) (if (<= z 4.95e+17) (* 5.0 y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * z) * 2.0;
double tmp;
if (z <= -2.05e+94) {
tmp = t_1;
} else if (z <= -1.25e-299) {
tmp = x * t;
} else if (z <= 4.95e+17) {
tmp = 5.0 * y;
} 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.05d+94)) then
tmp = t_1
else if (z <= (-1.25d-299)) then
tmp = x * t
else if (z <= 4.95d+17) then
tmp = 5.0d0 * y
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.05e+94) {
tmp = t_1;
} else if (z <= -1.25e-299) {
tmp = x * t;
} else if (z <= 4.95e+17) {
tmp = 5.0 * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * z) * 2.0 tmp = 0 if z <= -2.05e+94: tmp = t_1 elif z <= -1.25e-299: tmp = x * t elif z <= 4.95e+17: tmp = 5.0 * y 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.05e+94) tmp = t_1; elseif (z <= -1.25e-299) tmp = Float64(x * t); elseif (z <= 4.95e+17) tmp = Float64(5.0 * y); 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.05e+94) tmp = t_1; elseif (z <= -1.25e-299) tmp = x * t; elseif (z <= 4.95e+17) tmp = 5.0 * y; 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.05e+94], t$95$1, If[LessEqual[z, -1.25e-299], N[(x * t), $MachinePrecision], If[LessEqual[z, 4.95e+17], N[(5.0 * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot z\right) \cdot 2\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-299}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;z \leq 4.95 \cdot 10^{+17}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.05000000000000015e94 or 4.95e17 < z Initial program 99.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6458.8
Applied rewrites58.8%
if -2.05000000000000015e94 < z < -1.24999999999999989e-299Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6448.2
Applied rewrites48.2%
if -1.24999999999999989e-299 < z < 4.95e17Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6452.0
Applied rewrites52.0%
Final simplification53.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma (+ z y) 2.0 t) x)))
(if (<= x -9.2e-17)
t_1
(if (<= x 3.5e-13) (fma y 5.0 (* (* z 2.0) x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z + y), 2.0, t) * x;
double tmp;
if (x <= -9.2e-17) {
tmp = t_1;
} else if (x <= 3.5e-13) {
tmp = fma(y, 5.0, ((z * 2.0) * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(z + y), 2.0, t) * x) tmp = 0.0 if (x <= -9.2e-17) tmp = t_1; elseif (x <= 3.5e-13) tmp = fma(y, 5.0, Float64(Float64(z * 2.0) * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9.2e-17], t$95$1, If[LessEqual[x, 3.5e-13], N[(y * 5.0 + N[(N[(z * 2.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z + y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \left(z \cdot 2\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.20000000000000035e-17 or 3.5000000000000002e-13 < x Initial program 99.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6498.4
Applied rewrites98.4%
if -9.20000000000000035e-17 < x < 3.5000000000000002e-13Initial program 99.8%
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.8
Applied rewrites99.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f6482.7
Applied rewrites82.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma (+ z y) 2.0 t) x))) (if (<= x -6.1e-81) t_1 (if (<= x 1.85e-13) (fma y 5.0 (* x t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((z + y), 2.0, t) * x;
double tmp;
if (x <= -6.1e-81) {
tmp = t_1;
} else if (x <= 1.85e-13) {
tmp = fma(y, 5.0, (x * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(Float64(z + y), 2.0, t) * x) tmp = 0.0 if (x <= -6.1e-81) tmp = t_1; elseif (x <= 1.85e-13) 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[(N[(N[(z + y), $MachinePrecision] * 2.0 + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -6.1e-81], t$95$1, If[LessEqual[x, 1.85e-13], N[(y * 5.0 + N[(x * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z + y, 2, t\right) \cdot x\\
\mathbf{if}\;x \leq -6.1 \cdot 10^{-81}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-13}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.1000000000000002e-81 or 1.84999999999999994e-13 < x Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.7
Applied rewrites95.7%
if -6.1000000000000002e-81 < x < 1.84999999999999994e-13Initial program 99.8%
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.8
Applied rewrites99.8%
Taylor expanded in t around inf
lower-*.f6478.9
Applied rewrites78.9%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma 2.0 x 5.0) y))) (if (<= y -1.15e+37) t_1 (if (<= y 1.75e+38) (* (fma z 2.0 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 <= -1.15e+37) {
tmp = t_1;
} else if (y <= 1.75e+38) {
tmp = fma(z, 2.0, 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 <= -1.15e+37) tmp = t_1; elseif (y <= 1.75e+38) tmp = Float64(fma(z, 2.0, 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, -1.15e+37], t$95$1, If[LessEqual[y, 1.75e+38], N[(N[(z * 2.0 + 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 -1.15 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(z, 2, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.15000000000000001e37 or 1.75000000000000001e38 < y Initial program 99.1%
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.f6481.5
Applied rewrites81.5%
if -1.15000000000000001e37 < y < 1.75000000000000001e38Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6481.1
Applied rewrites81.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.9e-24) (* x t) (if (<= x 6.5e-9) (* 5.0 y) (* x t))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.9e-24) {
tmp = x * t;
} else if (x <= 6.5e-9) {
tmp = 5.0 * y;
} 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 <= (-3.9d-24)) then
tmp = x * t
else if (x <= 6.5d-9) then
tmp = 5.0d0 * y
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 <= -3.9e-24) {
tmp = x * t;
} else if (x <= 6.5e-9) {
tmp = 5.0 * y;
} else {
tmp = x * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.9e-24: tmp = x * t elif x <= 6.5e-9: tmp = 5.0 * y else: tmp = x * t return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.9e-24) tmp = Float64(x * t); elseif (x <= 6.5e-9) tmp = Float64(5.0 * y); else tmp = Float64(x * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.9e-24) tmp = x * t; elseif (x <= 6.5e-9) tmp = 5.0 * y; else tmp = x * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.9e-24], N[(x * t), $MachinePrecision], If[LessEqual[x, 6.5e-9], N[(5.0 * y), $MachinePrecision], N[(x * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-24}:\\
\;\;\;\;x \cdot t\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-9}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\\
\end{array}
\end{array}
if x < -3.9e-24 or 6.5000000000000003e-9 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6440.1
Applied rewrites40.1%
if -3.9e-24 < x < 6.5000000000000003e-9Initial program 99.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f6460.3
Applied rewrites60.3%
Final simplification49.8%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
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 * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 99.6%
Taylor expanded in t around inf
lower-*.f6429.5
Applied rewrites29.5%
Final simplification29.5%
herbie shell --seed 2024255
(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)))