
(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 100.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
lift-+.f64N/A
lift-fma.f64N/A
+-commutativeN/A
count-2-revN/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-+l+N/A
+-commutativeN/A
count-2N/A
lower-fma.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* x y) 2.0)))
(if (<= x -6.2e+255)
t_1
(if (<= x -4.2e-27)
(* t x)
(if (<= x 2e-14) (* 5.0 y) (if (<= x 2.05e+114) (* t x) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * y) * 2.0;
double tmp;
if (x <= -6.2e+255) {
tmp = t_1;
} else if (x <= -4.2e-27) {
tmp = t * x;
} else if (x <= 2e-14) {
tmp = 5.0 * y;
} else if (x <= 2.05e+114) {
tmp = t * x;
} 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 * y) * 2.0d0
if (x <= (-6.2d+255)) then
tmp = t_1
else if (x <= (-4.2d-27)) then
tmp = t * x
else if (x <= 2d-14) then
tmp = 5.0d0 * y
else if (x <= 2.05d+114) then
tmp = t * x
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 * y) * 2.0;
double tmp;
if (x <= -6.2e+255) {
tmp = t_1;
} else if (x <= -4.2e-27) {
tmp = t * x;
} else if (x <= 2e-14) {
tmp = 5.0 * y;
} else if (x <= 2.05e+114) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * y) * 2.0 tmp = 0 if x <= -6.2e+255: tmp = t_1 elif x <= -4.2e-27: tmp = t * x elif x <= 2e-14: tmp = 5.0 * y elif x <= 2.05e+114: tmp = t * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * y) * 2.0) tmp = 0.0 if (x <= -6.2e+255) tmp = t_1; elseif (x <= -4.2e-27) tmp = Float64(t * x); elseif (x <= 2e-14) tmp = Float64(5.0 * y); elseif (x <= 2.05e+114) tmp = Float64(t * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * y) * 2.0; tmp = 0.0; if (x <= -6.2e+255) tmp = t_1; elseif (x <= -4.2e-27) tmp = t * x; elseif (x <= 2e-14) tmp = 5.0 * y; elseif (x <= 2.05e+114) tmp = t * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[x, -6.2e+255], t$95$1, If[LessEqual[x, -4.2e-27], N[(t * x), $MachinePrecision], If[LessEqual[x, 2e-14], N[(5.0 * y), $MachinePrecision], If[LessEqual[x, 2.05e+114], N[(t * x), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot 2\\
\mathbf{if}\;x \leq -6.2 \cdot 10^{+255}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-27}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-14}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+114}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -6.2000000000000004e255 or 2.05e114 < x Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6465.0
Applied rewrites65.0%
Taylor expanded in x around inf
Applied rewrites65.0%
if -6.2000000000000004e255 < x < -4.20000000000000031e-27 or 2e-14 < x < 2.05e114Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6450.5
Applied rewrites50.5%
if -4.20000000000000031e-27 < x < 2e-14Initial program 100.0%
Taylor expanded in x around 0
lower-*.f6461.0
Applied rewrites61.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ (+ x 5.0) x) y)))
(if (<= y -8.2e-31)
t_1
(if (<= y 6.8e-34) (* (* z x) 2.0) (if (<= y 8.5e+59) (* t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = ((x + 5.0) + x) * y;
double tmp;
if (y <= -8.2e-31) {
tmp = t_1;
} else if (y <= 6.8e-34) {
tmp = (z * x) * 2.0;
} else if (y <= 8.5e+59) {
tmp = t * x;
} 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 + 5.0d0) + x) * y
if (y <= (-8.2d-31)) then
tmp = t_1
else if (y <= 6.8d-34) then
tmp = (z * x) * 2.0d0
else if (y <= 8.5d+59) then
tmp = t * x
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 + 5.0) + x) * y;
double tmp;
if (y <= -8.2e-31) {
tmp = t_1;
} else if (y <= 6.8e-34) {
tmp = (z * x) * 2.0;
} else if (y <= 8.5e+59) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((x + 5.0) + x) * y tmp = 0 if y <= -8.2e-31: tmp = t_1 elif y <= 6.8e-34: tmp = (z * x) * 2.0 elif y <= 8.5e+59: tmp = t * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x + 5.0) + x) * y) tmp = 0.0 if (y <= -8.2e-31) tmp = t_1; elseif (y <= 6.8e-34) tmp = Float64(Float64(z * x) * 2.0); elseif (y <= 8.5e+59) tmp = Float64(t * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((x + 5.0) + x) * y; tmp = 0.0; if (y <= -8.2e-31) tmp = t_1; elseif (y <= 6.8e-34) tmp = (z * x) * 2.0; elseif (y <= 8.5e+59) tmp = t * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x + 5.0), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -8.2e-31], t$95$1, If[LessEqual[y, 6.8e-34], N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[y, 8.5e+59], N[(t * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + 5\right) + x\right) \cdot y\\
\mathbf{if}\;y \leq -8.2 \cdot 10^{-31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-34}:\\
\;\;\;\;\left(z \cdot x\right) \cdot 2\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+59}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -8.1999999999999993e-31 or 8.4999999999999999e59 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6479.4
Applied rewrites79.4%
Applied rewrites79.4%
if -8.1999999999999993e-31 < y < 6.8000000000000001e-34Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6451.6
Applied rewrites51.6%
if 6.8000000000000001e-34 < y < 8.4999999999999999e59Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6463.0
Applied rewrites63.0%
Final simplification67.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -800000.0)
t_1
(if (<= x 2.5) (fma (fma 2.0 z t) x (* 5.0 y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (z + y), t) * x;
double tmp;
if (x <= -800000.0) {
tmp = t_1;
} else if (x <= 2.5) {
tmp = fma(fma(2.0, z, t), x, (5.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(z + y), t) * x) tmp = 0.0 if (x <= -800000.0) tmp = t_1; elseif (x <= 2.5) tmp = fma(fma(2.0, z, 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 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -800000.0], t$95$1, If[LessEqual[x, 2.5], N[(N[(2.0 * z + 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 + y, t\right) \cdot x\\
\mathbf{if}\;x \leq -800000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(2, z, t\right), x, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8e5 or 2.5 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6442.2
Applied rewrites42.2%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6498.7
Applied rewrites98.7%
if -8e5 < x < 2.5Initial program 99.9%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.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
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.2
Applied rewrites99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -800000.0)
t_1
(if (<= x 2.5) (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(2.0, (z + y), t) * x;
double tmp;
if (x <= -800000.0) {
tmp = t_1;
} else if (x <= 2.5) {
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(2.0, Float64(z + y), t) * x) tmp = 0.0 if (x <= -800000.0) tmp = t_1; elseif (x <= 2.5) 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[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -800000.0], t$95$1, If[LessEqual[x, 2.5], 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(2, z + y, t\right) \cdot x\\
\mathbf{if}\;x \leq -800000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5:\\
\;\;\;\;\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 < -8e5 or 2.5 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6442.2
Applied rewrites42.2%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6498.7
Applied rewrites98.7%
if -8e5 < 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%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -4.5e-27)
t_1
(if (<= x 1.26e-14) (fma (+ x x) z (* 5.0 y)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (z + y), t) * x;
double tmp;
if (x <= -4.5e-27) {
tmp = t_1;
} else if (x <= 1.26e-14) {
tmp = fma((x + x), z, (5.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(z + y), t) * x) tmp = 0.0 if (x <= -4.5e-27) tmp = t_1; elseif (x <= 1.26e-14) tmp = fma(Float64(x + x), z, 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 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4.5e-27], t$95$1, If[LessEqual[x, 1.26e-14], N[(N[(x + x), $MachinePrecision] * z + N[(5.0 * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{-27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.26 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(x + x, z, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.5000000000000002e-27 or 1.25999999999999996e-14 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6442.5
Applied rewrites42.5%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6497.4
Applied rewrites97.4%
if -4.5000000000000002e-27 < x < 1.25999999999999996e-14Initial program 100.0%
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.9
Applied rewrites99.9%
Taylor expanded in t around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6484.8
Applied rewrites84.8%
Applied rewrites84.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.9e+61) (fma (+ x 5.0) y (* x y)) (if (<= y 1.9e+86) (* (fma 2.0 (+ z y) t) x) (* (+ (+ x 5.0) x) y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.9e+61) {
tmp = fma((x + 5.0), y, (x * y));
} else if (y <= 1.9e+86) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = ((x + 5.0) + x) * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -2.9e+61) tmp = fma(Float64(x + 5.0), y, Float64(x * y)); elseif (y <= 1.9e+86) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = Float64(Float64(Float64(x + 5.0) + x) * y); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.9e+61], N[(N[(x + 5.0), $MachinePrecision] * y + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+86], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(x + 5.0), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(x + 5, y, x \cdot y\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + 5\right) + x\right) \cdot y\\
\end{array}
\end{array}
if y < -2.9000000000000001e61Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6482.9
Applied rewrites82.9%
Applied rewrites82.9%
Applied rewrites82.9%
if -2.9000000000000001e61 < y < 1.89999999999999989e86Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6440.7
Applied rewrites40.7%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6486.5
Applied rewrites86.5%
if 1.89999999999999989e86 < y Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6491.0
Applied rewrites91.0%
Applied rewrites91.1%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ (+ x 5.0) x) y))) (if (<= y -2.9e+61) t_1 (if (<= y 1.9e+86) (* (fma 2.0 (+ z y) t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x + 5.0) + x) * y;
double tmp;
if (y <= -2.9e+61) {
tmp = t_1;
} else if (y <= 1.9e+86) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x + 5.0) + x) * y) tmp = 0.0 if (y <= -2.9e+61) tmp = t_1; elseif (y <= 1.9e+86) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x + 5.0), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -2.9e+61], t$95$1, If[LessEqual[y, 1.9e+86], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + 5\right) + x\right) \cdot y\\
\mathbf{if}\;y \leq -2.9 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.9000000000000001e61 or 1.89999999999999989e86 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6487.0
Applied rewrites87.0%
Applied rewrites87.0%
if -2.9000000000000001e61 < y < 1.89999999999999989e86Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6440.7
Applied rewrites40.7%
Taylor expanded in x around inf
*-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6486.5
Applied rewrites86.5%
Final simplification86.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (+ (+ x 5.0) x) y))) (if (<= y -4.6e+49) t_1 (if (<= y 4.6e+77) (* (fma 2.0 z t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x + 5.0) + x) * y;
double tmp;
if (y <= -4.6e+49) {
tmp = t_1;
} else if (y <= 4.6e+77) {
tmp = fma(2.0, z, t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x + 5.0) + x) * y) tmp = 0.0 if (y <= -4.6e+49) tmp = t_1; elseif (y <= 4.6e+77) 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[(N[(x + 5.0), $MachinePrecision] + x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.6e+49], t$95$1, If[LessEqual[y, 4.6e+77], N[(N[(2.0 * z + t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + 5\right) + x\right) \cdot y\\
\mathbf{if}\;y \leq -4.6 \cdot 10^{+49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.6 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(2, z, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.60000000000000004e49 or 4.5999999999999999e77 < y Initial program 99.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6485.2
Applied rewrites85.2%
Applied rewrites85.2%
if -4.60000000000000004e49 < y < 4.5999999999999999e77Initial program 100.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6483.9
Applied rewrites83.9%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (<= x -4.2e-27) (* t x) (if (<= x 2e-14) (* 5.0 y) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.2e-27) {
tmp = t * x;
} else if (x <= 2e-14) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
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.2d-27)) then
tmp = t * x
else if (x <= 2d-14) then
tmp = 5.0d0 * y
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.2e-27) {
tmp = t * x;
} else if (x <= 2e-14) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.2e-27: tmp = t * x elif x <= 2e-14: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.2e-27) tmp = Float64(t * x); elseif (x <= 2e-14) tmp = Float64(5.0 * y); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.2e-27) tmp = t * x; elseif (x <= 2e-14) tmp = 5.0 * y; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.2e-27], N[(t * x), $MachinePrecision], If[LessEqual[x, 2e-14], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-27}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-14}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -4.20000000000000031e-27 or 2e-14 < x Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6442.5
Applied rewrites42.5%
if -4.20000000000000031e-27 < x < 2e-14Initial program 100.0%
Taylor expanded in x around 0
lower-*.f6461.0
Applied rewrites61.0%
(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 100.0%
Taylor expanded in x around 0
lower-*.f6431.8
Applied rewrites31.8%
(FPCore (x y z t) :precision binary64 (* 0.0 y))
double code(double x, double y, double z, double t) {
return 0.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 = 0.0d0 * y
end function
public static double code(double x, double y, double z, double t) {
return 0.0 * y;
}
def code(x, y, z, t): return 0.0 * y
function code(x, y, z, t) return Float64(0.0 * y) end
function tmp = code(x, y, z, t) tmp = 0.0 * y; end
code[x_, y_, z_, t_] := N[(0.0 * y), $MachinePrecision]
\begin{array}{l}
\\
0 \cdot y
\end{array}
Initial program 100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6449.9
Applied rewrites49.9%
Taylor expanded in x around inf
Applied rewrites20.1%
Applied rewrites2.3%
Final simplification2.3%
herbie shell --seed 2024298
(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)))