
(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)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* z (fma a b y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = z * fma(a, b, y);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(z * fma(a, b, y)); 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[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{fma}\left(a, b, y\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 98.3%
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 z around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6491.3
Applied rewrites91.3%
Final simplification97.6%
(FPCore (x y z t a b) :precision binary64 (if (<= y -4.5e+62) (fma a t (fma z y x)) (if (<= y 2.85e+119) (fma a (fma b z t) x) (fma z (fma a b y) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.5e+62) {
tmp = fma(a, t, fma(z, y, x));
} else if (y <= 2.85e+119) {
tmp = fma(a, fma(b, z, t), x);
} else {
tmp = fma(z, fma(a, b, y), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.5e+62) tmp = fma(a, t, fma(z, y, x)); elseif (y <= 2.85e+119) tmp = fma(a, fma(b, z, t), x); else tmp = fma(z, fma(a, b, y), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.5e+62], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.85e+119], N[(a * N[(b * z + t), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{elif}\;y \leq 2.85 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\end{array}
\end{array}
if y < -4.49999999999999999e62Initial program 86.8%
Taylor expanded in b around 0
Applied rewrites89.2%
if -4.49999999999999999e62 < y < 2.8500000000000001e119Initial program 92.6%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6494.0
Applied rewrites94.0%
if 2.8500000000000001e119 < y Initial program 79.4%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6482.7
Applied rewrites82.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a (fma b z t) x))) (if (<= a -1.45e-44) t_1 (if (<= a 3.5e-89) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, fma(b, z, t), x);
double tmp;
if (a <= -1.45e-44) {
tmp = t_1;
} else if (a <= 3.5e-89) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, fma(b, z, t), x) tmp = 0.0 if (a <= -1.45e-44) tmp = t_1; elseif (a <= 3.5e-89) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -1.45e-44], t$95$1, If[LessEqual[a, 3.5e-89], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), x\right)\\
\mathbf{if}\;a \leq -1.45 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.4500000000000001e-44 or 3.4999999999999997e-89 < a Initial program 85.2%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6490.5
Applied rewrites90.5%
if -1.4500000000000001e-44 < a < 3.4999999999999997e-89Initial program 97.7%
Taylor expanded in b around 0
Applied rewrites91.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -2.3e-24) t_1 (if (<= a 6.8e+93) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -2.3e-24) {
tmp = t_1;
} else if (a <= 6.8e+93) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -2.3e-24) tmp = t_1; elseif (a <= 6.8e+93) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.3e-24], t$95$1, If[LessEqual[a, 6.8e+93], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.8 \cdot 10^{+93}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.3000000000000001e-24 or 6.8000000000000001e93 < a Initial program 80.6%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6484.1
Applied rewrites84.1%
if -2.3000000000000001e-24 < a < 6.8000000000000001e93Initial program 97.7%
Taylor expanded in b around 0
Applied rewrites85.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -2.3e-24) t_1 (if (<= a 1.6e+27) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -2.3e-24) {
tmp = t_1;
} else if (a <= 1.6e+27) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -2.3e-24) tmp = t_1; elseif (a <= 1.6e+27) 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[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.3e-24], t$95$1, If[LessEqual[a, 1.6e+27], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.3000000000000001e-24 or 1.60000000000000008e27 < a Initial program 82.0%
Taylor expanded in a around inf
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6482.4
Applied rewrites82.4%
if -2.3000000000000001e-24 < a < 1.60000000000000008e27Initial program 98.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6475.1
Applied rewrites75.1%
(FPCore (x y z t a b) :precision binary64 (if (<= a -2.3e-24) (* (* z a) b) (if (<= a 2.45e-89) (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 (a <= -2.3e-24) {
tmp = (z * a) * b;
} else if (a <= 2.45e-89) {
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 (a <= -2.3e-24) tmp = Float64(Float64(z * a) * b); elseif (a <= 2.45e-89) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.3e-24], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[a, 2.45e-89], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-24}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\mathbf{elif}\;a \leq 2.45 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if a < -2.3000000000000001e-24Initial program 82.8%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6455.7
Applied rewrites55.7%
Applied rewrites58.0%
if -2.3000000000000001e-24 < a < 2.45e-89Initial program 97.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6480.6
Applied rewrites80.6%
if 2.45e-89 < a Initial program 87.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6456.9
Applied rewrites56.9%
(FPCore (x y z t a b) :precision binary64 (if (<= a -2.3e-24) (* a (* z b)) (if (<= a 3.6e-89) (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 (a <= -2.3e-24) {
tmp = a * (z * b);
} else if (a <= 3.6e-89) {
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 (a <= -2.3e-24) tmp = Float64(a * Float64(z * b)); elseif (a <= 3.6e-89) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.3e-24], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.6e-89], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.3 \cdot 10^{-24}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if a < -2.3000000000000001e-24Initial program 82.8%
Taylor expanded in b around inf
lower-*.f64N/A
lower-*.f6455.7
Applied rewrites55.7%
if -2.3000000000000001e-24 < a < 3.60000000000000007e-89Initial program 97.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6480.6
Applied rewrites80.6%
if 3.60000000000000007e-89 < a Initial program 86.8%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6456.6
Applied rewrites56.6%
Final simplification64.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.05e-64) (fma a t x) (if (<= t 6.6e+29) (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 (t <= -1.05e-64) {
tmp = fma(a, t, x);
} else if (t <= 6.6e+29) {
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 (t <= -1.05e-64) tmp = fma(a, t, x); elseif (t <= 6.6e+29) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.05e-64], N[(a * t + x), $MachinePrecision], If[LessEqual[t, 6.6e+29], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -1.05000000000000006e-64 or 6.59999999999999968e29 < t Initial program 86.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6468.9
Applied rewrites68.9%
if -1.05000000000000006e-64 < t < 6.59999999999999968e29Initial program 92.0%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6459.1
Applied rewrites59.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.32e-73) (* t a) (if (<= t 1.05e+39) (* y z) (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.32e-73) {
tmp = t * a;
} else if (t <= 1.05e+39) {
tmp = y * z;
} else {
tmp = t * a;
}
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 <= (-1.32d-73)) then
tmp = t * a
else if (t <= 1.05d+39) then
tmp = y * z
else
tmp = t * a
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 <= -1.32e-73) {
tmp = t * a;
} else if (t <= 1.05e+39) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.32e-73: tmp = t * a elif t <= 1.05e+39: tmp = y * z else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.32e-73) tmp = Float64(t * a); elseif (t <= 1.05e+39) tmp = Float64(y * z); else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.32e-73) tmp = t * a; elseif (t <= 1.05e+39) tmp = y * z; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.32e-73], N[(t * a), $MachinePrecision], If[LessEqual[t, 1.05e+39], N[(y * z), $MachinePrecision], N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.32 \cdot 10^{-73}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+39}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -1.31999999999999998e-73 or 1.0499999999999999e39 < t Initial program 86.6%
Taylor expanded in t around inf
lower-*.f6450.2
Applied rewrites50.2%
if -1.31999999999999998e-73 < t < 1.0499999999999999e39Initial program 91.9%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6433.6
Applied rewrites33.6%
Final simplification41.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.9e+185) (* y z) (fma a t x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.9e+185) {
tmp = y * z;
} else {
tmp = fma(a, t, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.9e+185) tmp = Float64(y * z); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.9e+185], N[(y * z), $MachinePrecision], N[(a * t + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+185}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if y < -2.89999999999999988e185Initial program 84.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6472.5
Applied rewrites72.5%
if -2.89999999999999988e185 < y Initial program 90.2%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6454.3
Applied rewrites54.3%
Final simplification56.5%
(FPCore (x y z t a b) :precision binary64 (* t a))
double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
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 = t * a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t * a;
}
def code(x, y, z, t, a, b): return t * a
function code(x, y, z, t, a, b) return Float64(t * a) end
function tmp = code(x, y, z, t, a, b) tmp = t * a; end
code[x_, y_, z_, t_, a_, b_] := N[(t * a), $MachinePrecision]
\begin{array}{l}
\\
t \cdot a
\end{array}
Initial program 89.4%
Taylor expanded in t around inf
lower-*.f6427.7
Applied rewrites27.7%
Final simplification27.7%
(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 2024221
(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)))