
(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 12 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 (if (or (<= z -3.6e+199) (not (<= z 6.8e+159))) (fma (fma b a y) z x) (fma a (+ t (* b z)) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -3.6e+199) || !(z <= 6.8e+159)) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = fma(a, (t + (b * z)), fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -3.6e+199) || !(z <= 6.8e+159)) tmp = fma(fma(b, a, y), z, x); else tmp = fma(a, Float64(t + Float64(b * z)), fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -3.6e+199], N[Not[LessEqual[z, 6.8e+159]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(a * N[(t + N[(b * z), $MachinePrecision]), $MachinePrecision] + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+199} \lor \neg \left(z \leq 6.8 \cdot 10^{+159}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t + b \cdot z, \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if z < -3.60000000000000001e199 or 6.79999999999999983e159 < z Initial program 84.4%
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.f6498.2
Applied rewrites98.2%
if -3.60000000000000001e199 < z < 6.79999999999999983e159Initial program 96.0%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-lft-outN/A
lower-fma.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6498.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.0
Applied rewrites98.0%
Final simplification98.1%
(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.f6490.9
Applied rewrites90.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (* a b) z x)))
(if (<= t -3.9e+132)
(fma a t x)
(if (<= t -2.15e+21)
(fma z y x)
(if (<= t 1.95e-243)
t_1
(if (<= t 4.8e-138)
(fma z y x)
(if (<= t 3.4e+80) t_1 (fma a t x))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((a * b), z, x);
double tmp;
if (t <= -3.9e+132) {
tmp = fma(a, t, x);
} else if (t <= -2.15e+21) {
tmp = fma(z, y, x);
} else if (t <= 1.95e-243) {
tmp = t_1;
} else if (t <= 4.8e-138) {
tmp = fma(z, y, x);
} else if (t <= 3.4e+80) {
tmp = t_1;
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(a * b), z, x) tmp = 0.0 if (t <= -3.9e+132) tmp = fma(a, t, x); elseif (t <= -2.15e+21) tmp = fma(z, y, x); elseif (t <= 1.95e-243) tmp = t_1; elseif (t <= 4.8e-138) tmp = fma(z, y, x); elseif (t <= 3.4e+80) tmp = t_1; else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[t, -3.9e+132], N[(a * t + x), $MachinePrecision], If[LessEqual[t, -2.15e+21], N[(z * y + x), $MachinePrecision], If[LessEqual[t, 1.95e-243], t$95$1, If[LessEqual[t, 4.8e-138], N[(z * y + x), $MachinePrecision], If[LessEqual[t, 3.4e+80], t$95$1, N[(a * t + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a \cdot b, z, x\right)\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq -2.15 \cdot 10^{+21}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-243}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+80}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -3.90000000000000001e132 or 3.39999999999999992e80 < t Initial program 92.6%
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.f6455.6
Applied rewrites55.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6474.6
Applied rewrites74.6%
if -3.90000000000000001e132 < t < -2.15e21 or 1.95000000000000008e-243 < t < 4.7999999999999998e-138Initial 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.f6493.1
Applied rewrites93.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.7
Applied rewrites79.7%
if -2.15e21 < t < 1.95000000000000008e-243 or 4.7999999999999998e-138 < t < 3.39999999999999992e80Initial program 93.3%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6481.0
Applied rewrites81.0%
Taylor expanded in t around 0
Applied rewrites78.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma a t (* z y))))
(if (<= y -6e+160)
t_1
(if (<= y -2.7e-186)
(fma a t x)
(if (<= y 3.8e-20) (fma (* a b) z x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, (z * y));
double tmp;
if (y <= -6e+160) {
tmp = t_1;
} else if (y <= -2.7e-186) {
tmp = fma(a, t, x);
} else if (y <= 3.8e-20) {
tmp = fma((a * b), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, Float64(z * y)) tmp = 0.0 if (y <= -6e+160) tmp = t_1; elseif (y <= -2.7e-186) tmp = fma(a, t, x); elseif (y <= 3.8e-20) tmp = fma(Float64(a * b), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * t + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6e+160], t$95$1, If[LessEqual[y, -2.7e-186], N[(a * t + x), $MachinePrecision], If[LessEqual[y, 3.8e-20], N[(N[(a * b), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, z \cdot y\right)\\
\mathbf{if}\;y \leq -6 \cdot 10^{+160}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-186}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot b, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.9999999999999997e160 or 3.7999999999999998e-20 < y Initial program 92.5%
Taylor expanded in t around inf
lower-*.f6425.0
Applied rewrites25.0%
Taylor expanded in x around 0
associate-+r+N/A
distribute-lft-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6480.0
Applied rewrites80.0%
Taylor expanded in b around 0
Applied rewrites75.6%
if -5.9999999999999997e160 < y < -2.6999999999999999e-186Initial program 98.3%
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.f6466.8
Applied rewrites66.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6471.2
Applied rewrites71.2%
if -2.6999999999999999e-186 < y < 3.7999999999999998e-20Initial program 91.3%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6489.4
Applied rewrites89.4%
Taylor expanded in t around 0
Applied rewrites79.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.5e+108) (not (<= z 1.2e-50))) (fma (fma b a y) z x) (fma (fma b z t) a x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.5e+108) || !(z <= 1.2e-50)) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = fma(fma(b, z, t), a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.5e+108) || !(z <= 1.2e-50)) tmp = fma(fma(b, a, y), z, x); else tmp = fma(fma(b, z, t), a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.5e+108], N[Not[LessEqual[z, 1.2e-50]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+108} \lor \neg \left(z \leq 1.2 \cdot 10^{-50}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\end{array}
\end{array}
if z < -7.50000000000000039e108 or 1.20000000000000001e-50 < z Initial program 86.8%
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.f6493.9
Applied rewrites93.9%
if -7.50000000000000039e108 < z < 1.20000000000000001e-50Initial 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.f6488.7
Applied rewrites88.7%
Final simplification91.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.55e-48) (not (<= z 1.95e-150))) (fma (fma b a y) z x) (fma a t x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.55e-48) || !(z <= 1.95e-150)) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.55e-48) || !(z <= 1.95e-150)) tmp = fma(fma(b, a, y), z, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.55e-48], N[Not[LessEqual[z, 1.95e-150]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{-48} \lor \neg \left(z \leq 1.95 \cdot 10^{-150}\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if z < -2.55000000000000006e-48 or 1.9500000000000001e-150 < z Initial program 90.7%
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.f6489.7
Applied rewrites89.7%
if -2.55000000000000006e-48 < z < 1.9500000000000001e-150Initial program 98.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.f6456.3
Applied rewrites56.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6487.7
Applied rewrites87.7%
Final simplification89.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -4.6e-31) (not (<= a 4e+72))) (* (fma b z t) a) (fma z y x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -4.6e-31) || !(a <= 4e+72)) {
tmp = fma(b, z, t) * a;
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -4.6e-31) || !(a <= 4e+72)) tmp = Float64(fma(b, z, t) * a); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -4.6e-31], N[Not[LessEqual[a, 4e+72]], $MachinePrecision]], N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision], N[(z * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.6 \cdot 10^{-31} \lor \neg \left(a \leq 4 \cdot 10^{+72}\right):\\
\;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if a < -4.5999999999999997e-31 or 3.99999999999999978e72 < a Initial program 88.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6480.5
Applied rewrites80.5%
if -4.5999999999999997e-31 < a < 3.99999999999999978e72Initial program 98.4%
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.f6490.7
Applied rewrites90.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6478.0
Applied rewrites78.0%
Final simplification79.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.5e-30) (not (<= z 2.6e-16))) (* (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 <= -4.5e-30) || !(z <= 2.6e-16)) {
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 <= -4.5e-30) || !(z <= 2.6e-16)) 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, -4.5e-30], N[Not[LessEqual[z, 2.6e-16]], $MachinePrecision]], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{-30} \lor \neg \left(z \leq 2.6 \cdot 10^{-16}\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 < -4.49999999999999967e-30 or 2.5999999999999998e-16 < z Initial program 88.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6477.1
Applied rewrites77.1%
if -4.49999999999999967e-30 < z < 2.5999999999999998e-16Initial program 99.1%
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.f6462.1
Applied rewrites62.1%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6480.0
Applied rewrites80.0%
Final simplification78.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.9e+132) (not (<= t 6.4e+134))) (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 ((t <= -3.9e+132) || !(t <= 6.4e+134)) {
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 ((t <= -3.9e+132) || !(t <= 6.4e+134)) 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[t, -3.9e+132], N[Not[LessEqual[t, 6.4e+134]], $MachinePrecision]], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 6.4 \cdot 10^{+134}\right):\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if t < -3.90000000000000001e132 or 6.4000000000000001e134 < t Initial program 92.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.f6453.2
Applied rewrites53.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6476.8
Applied rewrites76.8%
if -3.90000000000000001e132 < t < 6.4000000000000001e134Initial program 94.2%
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.f6491.7
Applied rewrites91.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.3
Applied rewrites62.3%
Final simplification67.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.9e+163) (not (<= y 1.4e+140))) (* 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.9e+163) || !(y <= 1.4e+140)) {
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.9e+163) || !(y <= 1.4e+140)) 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.9e+163], N[Not[LessEqual[y, 1.4e+140]], $MachinePrecision]], N[(z * y), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+163} \lor \neg \left(y \leq 1.4 \cdot 10^{+140}\right):\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if y < -1.90000000000000004e163 or 1.39999999999999991e140 < y Initial program 93.5%
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.f6482.4
Applied rewrites82.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.4
Applied rewrites73.4%
Taylor expanded in x around 0
Applied rewrites63.4%
if -1.90000000000000004e163 < y < 1.39999999999999991e140Initial program 93.4%
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.f6476.9
Applied rewrites76.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6461.2
Applied rewrites61.2%
Final simplification61.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -3.9e+132) (not (<= t 1.05e+135))) (* a t) (* z y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -3.9e+132) || !(t <= 1.05e+135)) {
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 ((t <= (-3.9d+132)) .or. (.not. (t <= 1.05d+135))) 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 ((t <= -3.9e+132) || !(t <= 1.05e+135)) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -3.9e+132) or not (t <= 1.05e+135): tmp = a * t else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -3.9e+132) || !(t <= 1.05e+135)) 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 ((t <= -3.9e+132) || ~((t <= 1.05e+135))) tmp = a * t; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -3.9e+132], N[Not[LessEqual[t, 1.05e+135]], $MachinePrecision]], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.9 \cdot 10^{+132} \lor \neg \left(t \leq 1.05 \cdot 10^{+135}\right):\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if t < -3.90000000000000001e132 or 1.05000000000000005e135 < t Initial program 92.0%
Taylor expanded in t around inf
lower-*.f6459.0
Applied rewrites59.0%
if -3.90000000000000001e132 < t < 1.05000000000000005e135Initial program 94.2%
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.f6491.7
Applied rewrites91.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.3
Applied rewrites62.3%
Taylor expanded in x around 0
Applied rewrites32.4%
Final simplification41.5%
(FPCore (x y z t a b) :precision binary64 (* z y))
double code(double x, double y, double z, double t, double a, double b) {
return z * y;
}
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 = z * y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z * y;
}
def code(x, y, z, t, a, b): return z * y
function code(x, y, z, t, a, b) return Float64(z * y) end
function tmp = code(x, y, z, t, a, b) tmp = z * y; end
code[x_, y_, z_, t_, a_, b_] := N[(z * y), $MachinePrecision]
\begin{array}{l}
\\
z \cdot y
\end{array}
Initial program 93.4%
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.f6478.5
Applied rewrites78.5%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6453.7
Applied rewrites53.7%
Taylor expanded in x around 0
Applied rewrites28.3%
(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 2024324
(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)))