
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
def code(x, y, z, t, a, b): return ((x + (y * z)) + (t * a)) + ((a * z) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* b (* a z)) (+ (* a t) (+ (* z y) x))))) (if (<= t_1 INFINITY) t_1 (* (fma b z t) a))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (b * (a * z)) + ((a * t) + ((z * y) + x));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(b, z, t) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(b * Float64(a * z)) + Float64(Float64(a * t) + Float64(Float64(z * y) + x))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(b, z, t) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision] + N[(N[(a * t), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot z\right) + \left(a \cdot t + \left(z \cdot y + x\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 99.2%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6491.7
Applied rewrites91.7%
Final simplification98.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (fma b a y) z)))
(if (<= z -0.0175)
t_1
(if (<= z 4.8e+36) (fma t a x) (if (<= z 6.2e+114) (fma z y x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, a, y) * z;
double tmp;
if (z <= -0.0175) {
tmp = t_1;
} else if (z <= 4.8e+36) {
tmp = fma(t, a, x);
} else if (z <= 6.2e+114) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, a, y) * z) tmp = 0.0 if (z <= -0.0175) tmp = t_1; elseif (z <= 4.8e+36) tmp = fma(t, a, x); elseif (z <= 6.2e+114) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -0.0175], t$95$1, If[LessEqual[z, 4.8e+36], N[(t * a + x), $MachinePrecision], If[LessEqual[z, 6.2e+114], N[(z * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{if}\;z \leq -0.0175:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{+36}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+114}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.017500000000000002 or 6.2000000000000001e114 < z Initial program 87.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.2
Applied rewrites83.2%
if -0.017500000000000002 < z < 4.79999999999999985e36Initial program 99.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6472.2
Applied rewrites72.2%
if 4.79999999999999985e36 < z < 6.2000000000000001e114Initial program 91.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma b z t) a x))) (if (<= a -2.5e-65) t_1 (if (<= a 2.75e-47) (fma (fma b a y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(b, z, t), a, x);
double tmp;
if (a <= -2.5e-65) {
tmp = t_1;
} else if (a <= 2.75e-47) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(b, z, t), a, x) tmp = 0.0 if (a <= -2.5e-65) tmp = t_1; elseif (a <= 2.75e-47) tmp = fma(fma(b, a, y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[a, -2.5e-65], t$95$1, If[LessEqual[a, 2.75e-47], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{if}\;a \leq -2.5 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.75 \cdot 10^{-47}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.49999999999999991e-65 or 2.7500000000000001e-47 < a Initial program 89.6%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6489.0
Applied rewrites89.0%
if -2.49999999999999991e-65 < a < 2.7500000000000001e-47Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6494.4
Applied rewrites94.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma b a y) z x))) (if (<= b -3.8e+29) t_1 (if (<= b 1.15e+18) (fma z y (fma t a x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(fma(b, a, y), z, x);
double tmp;
if (b <= -3.8e+29) {
tmp = t_1;
} else if (b <= 1.15e+18) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(b, a, y), z, x) tmp = 0.0 if (b <= -3.8e+29) tmp = t_1; elseif (b <= 1.15e+18) tmp = fma(z, y, fma(t, a, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[b, -3.8e+29], t$95$1, If[LessEqual[b, 1.15e+18], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{if}\;b \leq -3.8 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.79999999999999971e29 or 1.15e18 < b Initial program 94.9%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.0
Applied rewrites88.0%
if -3.79999999999999971e29 < b < 1.15e18Initial program 94.2%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.1
Applied rewrites92.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -1e+64) t_1 (if (<= z 6.6e+115) (fma z y (fma t a x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, a, y) * z;
double tmp;
if (z <= -1e+64) {
tmp = t_1;
} else if (z <= 6.6e+115) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, a, y) * z) tmp = 0.0 if (z <= -1e+64) tmp = t_1; elseif (z <= 6.6e+115) tmp = fma(z, y, fma(t, a, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1e+64], t$95$1, If[LessEqual[z, 6.6e+115], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{if}\;z \leq -1 \cdot 10^{+64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.00000000000000002e64 or 6.6000000000000001e115 < z Initial program 86.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.4
Applied rewrites86.4%
if -1.00000000000000002e64 < z < 6.6000000000000001e115Initial program 98.8%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6485.4
Applied rewrites85.4%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.6e+90) (fma (fma b a y) z (* a t)) (fma a (fma b z t) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.6e+90) {
tmp = fma(fma(b, a, y), z, (a * t));
} else {
tmp = fma(a, fma(b, z, t), fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.6e+90) tmp = fma(fma(b, a, y), z, Float64(a * t)); else tmp = fma(a, fma(b, z, t), fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.6e+90], N[(N[(b * a + y), $MachinePrecision] * z + N[(a * t), $MachinePrecision]), $MachinePrecision], N[(a * N[(b * z + t), $MachinePrecision] + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if z < -3.6e90Initial program 85.6%
Taylor expanded in x around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6491.7
Applied rewrites91.7%
if -3.6e90 < z Initial program 96.6%
lift-+.f64N/A
+-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
associate-+r+N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-outN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f6497.6
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.6
Applied rewrites97.6%
Final simplification96.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b z t) a))) (if (<= a -3.5e-70) t_1 (if (<= a 2.3e-26) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(b, z, t) * a;
double tmp;
if (a <= -3.5e-70) {
tmp = t_1;
} else if (a <= 2.3e-26) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(b, z, t) * a) tmp = 0.0 if (a <= -3.5e-70) tmp = t_1; elseif (a <= 2.3e-26) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -3.5e-70], t$95$1, If[LessEqual[a, 2.3e-26], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{if}\;a \leq -3.5 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{-26}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.49999999999999974e-70 or 2.30000000000000009e-26 < a Initial program 89.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6475.4
Applied rewrites75.4%
if -3.49999999999999974e-70 < a < 2.30000000000000009e-26Initial program 100.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6482.2
Applied rewrites82.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7.5e+205) (fma z y x) (if (<= y 5.5e+27) (fma t a x) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+205) {
tmp = fma(z, y, x);
} else if (y <= 5.5e+27) {
tmp = fma(t, a, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.5e+205) tmp = fma(z, y, x); elseif (y <= 5.5e+27) tmp = fma(t, a, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.5e+205], N[(z * y + x), $MachinePrecision], If[LessEqual[y, 5.5e+27], N[(t * a + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+205}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if y < -7.5000000000000003e205 or 5.49999999999999966e27 < y Initial program 91.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6480.6
Applied rewrites80.6%
if -7.5000000000000003e205 < y < 5.49999999999999966e27Initial program 96.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.8
Applied rewrites62.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7.5e+205) (* z y) (if (<= y 1.2e+119) (fma t a x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+205) {
tmp = z * y;
} else if (y <= 1.2e+119) {
tmp = fma(t, a, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.5e+205) tmp = Float64(z * y); elseif (y <= 1.2e+119) tmp = fma(t, a, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.5e+205], N[(z * y), $MachinePrecision], If[LessEqual[y, 1.2e+119], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+205}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if y < -7.5000000000000003e205 or 1.2e119 < y Initial program 89.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6471.4
Applied rewrites71.4%
if -7.5000000000000003e205 < y < 1.2e119Initial program 96.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.1
Applied rewrites62.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7.5e+205) (* z y) (if (<= y 5.5e+27) (* a t) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+205) {
tmp = z * y;
} else if (y <= 5.5e+27) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-7.5d+205)) then
tmp = z * y
else if (y <= 5.5d+27) then
tmp = a * t
else
tmp = z * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7.5e+205) {
tmp = z * y;
} else if (y <= 5.5e+27) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7.5e+205: tmp = z * y elif y <= 5.5e+27: tmp = a * t else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7.5e+205) tmp = Float64(z * y); elseif (y <= 5.5e+27) tmp = Float64(a * t); else tmp = Float64(z * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -7.5e+205) tmp = z * y; elseif (y <= 5.5e+27) tmp = a * t; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7.5e+205], N[(z * y), $MachinePrecision], If[LessEqual[y, 5.5e+27], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{+205}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+27}:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if y < -7.5000000000000003e205 or 5.49999999999999966e27 < y Initial program 91.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6463.0
Applied rewrites63.0%
if -7.5000000000000003e205 < y < 5.49999999999999966e27Initial program 96.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6431.4
Applied rewrites31.4%
Final simplification42.8%
(FPCore (x y z t a b) :precision binary64 (* a t))
double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a * t
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
def code(x, y, z, t, a, b): return a * t
function code(x, y, z, t, a, b) return Float64(a * t) end
function tmp = code(x, y, z, t, a, b) tmp = a * t; end
code[x_, y_, z_, t_, a_, b_] := N[(a * t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot t
\end{array}
Initial program 94.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6425.8
Applied rewrites25.8%
Final simplification25.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(if (< z -11820553527347888000.0)
t_1
(if (< z 4.7589743188364287e-122)
(+ (* (+ (* b z) t) a) (+ (* z y) x))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (z * ((b * a) + y)) + (x + (t * a))
if (z < (-11820553527347888000.0d0)) then
tmp = t_1
else if (z < 4.7589743188364287d-122) then
tmp = (((b * z) + t) * a) + ((z * y) + x)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * ((b * a) + y)) + (x + (t * a));
double tmp;
if (z < -11820553527347888000.0) {
tmp = t_1;
} else if (z < 4.7589743188364287e-122) {
tmp = (((b * z) + t) * a) + ((z * y) + x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z * ((b * a) + y)) + (x + (t * a)) tmp = 0 if z < -11820553527347888000.0: tmp = t_1 elif z < 4.7589743188364287e-122: tmp = (((b * z) + t) * a) + ((z * y) + x) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(Float64(b * a) + y)) + Float64(x + Float64(t * a))) tmp = 0.0 if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = Float64(Float64(Float64(Float64(b * z) + t) * a) + Float64(Float64(z * y) + x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z * ((b * a) + y)) + (x + (t * a)); tmp = 0.0; if (z < -11820553527347888000.0) tmp = t_1; elseif (z < 4.7589743188364287e-122) tmp = (((b * z) + t) * a) + ((z * y) + x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(N[(b * a), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] + N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -11820553527347888000.0], t$95$1, If[Less[z, 4.7589743188364287e-122], N[(N[(N[(N[(b * z), $MachinePrecision] + t), $MachinePrecision] * a), $MachinePrecision] + N[(N[(z * y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\
\mathbf{if}\;z < -11820553527347888000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\
\;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024254
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:alt
(! :herbie-platform default (if (< z -11820553527347888000) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 47589743188364287/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a))))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))