
(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 9 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 INFINITY) t_1 (* (fma a (/ (fma b z t) y) 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 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(a, (fma(b, z, t) / y), 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 <= Inf) tmp = t_1; else tmp = Float64(fma(a, Float64(fma(b, z, t) / y), 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, Infinity], t$95$1, N[(N[(a * N[(N[(b * z + t), $MachinePrecision] / y), $MachinePrecision] + z), $MachinePrecision] * y), $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 \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{\mathsf{fma}\left(b, z, t\right)}{y}, z\right) \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 98.4%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites52.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6452.9
Applied rewrites52.9%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification98.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* b (* a z)) (+ (* a t) (+ (* z y) x)))))
(if (<= t_1 -4e+217)
(fma (fma b z t) a (* z y))
(if (<= t_1 1e+308)
(fma z y (fma t a x))
(* (fma a (/ (fma b z t) y) 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 <= -4e+217) {
tmp = fma(fma(b, z, t), a, (z * y));
} else if (t_1 <= 1e+308) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = fma(a, (fma(b, z, t) / y), 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 <= -4e+217) tmp = fma(fma(b, z, t), a, Float64(z * y)); elseif (t_1 <= 1e+308) tmp = fma(z, y, fma(t, a, x)); else tmp = Float64(fma(a, Float64(fma(b, z, t) / y), 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, -4e+217], N[(N[(b * z + t), $MachinePrecision] * a + N[(z * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+308], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[(b * z + t), $MachinePrecision] / y), $MachinePrecision] + z), $MachinePrecision] * y), $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 -4 \cdot 10^{+217}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, z \cdot y\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+308}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{\mathsf{fma}\left(b, z, t\right)}{y}, z\right) \cdot y\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < -3.99999999999999984e217Initial program 95.2%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites96.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6491.8
Applied rewrites91.8%
if -3.99999999999999984e217 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 1e308Initial program 99.9%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6485.1
Applied rewrites85.1%
if 1e308 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 61.9%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites83.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6483.0
Applied rewrites83.0%
Taylor expanded in y around inf
Applied rewrites98.1%
Final simplification89.0%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.32e+67) (* (fma b a y) z) (if (<= b 2.45e+108) (fma z y (fma t a x)) (fma (fma b z t) a (* z y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.32e+67) {
tmp = fma(b, a, y) * z;
} else if (b <= 2.45e+108) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = fma(fma(b, z, t), a, (z * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.32e+67) tmp = Float64(fma(b, a, y) * z); elseif (b <= 2.45e+108) tmp = fma(z, y, fma(t, a, x)); else tmp = fma(fma(b, z, t), a, Float64(z * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.32e+67], N[(N[(b * a + y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[b, 2.45e+108], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], N[(N[(b * z + t), $MachinePrecision] * a + N[(z * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.32 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y\right) \cdot z\\
\mathbf{elif}\;b \leq 2.45 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, z \cdot y\right)\\
\end{array}
\end{array}
if b < -1.3200000000000001e67Initial program 90.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.2
Applied rewrites74.2%
if -1.3200000000000001e67 < b < 2.45000000000000007e108Initial program 92.1%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6489.9
Applied rewrites89.9%
if 2.45000000000000007e108 < b Initial program 92.1%
lift-+.f64N/A
flip3-+N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
Applied rewrites97.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.2
Applied rewrites88.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -9.5e+178) t_1 (if (<= z 1.9e+112) (fma z y (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 <= -9.5e+178) {
tmp = t_1;
} else if (z <= 1.9e+112) {
tmp = fma(z, y, 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 <= -9.5e+178) tmp = t_1; elseif (z <= 1.9e+112) tmp = fma(z, y, 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, -9.5e+178], t$95$1, If[LessEqual[z, 1.9e+112], N[(z * y + N[(t * a + x), $MachinePrecision]), $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 -9.5 \cdot 10^{+178}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.5e178 or 1.90000000000000004e112 < z Initial program 80.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.0
Applied rewrites88.0%
if -9.5e178 < z < 1.90000000000000004e112Initial program 95.8%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6484.2
Applied rewrites84.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -4700000.0) t_1 (if (<= z 3.8e-31) (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 <= -4700000.0) {
tmp = t_1;
} else if (z <= 3.8e-31) {
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 <= -4700000.0) tmp = t_1; elseif (z <= 3.8e-31) 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, -4700000.0], t$95$1, If[LessEqual[z, 3.8e-31], 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 -4700000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.7e6 or 3.8e-31 < z Initial program 84.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6473.1
Applied rewrites73.1%
if -4.7e6 < z < 3.8e-31Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.0
Applied rewrites76.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3e+41) (fma z y x) (if (<= y 600000000000.0) (fma t a x) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3e+41) {
tmp = fma(z, y, x);
} else if (y <= 600000000000.0) {
tmp = fma(t, a, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3e+41) tmp = fma(z, y, x); elseif (y <= 600000000000.0) tmp = fma(t, a, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3e+41], N[(z * y + x), $MachinePrecision], If[LessEqual[y, 600000000000.0], N[(t * a + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;y \leq 600000000000:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if y < -2.9999999999999998e41 or 6e11 < y Initial program 89.7%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.6
Applied rewrites68.6%
if -2.9999999999999998e41 < y < 6e11Initial program 93.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6464.0
Applied rewrites64.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -4.2e+45) (* z y) (if (<= y 2.2e+160) (fma t a x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.2e+45) {
tmp = z * y;
} else if (y <= 2.2e+160) {
tmp = fma(t, a, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.2e+45) tmp = Float64(z * y); elseif (y <= 2.2e+160) tmp = fma(t, a, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.2e+45], N[(z * y), $MachinePrecision], If[LessEqual[y, 2.2e+160], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+45}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+160}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if y < -4.1999999999999999e45 or 2.19999999999999992e160 < y Initial program 88.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6457.7
Applied rewrites57.7%
if -4.1999999999999999e45 < y < 2.19999999999999992e160Initial program 93.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6461.3
Applied rewrites61.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -3e+41) (* z y) (if (<= y 0.00045) (* a t) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -3e+41) {
tmp = z * y;
} else if (y <= 0.00045) {
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 (y <= (-3d+41)) then
tmp = z * y
else if (y <= 0.00045d0) 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 (y <= -3e+41) {
tmp = z * y;
} else if (y <= 0.00045) {
tmp = a * t;
} else {
tmp = z * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -3e+41: tmp = z * y elif y <= 0.00045: tmp = a * t else: tmp = z * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -3e+41) tmp = Float64(z * y); elseif (y <= 0.00045) 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 (y <= -3e+41) tmp = z * y; elseif (y <= 0.00045) tmp = a * t; else tmp = z * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -3e+41], N[(z * y), $MachinePrecision], If[LessEqual[y, 0.00045], N[(a * t), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{+41}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;y \leq 0.00045:\\
\;\;\;\;a \cdot t\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if y < -2.9999999999999998e41 or 4.4999999999999999e-4 < y Initial program 90.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
if -2.9999999999999998e41 < y < 4.4999999999999999e-4Initial program 93.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6434.2
Applied rewrites34.2%
Final simplification41.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 91.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6427.3
Applied rewrites27.3%
Final simplification27.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 2024248
(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)))