
(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 10 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 2e+306) t_1 (fma (fma z b t) a (* z y)))))
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 <= 2e+306) {
tmp = t_1;
} else {
tmp = fma(fma(z, b, t), a, (z * y));
}
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 <= 2e+306) tmp = t_1; else tmp = fma(fma(z, b, t), a, Float64(z * y)); 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, 2e+306], t$95$1, N[(N[(z * b + t), $MachinePrecision] * a + N[(z * y), $MachinePrecision]), $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 2 \cdot 10^{+306}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, z \cdot y\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 2.00000000000000003e306Initial program 98.6%
if 2.00000000000000003e306 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 74.4%
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-*.f6496.0
Applied rewrites96.0%
Final simplification98.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma z b t) a (* z y)))) (if (<= a -6.1e+35) t_1 (if (<= a 3e+14) (fma y z (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(z, b, t), a, (z * y));
double tmp;
if (a <= -6.1e+35) {
tmp = t_1;
} else if (a <= 3e+14) {
tmp = fma(y, z, fma(t, a, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(z, b, t), a, Float64(z * y)) tmp = 0.0 if (a <= -6.1e+35) tmp = t_1; elseif (a <= 3e+14) tmp = fma(y, z, 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[(z * b + t), $MachinePrecision] * a + N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -6.1e+35], t$95$1, If[LessEqual[a, 3e+14], N[(y * z + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, z \cdot y\right)\\
\mathbf{if}\;a \leq -6.1 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(y, z, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.09999999999999977e35 or 3e14 < a Initial program 86.6%
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-*.f6492.4
Applied rewrites92.4%
if -6.09999999999999977e35 < a < 3e14Initial program 99.9%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.8
Applied rewrites83.8%
Final simplification87.7%
(FPCore (x y z t a b) :precision binary64 (if (<= a 1.3e+188) (fma (* b a) z (fma a t (fma z y x))) (fma (fma z b t) a (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 1.3e+188) {
tmp = fma((b * a), z, fma(a, t, fma(z, y, x)));
} else {
tmp = fma(fma(z, b, t), a, (z * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 1.3e+188) tmp = fma(Float64(b * a), z, fma(a, t, fma(z, y, x))); else tmp = fma(fma(z, b, t), a, Float64(z * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 1.3e+188], N[(N[(b * a), $MachinePrecision] * z + N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * b + t), $MachinePrecision] * a + N[(z * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.3 \cdot 10^{+188}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot a, z, \mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, b, t\right), a, z \cdot y\right)\\
\end{array}
\end{array}
if a < 1.29999999999999994e188Initial program 94.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6497.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.4
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6497.4
Applied rewrites97.4%
if 1.29999999999999994e188 < a Initial program 91.8%
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-*.f6499.9
Applied rewrites99.9%
Final simplification97.7%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6e+49) (* (fma b a y) z) (if (<= b 2.2e+80) (fma y z (fma t a x)) (* (fma z b t) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6e+49) {
tmp = fma(b, a, y) * z;
} else if (b <= 2.2e+80) {
tmp = fma(y, z, fma(t, a, x));
} else {
tmp = fma(z, b, t) * a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6e+49) tmp = Float64(fma(b, a, y) * z); elseif (b <= 2.2e+80) tmp = fma(y, z, fma(t, a, x)); else tmp = Float64(fma(z, b, t) * a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6e+49], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[b, 2.2e+80], N[(y * z + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(z * b + t), $MachinePrecision] * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{+80}:\\
\;\;\;\;\mathsf{fma}\left(y, z, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, b, t\right) \cdot a\\
\end{array}
\end{array}
if b < -6.0000000000000005e49Initial program 94.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6477.7
Applied rewrites77.7%
if -6.0000000000000005e49 < b < 2.20000000000000003e80Initial program 93.0%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6491.6
Applied rewrites91.6%
if 2.20000000000000003e80 < b Initial program 95.8%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6472.2
Applied rewrites72.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma z b t) a))) (if (<= a -210000.0) t_1 (if (<= a 7.1e+28) (fma y z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, b, t) * a;
double tmp;
if (a <= -210000.0) {
tmp = t_1;
} else if (a <= 7.1e+28) {
tmp = fma(y, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(fma(z, b, t) * a) tmp = 0.0 if (a <= -210000.0) tmp = t_1; elseif (a <= 7.1e+28) tmp = fma(y, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * b + t), $MachinePrecision] * a), $MachinePrecision]}, If[LessEqual[a, -210000.0], t$95$1, If[LessEqual[a, 7.1e+28], N[(y * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, b, t\right) \cdot a\\
\mathbf{if}\;a \leq -210000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.1 \cdot 10^{+28}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.1e5 or 7.0999999999999999e28 < a Initial program 87.6%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6479.0
Applied rewrites79.0%
if -2.1e5 < a < 7.0999999999999999e28Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f6478.2
Applied rewrites78.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -1.2e-53) t_1 (if (<= z 4.75e-7) (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 <= -1.2e-53) {
tmp = t_1;
} else if (z <= 4.75e-7) {
tmp = 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 <= -1.2e-53) tmp = t_1; elseif (z <= 4.75e-7) tmp = 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, -1.2e-53], t$95$1, If[LessEqual[z, 4.75e-7], N[(t * a + 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 -1.2 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.75 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.20000000000000004e-53 or 4.75e-7 < z Initial program 89.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.8
Applied rewrites73.8%
if -1.20000000000000004e-53 < z < 4.75e-7Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.7
Applied rewrites73.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.8e+207) (fma t a x) (if (<= t 6e-30) (fma y z x) (fma t a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.8e+207) {
tmp = fma(t, a, x);
} else if (t <= 6e-30) {
tmp = fma(y, z, x);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.8e+207) tmp = fma(t, a, x); elseif (t <= 6e-30) tmp = fma(y, z, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.8e+207], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 6e-30], N[(y * z + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+207}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if t < -4.8000000000000002e207 or 5.9999999999999998e-30 < t Initial program 92.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.8
Applied rewrites76.8%
if -4.8000000000000002e207 < t < 5.9999999999999998e-30Initial program 94.6%
Taylor expanded in a around 0
+-commutativeN/A
lower-fma.f6463.4
Applied rewrites63.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.3e+71) (* z y) (if (<= y 6.5e+140) (fma t a x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.3e+71) {
tmp = z * y;
} else if (y <= 6.5e+140) {
tmp = fma(t, a, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.3e+71) tmp = Float64(z * y); elseif (y <= 6.5e+140) tmp = fma(t, a, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.3e+71], N[(z * y), $MachinePrecision], If[LessEqual[y, 6.5e+140], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+71}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if y < -2.3000000000000002e71 or 6.4999999999999999e140 < y Initial program 94.5%
Taylor expanded in y around inf
lower-*.f6463.6
Applied rewrites63.6%
if -2.3000000000000002e71 < y < 6.4999999999999999e140Initial program 93.6%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6459.8
Applied rewrites59.8%
Final simplification60.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.8e+207) (* a t) (if (<= t 6e-30) (* z y) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.8e+207) {
tmp = a * t;
} else if (t <= 6e-30) {
tmp = z * y;
} else {
tmp = a * t;
}
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 <= (-4.8d+207)) then
tmp = a * t
else if (t <= 6d-30) then
tmp = z * y
else
tmp = a * t
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 <= -4.8e+207) {
tmp = a * t;
} else if (t <= 6e-30) {
tmp = z * y;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4.8e+207: tmp = a * t elif t <= 6e-30: tmp = z * y else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.8e+207) tmp = Float64(a * t); elseif (t <= 6e-30) tmp = Float64(z * y); else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4.8e+207) tmp = a * t; elseif (t <= 6e-30) tmp = z * y; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.8e+207], N[(a * t), $MachinePrecision], If[LessEqual[t, 6e-30], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+207}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-30}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if t < -4.8000000000000002e207 or 5.9999999999999998e-30 < t Initial program 92.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6461.1
Applied rewrites61.1%
if -4.8000000000000002e207 < t < 5.9999999999999998e-30Initial program 94.6%
Taylor expanded in y around inf
lower-*.f6434.1
Applied rewrites34.1%
Final simplification42.0%
(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 93.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6425.2
Applied rewrites25.2%
Final simplification25.2%
(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 2024235
(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)))