
(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 14 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 (+ y z) t) x)))
double code(double x, double y, double z, double t) {
return fma(y, 5.0, (fma(2.0, (y + z), t) * x));
}
function code(x, y, z, t) return fma(y, 5.0, Float64(fma(2.0, Float64(y + z), t) * x)) end
code[x_, y_, z_, t_] := N[(y * 5.0 + N[(N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, 5, \mathsf{fma}\left(2, y + z, t\right) \cdot x\right)
\end{array}
Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites99.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
associate-+r+N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lift-fma.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* 2.0 z))))
(if (<= x -3.4e+262)
(* t x)
(if (<= x -3.5e+31)
(* x (* y 2.0))
(if (<= x -4.8e-67)
t_1
(if (<= x 1e-12) (* y 5.0) (if (<= x 1.9e+105) (* t x) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (2.0 * z);
double tmp;
if (x <= -3.4e+262) {
tmp = t * x;
} else if (x <= -3.5e+31) {
tmp = x * (y * 2.0);
} else if (x <= -4.8e-67) {
tmp = t_1;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else if (x <= 1.9e+105) {
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 * (2.0d0 * z)
if (x <= (-3.4d+262)) then
tmp = t * x
else if (x <= (-3.5d+31)) then
tmp = x * (y * 2.0d0)
else if (x <= (-4.8d-67)) then
tmp = t_1
else if (x <= 1d-12) then
tmp = y * 5.0d0
else if (x <= 1.9d+105) 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 * (2.0 * z);
double tmp;
if (x <= -3.4e+262) {
tmp = t * x;
} else if (x <= -3.5e+31) {
tmp = x * (y * 2.0);
} else if (x <= -4.8e-67) {
tmp = t_1;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else if (x <= 1.9e+105) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (2.0 * z) tmp = 0 if x <= -3.4e+262: tmp = t * x elif x <= -3.5e+31: tmp = x * (y * 2.0) elif x <= -4.8e-67: tmp = t_1 elif x <= 1e-12: tmp = y * 5.0 elif x <= 1.9e+105: tmp = t * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(2.0 * z)) tmp = 0.0 if (x <= -3.4e+262) tmp = Float64(t * x); elseif (x <= -3.5e+31) tmp = Float64(x * Float64(y * 2.0)); elseif (x <= -4.8e-67) tmp = t_1; elseif (x <= 1e-12) tmp = Float64(y * 5.0); elseif (x <= 1.9e+105) tmp = Float64(t * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (2.0 * z); tmp = 0.0; if (x <= -3.4e+262) tmp = t * x; elseif (x <= -3.5e+31) tmp = x * (y * 2.0); elseif (x <= -4.8e-67) tmp = t_1; elseif (x <= 1e-12) tmp = y * 5.0; elseif (x <= 1.9e+105) tmp = t * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e+262], N[(t * x), $MachinePrecision], If[LessEqual[x, -3.5e+31], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-67], t$95$1, If[LessEqual[x, 1e-12], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.9e+105], N[(t * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(2 \cdot z\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+262}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq -3.5 \cdot 10^{+31}:\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-12}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+105}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.4000000000000002e262 or 9.9999999999999998e-13 < x < 1.9e105Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6459.0
Applied rewrites59.0%
if -3.4000000000000002e262 < x < -3.5e31Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites50.4%
if -3.5e31 < x < -4.8e-67 or 1.9e105 < x Initial program 100.0%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6447.6
Applied rewrites47.6%
if -4.8e-67 < x < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6467.3
Applied rewrites67.3%
Final simplification57.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (* y 2.0))))
(if (<= x -3.4e+262)
(* t x)
(if (<= x -680000000000.0)
t_1
(if (<= x -2.55e-24)
(* t x)
(if (<= x 1e-12) (* y 5.0) (if (<= x 1.02e+99) (* 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 <= -3.4e+262) {
tmp = t * x;
} else if (x <= -680000000000.0) {
tmp = t_1;
} else if (x <= -2.55e-24) {
tmp = t * x;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else if (x <= 1.02e+99) {
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 <= (-3.4d+262)) then
tmp = t * x
else if (x <= (-680000000000.0d0)) then
tmp = t_1
else if (x <= (-2.55d-24)) then
tmp = t * x
else if (x <= 1d-12) then
tmp = y * 5.0d0
else if (x <= 1.02d+99) 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 <= -3.4e+262) {
tmp = t * x;
} else if (x <= -680000000000.0) {
tmp = t_1;
} else if (x <= -2.55e-24) {
tmp = t * x;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else if (x <= 1.02e+99) {
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 <= -3.4e+262: tmp = t * x elif x <= -680000000000.0: tmp = t_1 elif x <= -2.55e-24: tmp = t * x elif x <= 1e-12: tmp = y * 5.0 elif x <= 1.02e+99: tmp = t * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y * 2.0)) tmp = 0.0 if (x <= -3.4e+262) tmp = Float64(t * x); elseif (x <= -680000000000.0) tmp = t_1; elseif (x <= -2.55e-24) tmp = Float64(t * x); elseif (x <= 1e-12) tmp = Float64(y * 5.0); elseif (x <= 1.02e+99) 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 <= -3.4e+262) tmp = t * x; elseif (x <= -680000000000.0) tmp = t_1; elseif (x <= -2.55e-24) tmp = t * x; elseif (x <= 1e-12) tmp = y * 5.0; elseif (x <= 1.02e+99) tmp = t * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e+262], N[(t * x), $MachinePrecision], If[LessEqual[x, -680000000000.0], t$95$1, If[LessEqual[x, -2.55e-24], N[(t * x), $MachinePrecision], If[LessEqual[x, 1e-12], N[(y * 5.0), $MachinePrecision], If[LessEqual[x, 1.02e+99], N[(t * x), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot 2\right)\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{+262}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq -680000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.55 \cdot 10^{-24}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 10^{-12}:\\
\;\;\;\;y \cdot 5\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{+99}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.4000000000000002e262 or -6.8e11 < x < -2.55000000000000013e-24 or 9.9999999999999998e-13 < x < 1.01999999999999998e99Initial program 99.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
if -3.4000000000000002e262 < x < -6.8e11 or 1.01999999999999998e99 < 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.9
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites47.0%
if -2.55000000000000013e-24 < x < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6464.8
Applied rewrites64.8%
Final simplification56.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ y z) t) x)))
(if (<= x -2.5e-24)
t_1
(if (<= x 8.4e-156)
(fma y 5.0 (* x (+ z z)))
(if (<= x 3.05e-21) (fma t x (* y 5.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (y + z), t) * x;
double tmp;
if (x <= -2.5e-24) {
tmp = t_1;
} else if (x <= 8.4e-156) {
tmp = fma(y, 5.0, (x * (z + z)));
} else if (x <= 3.05e-21) {
tmp = fma(t, x, (y * 5.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(y + z), t) * x) tmp = 0.0 if (x <= -2.5e-24) tmp = t_1; elseif (x <= 8.4e-156) tmp = fma(y, 5.0, Float64(x * Float64(z + z))); elseif (x <= 3.05e-21) tmp = fma(t, x, Float64(y * 5.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -2.5e-24], t$95$1, If[LessEqual[x, 8.4e-156], N[(y * 5.0 + N[(x * N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.05e-21], N[(t * x + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, y + z, t\right) \cdot x\\
\mathbf{if}\;x \leq -2.5 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.4 \cdot 10^{-156}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(z + z\right)\right)\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(t, x, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.4999999999999999e-24 or 3.05000000000000007e-21 < x Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6498.1
Applied rewrites98.1%
if -2.4999999999999999e-24 < x < 8.40000000000000049e-156Initial program 99.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6486.5
Applied rewrites86.5%
Applied rewrites86.5%
if 8.40000000000000049e-156 < x < 3.05000000000000007e-21Initial program 100.0%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.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-fma.f64N/A
*-commutativeN/A
lower-*.f6494.0
Applied rewrites94.0%
Final simplification93.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z (+ z t)))))
(if (<= x -9e+30)
(* x (fma 2.0 y t))
(if (<= x -4.8e-67) t_1 (if (<= x 3.05e-21) (fma y 5.0 (* t x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + (z + t));
double tmp;
if (x <= -9e+30) {
tmp = x * fma(2.0, y, t);
} else if (x <= -4.8e-67) {
tmp = t_1;
} else if (x <= 3.05e-21) {
tmp = fma(y, 5.0, (t * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(z + Float64(z + t))) tmp = 0.0 if (x <= -9e+30) tmp = Float64(x * fma(2.0, y, t)); elseif (x <= -4.8e-67) tmp = t_1; elseif (x <= 3.05e-21) tmp = fma(y, 5.0, Float64(t * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+30], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-67], t$95$1, If[LessEqual[x, 3.05e-21], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + \left(z + t\right)\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e30Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -8.9999999999999999e30 < x < -4.8e-67 or 3.05000000000000007e-21 < x Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6474.8
Applied rewrites74.8%
Applied rewrites74.8%
if -4.8e-67 < x < 3.05000000000000007e-21Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites99.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
associate-+r+N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lift-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification80.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z (+ z t)))))
(if (<= x -9e+30)
(* x (fma 2.0 y t))
(if (<= x -4.8e-67) t_1 (if (<= x 3.05e-21) (fma t x (* y 5.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + (z + t));
double tmp;
if (x <= -9e+30) {
tmp = x * fma(2.0, y, t);
} else if (x <= -4.8e-67) {
tmp = t_1;
} else if (x <= 3.05e-21) {
tmp = fma(t, x, (y * 5.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(z + Float64(z + t))) tmp = 0.0 if (x <= -9e+30) tmp = Float64(x * fma(2.0, y, t)); elseif (x <= -4.8e-67) tmp = t_1; elseif (x <= 3.05e-21) tmp = fma(t, x, Float64(y * 5.0)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+30], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -4.8e-67], t$95$1, If[LessEqual[x, 3.05e-21], N[(t * x + N[(y * 5.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + \left(z + t\right)\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{elif}\;x \leq -4.8 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(t, x, y \cdot 5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e30Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -8.9999999999999999e30 < x < -4.8e-67 or 3.05000000000000007e-21 < x Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6474.8
Applied rewrites74.8%
Applied rewrites74.8%
if -4.8e-67 < x < 3.05000000000000007e-21Initial program 99.9%
lift-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.9
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
flip-+N/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
+-inversesN/A
flip-+N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification80.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -9e+30)
(* x (fma 2.0 y t))
(if (<= x -7.3e-180)
(* x (fma 2.0 z t))
(if (<= x 2.4e-62) (* y 5.0) (* x (+ z (+ z t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -9e+30) {
tmp = x * fma(2.0, y, t);
} else if (x <= -7.3e-180) {
tmp = x * fma(2.0, z, t);
} else if (x <= 2.4e-62) {
tmp = y * 5.0;
} else {
tmp = x * (z + (z + t));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= -9e+30) tmp = Float64(x * fma(2.0, y, t)); elseif (x <= -7.3e-180) tmp = Float64(x * fma(2.0, z, t)); elseif (x <= 2.4e-62) tmp = Float64(y * 5.0); else tmp = Float64(x * Float64(z + Float64(z + t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, -9e+30], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.3e-180], N[(x * N[(2.0 * z + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e-62], N[(y * 5.0), $MachinePrecision], N[(x * N[(z + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{elif}\;x \leq -7.3 \cdot 10^{-180}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-62}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z + \left(z + t\right)\right)\\
\end{array}
\end{array}
if x < -8.9999999999999999e30Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -8.9999999999999999e30 < x < -7.2999999999999996e-180Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6465.6
Applied rewrites65.6%
if -7.2999999999999996e-180 < x < 2.39999999999999984e-62Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6479.0
Applied rewrites79.0%
if 2.39999999999999984e-62 < x Initial program 100.0%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.9
Applied rewrites72.9%
Applied rewrites72.9%
Final simplification74.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (+ z (+ z t)))))
(if (<= x -9e+30)
(* x (fma 2.0 y t))
(if (<= x -7.3e-180) t_1 (if (<= x 2.4e-62) (* y 5.0) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (z + (z + t));
double tmp;
if (x <= -9e+30) {
tmp = x * fma(2.0, y, t);
} else if (x <= -7.3e-180) {
tmp = t_1;
} else if (x <= 2.4e-62) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(z + Float64(z + t))) tmp = 0.0 if (x <= -9e+30) tmp = Float64(x * fma(2.0, y, t)); elseif (x <= -7.3e-180) tmp = t_1; elseif (x <= 2.4e-62) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(z + N[(z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9e+30], N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.3e-180], t$95$1, If[LessEqual[x, 2.4e-62], N[(y * 5.0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(z + \left(z + t\right)\right)\\
\mathbf{if}\;x \leq -9 \cdot 10^{+30}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{elif}\;x \leq -7.3 \cdot 10^{-180}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-62}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -8.9999999999999999e30Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites77.0%
if -8.9999999999999999e30 < x < -7.2999999999999996e-180 or 2.39999999999999984e-62 < x Initial program 99.9%
Taylor expanded in y around 0
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6470.0
Applied rewrites70.0%
Applied rewrites70.0%
if -7.2999999999999996e-180 < x < 2.39999999999999984e-62Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6479.0
Applied rewrites79.0%
Final simplification74.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ y z) t) x)))
(if (<= x -80.0)
t_1
(if (<= x 6.2e-10) (fma y 5.0 (* x (+ t (+ z z)))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (y + z), t) * x;
double tmp;
if (x <= -80.0) {
tmp = t_1;
} else if (x <= 6.2e-10) {
tmp = fma(y, 5.0, (x * (t + (z + z))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(y + z), t) * x) tmp = 0.0 if (x <= -80.0) tmp = t_1; elseif (x <= 6.2e-10) tmp = fma(y, 5.0, Float64(x * Float64(t + Float64(z + z)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -80.0], t$95$1, If[LessEqual[x, 6.2e-10], N[(y * 5.0 + N[(x * N[(t + N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, y + z, t\right) \cdot x\\
\mathbf{if}\;x \leq -80:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-10}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, x \cdot \left(t + \left(z + z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -80 or 6.2000000000000003e-10 < x Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6499.3
Applied rewrites99.3%
if -80 < x < 6.2000000000000003e-10Initial 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.4
Applied rewrites99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (fma 2.0 (+ y z) t) x))) (if (<= x -4.8e-67) t_1 (if (<= x 3.05e-21) (fma y 5.0 (* t x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(2.0, (y + z), t) * x;
double tmp;
if (x <= -4.8e-67) {
tmp = t_1;
} else if (x <= 3.05e-21) {
tmp = fma(y, 5.0, (t * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(fma(2.0, Float64(y + z), t) * x) tmp = 0.0 if (x <= -4.8e-67) tmp = t_1; elseif (x <= 3.05e-21) tmp = fma(y, 5.0, Float64(t * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(2.0 * N[(y + z), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -4.8e-67], t$95$1, If[LessEqual[x, 3.05e-21], N[(y * 5.0 + N[(t * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(2, y + z, t\right) \cdot x\\
\mathbf{if}\;x \leq -4.8 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, t \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.8e-67 or 3.05000000000000007e-21 < x Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6495.1
Applied rewrites95.1%
if -4.8e-67 < x < 3.05000000000000007e-21Initial program 99.9%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lower-+.f64N/A
Applied rewrites99.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
associate-+r+N/A
lift-+.f64N/A
lift-+.f64N/A
associate-+r+N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-+.f64N/A
count-2N/A
lift-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (fma x 2.0 5.0)))) (if (<= y -2.55e-68) t_1 (if (<= y 1.4e+88) (* 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 <= -2.55e-68) {
tmp = t_1;
} else if (y <= 1.4e+88) {
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 <= -2.55e-68) tmp = t_1; elseif (y <= 1.4e+88) 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, -2.55e-68], t$95$1, If[LessEqual[y, 1.4e+88], 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 -2.55 \cdot 10^{-68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+88}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(2, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.54999999999999983e-68 or 1.39999999999999994e88 < y Initial program 99.9%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
lower-*.f64N/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6476.5
Applied rewrites76.5%
if -2.54999999999999983e-68 < y < 1.39999999999999994e88Initial program 99.9%
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 t)))) (if (<= x -2.55e-24) t_1 (if (<= x 1e-12) (* y 5.0) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * fma(2.0, y, t);
double tmp;
if (x <= -2.55e-24) {
tmp = t_1;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * fma(2.0, y, t)) tmp = 0.0 if (x <= -2.55e-24) tmp = t_1; elseif (x <= 1e-12) tmp = Float64(y * 5.0); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(2.0 * y + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.55e-24], t$95$1, If[LessEqual[x, 1e-12], N[(y * 5.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \mathsf{fma}\left(2, y, t\right)\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-12}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.55000000000000013e-24 or 9.9999999999999998e-13 < x Initial program 99.9%
Taylor expanded in x around inf
lower-*.f64N/A
+-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f6498.7
Applied rewrites98.7%
Taylor expanded in z around 0
Applied rewrites70.6%
if -2.55000000000000013e-24 < x < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6464.8
Applied rewrites64.8%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (if (<= x -2.55e-24) (* t x) (if (<= x 1e-12) (* y 5.0) (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.55e-24) {
tmp = t * x;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} 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 <= (-2.55d-24)) then
tmp = t * x
else if (x <= 1d-12) then
tmp = y * 5.0d0
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 <= -2.55e-24) {
tmp = t * x;
} else if (x <= 1e-12) {
tmp = y * 5.0;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.55e-24: tmp = t * x elif x <= 1e-12: tmp = y * 5.0 else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.55e-24) tmp = Float64(t * x); elseif (x <= 1e-12) tmp = Float64(y * 5.0); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.55e-24) tmp = t * x; elseif (x <= 1e-12) tmp = y * 5.0; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.55e-24], N[(t * x), $MachinePrecision], If[LessEqual[x, 1e-12], N[(y * 5.0), $MachinePrecision], N[(t * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.55 \cdot 10^{-24}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq 10^{-12}:\\
\;\;\;\;y \cdot 5\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -2.55000000000000013e-24 or 9.9999999999999998e-13 < x Initial program 99.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6437.9
Applied rewrites37.9%
if -2.55000000000000013e-24 < x < 9.9999999999999998e-13Initial program 99.9%
Taylor expanded in x around 0
lower-*.f6464.8
Applied rewrites64.8%
Final simplification50.2%
(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-*.f6431.2
Applied rewrites31.2%
Final simplification31.2%
herbie shell --seed 2024233
(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)))