
(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 INFINITY) t_1 (fma (fma (/ z t) (fma b a y) a) t x))))
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(fma((z / t), fma(b, a, y), a), t, x);
}
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 = fma(fma(Float64(z / t), fma(b, a, y), a), t, x); 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[(N[(z / t), $MachinePrecision] * N[(b * a + y), $MachinePrecision] + a), $MachinePrecision] * t + x), $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(\mathsf{fma}\left(\frac{z}{t}, \mathsf{fma}\left(b, a, y\right), a\right), t, x\right)\\
\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 b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6477.8
Applied rewrites77.8%
Taylor expanded in t around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites88.9%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma (/ z t) (fma b a y) a) t x))) (if (<= t -6.2e-99) t_1 (if (<= t 8.6e-113) (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(fma((z / t), fma(b, a, y), a), t, x);
double tmp;
if (t <= -6.2e-99) {
tmp = t_1;
} else if (t <= 8.6e-113) {
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(fma(Float64(z / t), fma(b, a, y), a), t, x) tmp = 0.0 if (t <= -6.2e-99) tmp = t_1; elseif (t <= 8.6e-113) 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[(N[(N[(z / t), $MachinePrecision] * N[(b * a + y), $MachinePrecision] + a), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[t, -6.2e-99], t$95$1, If[LessEqual[t, 8.6e-113], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(\frac{z}{t}, \mathsf{fma}\left(b, a, y\right), a\right), t, x\right)\\
\mathbf{if}\;t \leq -6.2 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.6 \cdot 10^{-113}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.1999999999999997e-99 or 8.6000000000000001e-113 < t Initial program 94.6%
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.5
Applied rewrites85.5%
Taylor expanded in t around inf
+-commutativeN/A
associate-+r+N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites92.9%
if -6.1999999999999997e-99 < t < 8.6000000000000001e-113Initial 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.f6494.7
Applied rewrites94.7%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -9.5e-25)
(fma t a x)
(if (<= a -9e-118)
(fma (* a z) b x)
(if (<= a 9.5e+168) (fma z y x) (fma t a x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -9.5e-25) {
tmp = fma(t, a, x);
} else if (a <= -9e-118) {
tmp = fma((a * z), b, x);
} else if (a <= 9.5e+168) {
tmp = fma(z, y, x);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -9.5e-25) tmp = fma(t, a, x); elseif (a <= -9e-118) tmp = fma(Float64(a * z), b, x); elseif (a <= 9.5e+168) tmp = fma(z, y, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -9.5e-25], N[(t * a + x), $MachinePrecision], If[LessEqual[a, -9e-118], N[(N[(a * z), $MachinePrecision] * b + x), $MachinePrecision], If[LessEqual[a, 9.5e+168], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.5 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;a \leq -9 \cdot 10^{-118}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot z, b, x\right)\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if a < -9.50000000000000065e-25 or 9.49999999999999979e168 < a Initial program 85.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6466.5
Applied rewrites66.5%
if -9.50000000000000065e-25 < a < -9.0000000000000001e-118Initial program 99.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.f6484.6
Applied rewrites84.6%
Taylor expanded in y around 0
Applied rewrites69.9%
if -9.0000000000000001e-118 < a < 9.49999999999999979e168Initial program 97.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6474.8
Applied rewrites74.8%
Final simplification71.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z y (fma t a x)))) (if (<= t -7.8e+68) t_1 (if (<= t 4.8e-40) (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(z, y, fma(t, a, x));
double tmp;
if (t <= -7.8e+68) {
tmp = t_1;
} else if (t <= 4.8e-40) {
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(z, y, fma(t, a, x)) tmp = 0.0 if (t <= -7.8e+68) tmp = t_1; elseif (t <= 4.8e-40) 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[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.8e+68], t$95$1, If[LessEqual[t, 4.8e-40], N[(N[(b * a + y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{if}\;t \leq -7.8 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-40}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.80000000000000037e68 or 4.79999999999999982e-40 < t Initial program 94.3%
Taylor expanded in b around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.7
Applied rewrites88.7%
if -7.80000000000000037e68 < t < 4.79999999999999982e-40Initial 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 -5.8e+191) t_1 (if (<= z 4e+90) (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 <= -5.8e+191) {
tmp = t_1;
} else if (z <= 4e+90) {
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 <= -5.8e+191) tmp = t_1; elseif (z <= 4e+90) 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, -5.8e+191], t$95$1, If[LessEqual[z, 4e+90], 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 -5.8 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.8000000000000003e191 or 3.99999999999999987e90 < z Initial program 85.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6489.6
Applied rewrites89.6%
if -5.8000000000000003e191 < z < 3.99999999999999987e90Initial program 97.3%
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.9
Applied rewrites84.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -3.7e-22) t_1 (if (<= z 9.2e+89) (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 <= -3.7e-22) {
tmp = t_1;
} else if (z <= 9.2e+89) {
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 <= -3.7e-22) tmp = t_1; elseif (z <= 9.2e+89) 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, -3.7e-22], t$95$1, If[LessEqual[z, 9.2e+89], 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 -3.7 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.7e-22 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 -3.7e-22 < z < 9.1999999999999996e89Initial program 98.6%
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 (<= a -3.2e+35) (fma t a x) (if (<= a 9.5e+168) (fma z y x) (fma t a x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.2e+35) {
tmp = fma(t, a, x);
} else if (a <= 9.5e+168) {
tmp = fma(z, y, x);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.2e+35) tmp = fma(t, a, x); elseif (a <= 9.5e+168) tmp = fma(z, y, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.2e+35], N[(t * a + x), $MachinePrecision], If[LessEqual[a, 9.5e+168], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+168}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if a < -3.19999999999999983e35 or 9.49999999999999979e168 < a Initial program 84.5%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.1
Applied rewrites68.1%
if -3.19999999999999983e35 < a < 9.49999999999999979e168Initial 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 -1.3e+151) (* z y) (if (<= z 6.1e+128) (fma t a x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.3e+151) {
tmp = z * y;
} else if (z <= 6.1e+128) {
tmp = fma(t, a, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.3e+151) tmp = Float64(z * y); elseif (z <= 6.1e+128) tmp = fma(t, a, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.3e+151], N[(z * y), $MachinePrecision], If[LessEqual[z, 6.1e+128], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+151}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{+128}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -1.30000000000000007e151 or 6.1000000000000003e128 < z Initial program 86.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6463.7
Applied rewrites63.7%
if -1.30000000000000007e151 < z < 6.1000000000000003e128Initial program 97.3%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.0
Applied rewrites68.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.2e+35) (* a t) (if (<= a 9.5e+168) (* z y) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.2e+35) {
tmp = a * t;
} else if (a <= 9.5e+168) {
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 <= (-3.2d+35)) then
tmp = a * t
else if (a <= 9.5d+168) 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 <= -3.2e+35) {
tmp = a * t;
} else if (a <= 9.5e+168) {
tmp = z * y;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.2e+35: tmp = a * t elif a <= 9.5e+168: tmp = z * y else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.2e+35) tmp = Float64(a * t); elseif (a <= 9.5e+168) 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 <= -3.2e+35) tmp = a * t; elseif (a <= 9.5e+168) tmp = z * y; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.2e+35], N[(a * t), $MachinePrecision], If[LessEqual[a, 9.5e+168], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.2 \cdot 10^{+35}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{+168}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -3.19999999999999983e35 or 9.49999999999999979e168 < a Initial program 84.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6454.9
Applied rewrites54.9%
if -3.19999999999999983e35 < a < 9.49999999999999979e168Initial program 98.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6437.9
Applied rewrites37.9%
Final simplification42.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
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Final simplification25.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)))