
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (* x (+ (+ (+ (+ y z) z) y) t)) (* y 5.0)))
double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * ((((y + z) + z) + y) + t)) + (y * 5.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x * ((((y + z) + z) + y) + t)) + (y * 5.0);
}
def code(x, y, z, t): return (x * ((((y + z) + z) + y) + t)) + (y * 5.0)
function code(x, y, z, t) return Float64(Float64(x * Float64(Float64(Float64(Float64(y + z) + z) + y) + t)) + Float64(y * 5.0)) end
function tmp = code(x, y, z, t) tmp = (x * ((((y + z) + z) + y) + t)) + (y * 5.0); end
code[x_, y_, z_, t_] := N[(N[(x * N[(N[(N[(N[(y + z), $MachinePrecision] + z), $MachinePrecision] + y), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision] + N[(y * 5.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(\left(\left(y + z\right) + z\right) + y\right) + t\right) + y \cdot 5
\end{array}
(FPCore (x y z t) :precision binary64 (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
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-+.f6497.2
Applied rewrites97.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6497.2
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-+.f64100.0
Applied rewrites100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* z x) 2.0)))
(if (<= x -1.3e+230)
t_1
(if (<= x -2.5e+128)
(* (* x y) 2.0)
(if (<= x -4.25e+43)
(* t x)
(if (<= x -3.4e-48) t_1 (if (<= x 2.9e-86) (* 5.0 y) (* t x))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * x) * 2.0;
double tmp;
if (x <= -1.3e+230) {
tmp = t_1;
} else if (x <= -2.5e+128) {
tmp = (x * y) * 2.0;
} else if (x <= -4.25e+43) {
tmp = t * x;
} else if (x <= -3.4e-48) {
tmp = t_1;
} else if (x <= 2.9e-86) {
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) :: t_1
real(8) :: tmp
t_1 = (z * x) * 2.0d0
if (x <= (-1.3d+230)) then
tmp = t_1
else if (x <= (-2.5d+128)) then
tmp = (x * y) * 2.0d0
else if (x <= (-4.25d+43)) then
tmp = t * x
else if (x <= (-3.4d-48)) then
tmp = t_1
else if (x <= 2.9d-86) 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 t_1 = (z * x) * 2.0;
double tmp;
if (x <= -1.3e+230) {
tmp = t_1;
} else if (x <= -2.5e+128) {
tmp = (x * y) * 2.0;
} else if (x <= -4.25e+43) {
tmp = t * x;
} else if (x <= -3.4e-48) {
tmp = t_1;
} else if (x <= 2.9e-86) {
tmp = 5.0 * y;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * x) * 2.0 tmp = 0 if x <= -1.3e+230: tmp = t_1 elif x <= -2.5e+128: tmp = (x * y) * 2.0 elif x <= -4.25e+43: tmp = t * x elif x <= -3.4e-48: tmp = t_1 elif x <= 2.9e-86: tmp = 5.0 * y else: tmp = t * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * x) * 2.0) tmp = 0.0 if (x <= -1.3e+230) tmp = t_1; elseif (x <= -2.5e+128) tmp = Float64(Float64(x * y) * 2.0); elseif (x <= -4.25e+43) tmp = Float64(t * x); elseif (x <= -3.4e-48) tmp = t_1; elseif (x <= 2.9e-86) tmp = Float64(5.0 * y); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * x) * 2.0; tmp = 0.0; if (x <= -1.3e+230) tmp = t_1; elseif (x <= -2.5e+128) tmp = (x * y) * 2.0; elseif (x <= -4.25e+43) tmp = t * x; elseif (x <= -3.4e-48) tmp = t_1; elseif (x <= 2.9e-86) tmp = 5.0 * y; else tmp = t * x; 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, -1.3e+230], t$95$1, If[LessEqual[x, -2.5e+128], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[x, -4.25e+43], N[(t * x), $MachinePrecision], If[LessEqual[x, -3.4e-48], t$95$1, If[LessEqual[x, 2.9e-86], N[(5.0 * y), $MachinePrecision], N[(t * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot 2\\
\mathbf{if}\;x \leq -1.3 \cdot 10^{+230}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{+128}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{elif}\;x \leq -4.25 \cdot 10^{+43}:\\
\;\;\;\;t \cdot x\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{-48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-86}:\\
\;\;\;\;5 \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if x < -1.2999999999999999e230 or -4.25e43 < x < -3.40000000000000028e-48Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6450.6
Applied rewrites50.6%
if -1.2999999999999999e230 < x < -2.5e128Initial program 99.9%
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-+.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6472.7
Applied rewrites72.7%
Taylor expanded in x around inf
Applied rewrites72.7%
if -2.5e128 < x < -4.25e43 or 2.8999999999999999e-86 < x Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6443.4
Applied rewrites43.4%
if -3.40000000000000028e-48 < x < 2.8999999999999999e-86Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6466.3
Applied rewrites66.3%
Final simplification55.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -4.4e-46)
t_1
(if (<= x -2e-294)
(fma 5.0 y (* t x))
(if (<= x 2.9e-86) (fma y 5.0 (* (* 2.0 z) 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 <= -4.4e-46) {
tmp = t_1;
} else if (x <= -2e-294) {
tmp = fma(5.0, y, (t * x));
} else if (x <= 2.9e-86) {
tmp = fma(y, 5.0, ((2.0 * z) * 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 <= -4.4e-46) tmp = t_1; elseif (x <= -2e-294) tmp = fma(5.0, y, Float64(t * x)); elseif (x <= 2.9e-86) tmp = fma(y, 5.0, Float64(Float64(2.0 * z) * 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, -4.4e-46], t$95$1, If[LessEqual[x, -2e-294], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.9e-86], N[(y * 5.0 + N[(N[(2.0 * z), $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 -4.4 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-294}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(y, 5, \left(2 \cdot z\right) \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.4000000000000002e-46 or 2.8999999999999999e-86 < x Initial program 99.9%
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.5
Applied rewrites95.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6436.4
Applied rewrites36.4%
Taylor expanded in x around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
associate-+r+N/A
associate-+l+N/A
count-2N/A
associate-+r+N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
if -4.4000000000000002e-46 < x < -2.00000000000000003e-294Initial 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.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6485.0
Applied rewrites85.0%
if -2.00000000000000003e-294 < x < 2.8999999999999999e-86Initial program 99.9%
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-+.f6499.9
Applied rewrites99.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f64100.0
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-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
lower-*.f6492.3
Applied rewrites92.3%
Final simplification93.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (fma 2.0 (+ z y) t) x)))
(if (<= x -4.4e-46)
t_1
(if (<= x -2e-294)
(fma 5.0 y (* t x))
(if (<= x 2.9e-86) (fma (* 2.0 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.4e-46) {
tmp = t_1;
} else if (x <= -2e-294) {
tmp = fma(5.0, y, (t * x));
} else if (x <= 2.9e-86) {
tmp = fma((2.0 * 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.4e-46) tmp = t_1; elseif (x <= -2e-294) tmp = fma(5.0, y, Float64(t * x)); elseif (x <= 2.9e-86) tmp = fma(Float64(2.0 * 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.4e-46], t$95$1, If[LessEqual[x, -2e-294], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.9e-86], N[(N[(2.0 * 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.4 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -2 \cdot 10^{-294}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot x, z, 5 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -4.4000000000000002e-46 or 2.8999999999999999e-86 < x Initial program 99.9%
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.5
Applied rewrites95.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6436.4
Applied rewrites36.4%
Taylor expanded in x around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
associate-+r+N/A
associate-+l+N/A
count-2N/A
associate-+r+N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
if -4.4000000000000002e-46 < x < -2.00000000000000003e-294Initial 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.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6485.0
Applied rewrites85.0%
if -2.00000000000000003e-294 < x < 2.8999999999999999e-86Initial 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.9
Applied rewrites99.9%
Taylor expanded in t around 0
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6492.3
Applied rewrites92.3%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -210000.0) (not (<= x 0.08))) (* (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 <= -210000.0) || !(x <= 0.08)) {
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 <= -210000.0) || !(x <= 0.08)) 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, -210000.0], N[Not[LessEqual[x, 0.08]], $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 -210000 \lor \neg \left(x \leq 0.08\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.1e5 or 0.0800000000000000017 < x Initial program 99.9%
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-+.f6494.7
Applied rewrites94.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6438.0
Applied rewrites38.0%
Taylor expanded in x around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
associate-+r+N/A
associate-+l+N/A
count-2N/A
associate-+r+N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
if -2.1e5 < x < 0.0800000000000000017Initial 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.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* z x) 2.0)))
(if (<= z -1.65e+66)
t_1
(if (<= z -4.8e-216) (* 5.0 y) (if (<= z 4e+29) (* t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z * x) * 2.0;
double tmp;
if (z <= -1.65e+66) {
tmp = t_1;
} else if (z <= -4.8e-216) {
tmp = 5.0 * y;
} else if (z <= 4e+29) {
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 = (z * x) * 2.0d0
if (z <= (-1.65d+66)) then
tmp = t_1
else if (z <= (-4.8d-216)) then
tmp = 5.0d0 * y
else if (z <= 4d+29) 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 = (z * x) * 2.0;
double tmp;
if (z <= -1.65e+66) {
tmp = t_1;
} else if (z <= -4.8e-216) {
tmp = 5.0 * y;
} else if (z <= 4e+29) {
tmp = t * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * x) * 2.0 tmp = 0 if z <= -1.65e+66: tmp = t_1 elif z <= -4.8e-216: tmp = 5.0 * y elif z <= 4e+29: tmp = t * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * x) * 2.0) tmp = 0.0 if (z <= -1.65e+66) tmp = t_1; elseif (z <= -4.8e-216) tmp = Float64(5.0 * y); elseif (z <= 4e+29) tmp = Float64(t * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * x) * 2.0; tmp = 0.0; if (z <= -1.65e+66) tmp = t_1; elseif (z <= -4.8e-216) tmp = 5.0 * y; elseif (z <= 4e+29) tmp = t * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * x), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[z, -1.65e+66], t$95$1, If[LessEqual[z, -4.8e-216], N[(5.0 * y), $MachinePrecision], If[LessEqual[z, 4e+29], N[(t * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot x\right) \cdot 2\\
\mathbf{if}\;z \leq -1.65 \cdot 10^{+66}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-216}:\\
\;\;\;\;5 \cdot y\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+29}:\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6500000000000001e66 or 3.99999999999999966e29 < z Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.5
Applied rewrites59.5%
if -1.6500000000000001e66 < z < -4.80000000000000007e-216Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6438.0
Applied rewrites38.0%
if -4.80000000000000007e-216 < z < 3.99999999999999966e29Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6449.4
Applied rewrites49.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e-46) (not (<= x 8.6e-86))) (* (fma 2.0 (+ z y) t) x) (fma 5.0 y (* t x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e-46) || !(x <= 8.6e-86)) {
tmp = fma(2.0, (z + y), t) * x;
} else {
tmp = fma(5.0, y, (t * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e-46) || !(x <= 8.6e-86)) tmp = Float64(fma(2.0, Float64(z + y), t) * x); else tmp = fma(5.0, y, Float64(t * x)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e-46], N[Not[LessEqual[x, 8.6e-86]], $MachinePrecision]], N[(N[(2.0 * N[(z + y), $MachinePrecision] + t), $MachinePrecision] * x), $MachinePrecision], N[(5.0 * y + N[(t * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-46} \lor \neg \left(x \leq 8.6 \cdot 10^{-86}\right):\\
\;\;\;\;\mathsf{fma}\left(2, z + y, t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, y, t \cdot x\right)\\
\end{array}
\end{array}
if x < -4.4000000000000002e-46 or 8.60000000000000026e-86 < x Initial program 99.9%
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.5
Applied rewrites95.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6436.4
Applied rewrites36.4%
Taylor expanded in x around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-lft-outN/A
mul-1-negN/A
remove-double-negN/A
lower-*.f64N/A
associate-+r+N/A
associate-+l+N/A
count-2N/A
associate-+r+N/A
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6495.6
Applied rewrites95.6%
if -4.4000000000000002e-46 < x < 8.60000000000000026e-86Initial 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.9
Applied rewrites99.9%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6483.3
Applied rewrites83.3%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.5e+65) (not (<= y 1.2e+32))) (* (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 <= -8.5e+65) || !(y <= 1.2e+32)) {
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 <= -8.5e+65) || !(y <= 1.2e+32)) 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, -8.5e+65], N[Not[LessEqual[y, 1.2e+32]], $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 -8.5 \cdot 10^{+65} \lor \neg \left(y \leq 1.2 \cdot 10^{+32}\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 < -8.50000000000000075e65 or 1.19999999999999996e32 < 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.f6486.8
Applied rewrites86.8%
if -8.50000000000000075e65 < y < 1.19999999999999996e32Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6477.6
Applied rewrites77.6%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4e-144) (not (<= y 360.0))) (* (fma 2.0 x 5.0) y) (* t x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4e-144) || !(y <= 360.0)) {
tmp = fma(2.0, x, 5.0) * y;
} else {
tmp = t * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((y <= -4e-144) || !(y <= 360.0)) tmp = Float64(fma(2.0, x, 5.0) * y); else tmp = Float64(t * x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4e-144], N[Not[LessEqual[y, 360.0]], $MachinePrecision]], N[(N[(2.0 * x + 5.0), $MachinePrecision] * y), $MachinePrecision], N[(t * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-144} \lor \neg \left(y \leq 360\right):\\
\;\;\;\;\mathsf{fma}\left(2, x, 5\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if y < -3.9999999999999998e-144 or 360 < y Initial program 99.8%
Taylor expanded in y around inf
+-commutativeN/A
metadata-evalN/A
distribute-lft-neg-inN/A
neg-sub0N/A
associate--r-N/A
neg-sub0N/A
*-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.8
Applied rewrites68.8%
if -3.9999999999999998e-144 < y < 360Initial program 100.0%
Taylor expanded in t around inf
lower-*.f6454.8
Applied rewrites54.8%
Final simplification63.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.5e-73) (not (<= x 2.9e-86))) (* t x) (* 5.0 y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.5e-73) || !(x <= 2.9e-86)) {
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 ((x <= (-4.5d-73)) .or. (.not. (x <= 2.9d-86))) 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 ((x <= -4.5e-73) || !(x <= 2.9e-86)) {
tmp = t * x;
} else {
tmp = 5.0 * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.5e-73) or not (x <= 2.9e-86): tmp = t * x else: tmp = 5.0 * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.5e-73) || !(x <= 2.9e-86)) 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 ((x <= -4.5e-73) || ~((x <= 2.9e-86))) tmp = t * x; else tmp = 5.0 * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.5e-73], N[Not[LessEqual[x, 2.9e-86]], $MachinePrecision]], N[(t * x), $MachinePrecision], N[(5.0 * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-73} \lor \neg \left(x \leq 2.9 \cdot 10^{-86}\right):\\
\;\;\;\;t \cdot x\\
\mathbf{else}:\\
\;\;\;\;5 \cdot y\\
\end{array}
\end{array}
if x < -4.5e-73 or 2.8999999999999999e-86 < x Initial program 99.9%
Taylor expanded in t around inf
lower-*.f6437.9
Applied rewrites37.9%
if -4.5e-73 < x < 2.8999999999999999e-86Initial program 99.8%
Taylor expanded in x around 0
lower-*.f6468.0
Applied rewrites68.0%
Final simplification48.5%
(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-*.f6429.2
Applied rewrites29.2%
herbie shell --seed 2024318
(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)))