
(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 b a y) z (* a t)))))
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(b, a, y), z, (a * t));
}
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(b, a, y), z, Float64(a * t)); 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[(b * a + y), $MachinePrecision] * z + N[(a * t), $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(b, a, y\right), z, a \cdot t\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 73.4%
Taylor expanded in x around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6491.2
Applied rewrites91.2%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (fma z y x)))) (if (<= x -1.1e+15) t_1 (if (<= x 1e-82) (fma (fma b a y) z (* a t)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, fma(z, y, x));
double tmp;
if (x <= -1.1e+15) {
tmp = t_1;
} else if (x <= 1e-82) {
tmp = fma(fma(b, a, y), z, (a * t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, fma(z, y, x)) tmp = 0.0 if (x <= -1.1e+15) tmp = t_1; elseif (x <= 1e-82) tmp = fma(fma(b, a, y), z, Float64(a * t)); 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 + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e+15], t$95$1, If[LessEqual[x, 1e-82], N[(N[(b * a + y), $MachinePrecision] * z + N[(a * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 10^{-82}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, a \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.1e15 or 1e-82 < x Initial program 95.2%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6489.9
Applied rewrites89.9%
if -1.1e15 < x < 1e-82Initial program 92.7%
Taylor expanded in x around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6495.4
Applied rewrites95.4%
(FPCore (x y z t a b) :precision binary64 (if (<= t -5.2e+67) (fma a t (fma z y x)) (if (<= t 1.95e-39) (fma (fma b a y) z x) (fma z y (+ (* a t) x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -5.2e+67) {
tmp = fma(a, t, fma(z, y, x));
} else if (t <= 1.95e-39) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = fma(z, y, ((a * t) + x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -5.2e+67) tmp = fma(a, t, fma(z, y, x)); elseif (t <= 1.95e-39) tmp = fma(fma(b, a, y), z, x); else tmp = fma(z, y, Float64(Float64(a * t) + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -5.2e+67], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.95e-39], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], N[(z * y + N[(N[(a * t), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, a \cdot t + x\right)\\
\end{array}
\end{array}
if t < -5.2000000000000001e67Initial program 92.7%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.0
Applied rewrites93.0%
if -5.2000000000000001e67 < t < 1.95000000000000015e-39Initial program 94.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.f6493.6
Applied rewrites93.6%
if 1.95000000000000015e-39 < t Initial program 95.6%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6485.3
Applied rewrites85.3%
Applied rewrites86.7%
Final simplification91.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a t (fma z y x)))) (if (<= t -5.2e+67) t_1 (if (<= t 1.95e-39) (fma (fma b a y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, t, fma(z, y, x));
double tmp;
if (t <= -5.2e+67) {
tmp = t_1;
} else if (t <= 1.95e-39) {
tmp = fma(fma(b, a, y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, t, fma(z, y, x)) tmp = 0.0 if (t <= -5.2e+67) tmp = t_1; elseif (t <= 1.95e-39) tmp = fma(fma(b, a, y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.2e+67], t$95$1, If[LessEqual[t, 1.95e-39], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{if}\;t \leq -5.2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.2000000000000001e67 or 1.95000000000000015e-39 < t Initial program 94.3%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.7
Applied rewrites88.7%
if -5.2000000000000001e67 < t < 1.95000000000000015e-39Initial program 94.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.f6493.6
Applied rewrites93.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -1.1e-21) t_1 (if (<= z 9.2e+89) (fma a t 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.1e-21) {
tmp = t_1;
} else if (z <= 9.2e+89) {
tmp = fma(a, t, 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.1e-21) tmp = t_1; elseif (z <= 9.2e+89) tmp = fma(a, t, 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.1e-21], t$95$1, If[LessEqual[z, 9.2e+89], N[(a * t + 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.1 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1e-21 or 9.1999999999999996e89 < z Initial program 88.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6478.4
Applied rewrites78.4%
if -1.1e-21 < z < 9.1999999999999996e89Initial program 98.6%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6473.7
Applied rewrites73.7%
(FPCore (x y z t a b) :precision binary64 (if (<= a -6.5e+23) (fma a t x) (if (<= a 1.95e+169) (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 <= -6.5e+23) {
tmp = fma(a, t, x);
} else if (a <= 1.95e+169) {
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 <= -6.5e+23) tmp = fma(a, t, x); elseif (a <= 1.95e+169) 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, -6.5e+23], N[(a * t + x), $MachinePrecision], If[LessEqual[a, 1.95e+169], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.5 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if a < -6.4999999999999996e23 or 1.94999999999999991e169 < a Initial program 84.5%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6468.1
Applied rewrites68.1%
if -6.4999999999999996e23 < a < 1.94999999999999991e169Initial program 98.3%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.7
Applied rewrites70.7%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.5e+150) (* z y) (if (<= z 4.4e+128) (fma a t x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.5e+150) {
tmp = z * y;
} else if (z <= 4.4e+128) {
tmp = fma(a, t, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.5e+150) tmp = Float64(z * y); elseif (z <= 4.4e+128) tmp = fma(a, t, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.5e+150], N[(z * y), $MachinePrecision], If[LessEqual[z, 4.4e+128], N[(a * t + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+150}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -3.49999999999999984e150 or 4.40000000000000033e128 < z Initial program 86.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6463.7
Applied rewrites63.7%
if -3.49999999999999984e150 < z < 4.40000000000000033e128Initial program 97.3%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f6468.0
Applied rewrites68.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.2e+170) (* (fma b z t) a) (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 <= -3.2e+170) {
tmp = fma(b, z, t) * a;
} else {
tmp = fma(a, t, fma(z, y, x));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.2e+170) tmp = Float64(fma(b, z, t) * a); else tmp = fma(a, t, fma(z, y, x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.2e+170], N[(N[(b * z + t), $MachinePrecision] * a), $MachinePrecision], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{+170}:\\
\;\;\;\;\mathsf{fma}\left(b, z, t\right) \cdot a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\end{array}
\end{array}
if a < -3.19999999999999979e170Initial program 78.4%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6496.3
Applied rewrites96.3%
if -3.19999999999999979e170 < a Initial program 96.0%
Taylor expanded in b around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6483.3
Applied rewrites83.3%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.7e+24) (* a t) (if (<= a 1.95e+169) (* z y) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.7e+24) {
tmp = a * t;
} else if (a <= 1.95e+169) {
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 (a <= (-1.7d+24)) then
tmp = a * t
else if (a <= 1.95d+169) 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 (a <= -1.7e+24) {
tmp = a * t;
} else if (a <= 1.95e+169) {
tmp = z * y;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.7e+24: tmp = a * t elif a <= 1.95e+169: tmp = z * y else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.7e+24) tmp = Float64(a * t); elseif (a <= 1.95e+169) 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 (a <= -1.7e+24) tmp = a * t; elseif (a <= 1.95e+169) tmp = z * y; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.7e+24], N[(a * t), $MachinePrecision], If[LessEqual[a, 1.95e+169], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{+24}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{+169}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -1.7e24 or 1.94999999999999991e169 < a Initial program 84.5%
Taylor expanded in t around inf
lower-*.f6454.9
Applied rewrites54.9%
if -1.7e24 < a < 1.94999999999999991e169Initial program 98.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6437.9
Applied rewrites37.9%
(FPCore (x y z t a b) :precision binary64 (* a t))
double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a * t
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * t;
}
def code(x, y, z, t, a, b): return a * t
function code(x, y, z, t, a, b) return Float64(a * t) end
function tmp = code(x, y, z, t, a, b) tmp = a * t; end
code[x_, y_, z_, t_, a_, b_] := N[(a * t), $MachinePrecision]
\begin{array}{l}
\\
a \cdot t
\end{array}
Initial program 94.2%
Taylor expanded in t around inf
lower-*.f6425.9
Applied rewrites25.9%
(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 2024276
(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)))