
(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 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))) (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 = ((x + (y * z)) + (t * a)) + ((a * z) * b);
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(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) 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[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $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 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b\\
\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 97.6%
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.f6480.0
Applied rewrites80.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)) 1e+303) (fma a t (fma z y x)) (* (fma b z t) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((x + (y * z)) + (t * a)) + ((a * z) * b)) <= 1e+303) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = fma(b, z, t) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b)) <= 1e+303) tmp = fma(a, t, fma(z, y, x)); else tmp = Float64(fma(b, z, t) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], 1e+303], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \leq 10^{+303}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\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)) < 1e303Initial program 98.0%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.2
Applied rewrites74.2%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6484.6
Applied rewrites84.6%
if 1e303 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 67.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6483.2
Applied rewrites83.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -6.2e+222) (* (* b z) a) (if (or (<= z -1.6e+77) (not (<= z 9.2e+53))) (fma z y x) (fma a t x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.2e+222) {
tmp = (b * z) * a;
} else if ((z <= -1.6e+77) || !(z <= 9.2e+53)) {
tmp = fma(z, y, x);
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.2e+222) tmp = Float64(Float64(b * z) * a); elseif ((z <= -1.6e+77) || !(z <= 9.2e+53)) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.2e+222], N[(N[(b * z), $MachinePrecision] * a), $MachinePrecision], If[Or[LessEqual[z, -1.6e+77], N[Not[LessEqual[z, 9.2e+53]], $MachinePrecision]], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+222}:\\
\;\;\;\;\left(b \cdot z\right) \cdot a\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+77} \lor \neg \left(z \leq 9.2 \cdot 10^{+53}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if z < -6.1999999999999996e222Initial program 65.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6471.4
Applied rewrites71.4%
Taylor expanded in z around inf
Applied rewrites61.5%
if -6.1999999999999996e222 < z < -1.6000000000000001e77 or 9.20000000000000079e53 < z Initial program 81.6%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6455.4
Applied rewrites55.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6458.2
Applied rewrites58.2%
if -1.6000000000000001e77 < z < 9.20000000000000079e53Initial program 98.0%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6488.9
Applied rewrites88.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6475.4
Applied rewrites75.4%
Final simplification68.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -4.8e+286) (* (* b a) z) (if (or (<= z -1.6e+77) (not (<= z 9.2e+53))) (fma z y x) (fma a t x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.8e+286) {
tmp = (b * a) * z;
} else if ((z <= -1.6e+77) || !(z <= 9.2e+53)) {
tmp = fma(z, y, x);
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.8e+286) tmp = Float64(Float64(b * a) * z); elseif ((z <= -1.6e+77) || !(z <= 9.2e+53)) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.8e+286], N[(N[(b * a), $MachinePrecision] * z), $MachinePrecision], If[Or[LessEqual[z, -1.6e+77], N[Not[LessEqual[z, 9.2e+53]], $MachinePrecision]], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+286}:\\
\;\;\;\;\left(b \cdot a\right) \cdot z\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+77} \lor \neg \left(z \leq 9.2 \cdot 10^{+53}\right):\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if z < -4.80000000000000033e286Initial program 50.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6487.5
Applied rewrites87.5%
Taylor expanded in y around 0
Applied rewrites75.0%
if -4.80000000000000033e286 < z < -1.6000000000000001e77 or 9.20000000000000079e53 < z Initial program 80.9%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6457.0
Applied rewrites57.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6457.3
Applied rewrites57.3%
if -1.6000000000000001e77 < z < 9.20000000000000079e53Initial program 98.0%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6488.9
Applied rewrites88.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6475.4
Applied rewrites75.4%
Final simplification68.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -7.2e+50) (not (<= a 1.25e+34))) (fma (fma b z t) a x) (fma a t (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -7.2e+50) || !(a <= 1.25e+34)) {
tmp = fma(fma(b, z, t), a, x);
} else {
tmp = fma(a, t, fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -7.2e+50) || !(a <= 1.25e+34)) tmp = fma(fma(b, z, t), a, x); else tmp = fma(a, t, fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -7.2e+50], N[Not[LessEqual[a, 1.25e+34]], $MachinePrecision]], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{+50} \lor \neg \left(a \leq 1.25 \cdot 10^{+34}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if a < -7.19999999999999972e50 or 1.25e34 < a Initial program 80.7%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6492.9
Applied rewrites92.9%
if -7.19999999999999972e50 < a < 1.25e34Initial program 98.5%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6461.5
Applied rewrites61.5%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Applied rewrites88.3%
Final simplification90.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.2e+27) (not (<= z 2.5e+28))) (fma (fma b a y) z x) (fma a t (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.2e+27) || !(z <= 2.5e+28)) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = fma(a, t, fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.2e+27) || !(z <= 2.5e+28)) tmp = fma(fma(b, a, y), z, x); else tmp = fma(a, t, fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.2e+27], N[Not[LessEqual[z, 2.5e+28]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+27} \lor \neg \left(z \leq 2.5 \cdot 10^{+28}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if z < -7.19999999999999966e27 or 2.49999999999999979e28 < z Initial program 79.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.f6487.4
Applied rewrites87.4%
if -7.19999999999999966e27 < z < 2.49999999999999979e28Initial program 99.2%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6487.5
Applied rewrites87.5%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.2
Applied rewrites91.2%
Final simplification89.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -22000.0) (not (<= z 3.9e-64))) (* (fma b a y) z) (fma a t x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -22000.0) || !(z <= 3.9e-64)) {
tmp = fma(b, a, y) * z;
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -22000.0) || !(z <= 3.9e-64)) tmp = Float64(fma(b, a, y) * z); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -22000.0], N[Not[LessEqual[z, 3.9e-64]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -22000 \lor \neg \left(z \leq 3.9 \cdot 10^{-64}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if z < -22000 or 3.8999999999999997e-64 < z Initial program 83.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.6
Applied rewrites73.6%
if -22000 < z < 3.8999999999999997e-64Initial program 99.1%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6492.0
Applied rewrites92.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6485.0
Applied rewrites85.0%
Final simplification78.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -6.5e+40) (not (<= a 6.5e-56))) (fma a t x) (fma z y x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6.5e+40) || !(a <= 6.5e-56)) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -6.5e+40) || !(a <= 6.5e-56)) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6.5e+40], N[Not[LessEqual[a, 6.5e-56]], $MachinePrecision]], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+40} \lor \neg \left(a \leq 6.5 \cdot 10^{-56}\right):\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if a < -6.5000000000000001e40 or 6.4999999999999997e-56 < a Initial program 83.0%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6490.7
Applied rewrites90.7%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6460.5
Applied rewrites60.5%
if -6.5000000000000001e40 < a < 6.4999999999999997e-56Initial program 99.1%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6458.2
Applied rewrites58.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.8
Applied rewrites74.8%
Final simplification66.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.2e+111) (not (<= y 1.2e+112))) (* z y) (fma a t x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.2e+111) || !(y <= 1.2e+112)) {
tmp = z * y;
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.2e+111) || !(y <= 1.2e+112)) tmp = Float64(z * y); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.2e+111], N[Not[LessEqual[y, 1.2e+112]], $MachinePrecision]], N[(z * y), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+111} \lor \neg \left(y \leq 1.2 \cdot 10^{+112}\right):\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if y < -1.20000000000000003e111 or 1.2e112 < y Initial program 83.7%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6451.0
Applied rewrites51.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6459.4
Applied rewrites59.4%
if -1.20000000000000003e111 < y < 1.2e112Initial program 92.5%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6487.1
Applied rewrites87.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6465.4
Applied rewrites65.4%
Final simplification63.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -6.5e+40) (not (<= a 6.5e-56))) (* a t) (* z y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6.5e+40) || !(a <= 6.5e-56)) {
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 ((a <= (-6.5d+40)) .or. (.not. (a <= 6.5d-56))) 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 ((a <= -6.5e+40) || !(a <= 6.5e-56)) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -6.5e+40) or not (a <= 6.5e-56): tmp = a * t else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -6.5e+40) || !(a <= 6.5e-56)) 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 ((a <= -6.5e+40) || ~((a <= 6.5e-56))) tmp = a * t; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6.5e+40], N[Not[LessEqual[a, 6.5e-56]], $MachinePrecision]], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+40} \lor \neg \left(a \leq 6.5 \cdot 10^{-56}\right):\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if a < -6.5000000000000001e40 or 6.4999999999999997e-56 < a Initial program 83.0%
Taylor expanded in t around inf
lower-*.f6446.4
Applied rewrites46.4%
if -6.5000000000000001e40 < a < 6.4999999999999997e-56Initial program 99.1%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6458.2
Applied rewrites58.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6443.5
Applied rewrites43.5%
Final simplification45.1%
(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 89.9%
Taylor expanded in t around inf
lower-*.f6433.0
Applied rewrites33.0%
(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 2024304
(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)))