
(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 (+ (* b (* a z)) (+ (* a t) (+ (* z y) x))))) (if (<= t_1 INFINITY) t_1 (fma (fma b z t) a 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(b, z, t), a, 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(b, z, t), a, 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[(b * z + t), $MachinePrecision] * a + 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(b, z, t\right), a, 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 98.4%
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 y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6477.8
Applied rewrites77.8%
Final simplification97.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z y (fma t a x)))) (if (<= y -1.95e+84) t_1 (if (<= y 5.8e+98) (fma (fma b z t) a 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 (y <= -1.95e+84) {
tmp = t_1;
} else if (y <= 5.8e+98) {
tmp = fma(fma(b, z, t), a, 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 (y <= -1.95e+84) tmp = t_1; elseif (y <= 5.8e+98) tmp = fma(fma(b, z, t), a, 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[y, -1.95e+84], t$95$1, If[LessEqual[y, 5.8e+98], N[(N[(b * z + t), $MachinePrecision] * a + 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}\;y \leq -1.95 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+98}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(b, z, t\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.95000000000000008e84 or 5.8000000000000002e98 < y Initial program 95.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.f6492.0
Applied rewrites92.0%
if -1.95000000000000008e84 < y < 5.8000000000000002e98Initial program 94.8%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6489.1
Applied rewrites89.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma (fma b a y) z x))) (if (<= z -2.8e+159) t_1 (if (<= z 7.5e+82) (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(fma(b, a, y), z, x);
double tmp;
if (z <= -2.8e+159) {
tmp = t_1;
} else if (z <= 7.5e+82) {
tmp = fma(z, y, fma(t, a, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(fma(b, a, y), z, x) tmp = 0.0 if (z <= -2.8e+159) tmp = t_1; elseif (z <= 7.5e+82) 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 + x), $MachinePrecision]}, If[LessEqual[z, -2.8e+159], t$95$1, If[LessEqual[z, 7.5e+82], N[(z * y + N[(t * a + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\mathsf{fma}\left(b, a, y\right), z, x\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.8000000000000001e159 or 7.4999999999999999e82 < z Initial program 92.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.f6493.7
Applied rewrites93.7%
if -2.8000000000000001e159 < z < 7.4999999999999999e82Initial program 96.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.f6485.1
Applied rewrites85.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -2.9e+159) t_1 (if (<= z 5.8e+84) (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 <= -2.9e+159) {
tmp = t_1;
} else if (z <= 5.8e+84) {
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 <= -2.9e+159) tmp = t_1; elseif (z <= 5.8e+84) 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, -2.9e+159], t$95$1, If[LessEqual[z, 5.8e+84], 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 -2.9 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(z, y, \mathsf{fma}\left(t, a, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.90000000000000014e159 or 5.79999999999999977e84 < z Initial program 92.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6486.3
Applied rewrites86.3%
if -2.90000000000000014e159 < z < 5.79999999999999977e84Initial program 96.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.f6485.1
Applied rewrites85.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (fma b a y) z))) (if (<= z -7.5e+58) t_1 (if (<= z 9e-44) (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 <= -7.5e+58) {
tmp = t_1;
} else if (z <= 9e-44) {
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 <= -7.5e+58) tmp = t_1; elseif (z <= 9e-44) 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, -7.5e+58], t$95$1, If[LessEqual[z, 9e-44], 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 -7.5 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-44}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5000000000000001e58 or 8.9999999999999997e-44 < z Initial program 92.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6475.2
Applied rewrites75.2%
if -7.5000000000000001e58 < z < 8.9999999999999997e-44Initial program 97.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6476.1
Applied rewrites76.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.8e+140) (fma t a x) (if (<= t 7.5e-46) (fma (* a z) b 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+140) {
tmp = fma(t, a, x);
} else if (t <= 7.5e-46) {
tmp = fma((a * z), b, x);
} else {
tmp = fma(t, a, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.8e+140) tmp = fma(t, a, x); elseif (t <= 7.5e-46) tmp = fma(Float64(a * z), b, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.8e+140], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 7.5e-46], N[(N[(a * z), $MachinePrecision] * b + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+140}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot z, b, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if t < -4.7999999999999999e140 or 7.50000000000000027e-46 < t Initial program 93.5%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6471.0
Applied rewrites71.0%
if -4.7999999999999999e140 < t < 7.50000000000000027e-46Initial program 96.0%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6477.6
Applied rewrites77.6%
Taylor expanded in t around 0
Applied rewrites66.7%
Final simplification68.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.3e+150) (fma z y x) (if (<= z 1.35e+91) (fma t a x) (* (* b a) z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.3e+150) {
tmp = fma(z, y, x);
} else if (z <= 1.35e+91) {
tmp = fma(t, a, x);
} else {
tmp = (b * a) * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.3e+150) tmp = fma(z, y, x); elseif (z <= 1.35e+91) tmp = fma(t, a, x); else tmp = Float64(Float64(b * a) * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.3e+150], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 1.35e+91], N[(t * a + x), $MachinePrecision], N[(N[(b * a), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(b \cdot a\right) \cdot z\\
\end{array}
\end{array}
if z < -1.30000000000000003e150Initial program 93.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6458.3
Applied rewrites58.3%
if -1.30000000000000003e150 < z < 1.35e91Initial program 96.6%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6469.6
Applied rewrites69.6%
if 1.35e91 < z Initial program 89.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6454.8
Applied rewrites54.8%
Applied rewrites54.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.4e-63) (fma t a x) (if (<= t 1.15e-33) (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 (t <= -1.4e-63) {
tmp = fma(t, a, x);
} else if (t <= 1.15e-33) {
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 (t <= -1.4e-63) tmp = fma(t, a, x); elseif (t <= 1.15e-33) tmp = fma(z, y, x); else tmp = fma(t, a, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.4e-63], N[(t * a + x), $MachinePrecision], If[LessEqual[t, 1.15e-33], N[(z * y + x), $MachinePrecision], N[(t * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{-63}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\end{array}
\end{array}
if t < -1.4000000000000001e-63 or 1.14999999999999993e-33 < t Initial program 93.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6466.2
Applied rewrites66.2%
if -1.4000000000000001e-63 < t < 1.14999999999999993e-33Initial program 97.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6464.2
Applied rewrites64.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -6.2e+152) (* z y) (if (<= z 5.5e+89) (fma t a x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.2e+152) {
tmp = z * y;
} else if (z <= 5.5e+89) {
tmp = fma(t, a, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.2e+152) tmp = Float64(z * y); elseif (z <= 5.5e+89) tmp = fma(t, a, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.2e+152], N[(z * y), $MachinePrecision], If[LessEqual[z, 5.5e+89], N[(t * a + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+152}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+89}:\\
\;\;\;\;\mathsf{fma}\left(t, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -6.2e152 or 5.49999999999999976e89 < z Initial program 91.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6445.0
Applied rewrites45.0%
if -6.2e152 < z < 5.49999999999999976e89Initial program 96.6%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6470.0
Applied rewrites70.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -5.2e-69) (* a t) (if (<= t 1.15e-33) (* z y) (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -5.2e-69) {
tmp = a * t;
} else if (t <= 1.15e-33) {
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 <= (-5.2d-69)) then
tmp = a * t
else if (t <= 1.15d-33) 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 <= -5.2e-69) {
tmp = a * t;
} else if (t <= 1.15e-33) {
tmp = z * y;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -5.2e-69: tmp = a * t elif t <= 1.15e-33: tmp = z * y else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -5.2e-69) tmp = Float64(a * t); elseif (t <= 1.15e-33) 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 <= -5.2e-69) tmp = a * t; elseif (t <= 1.15e-33) tmp = z * y; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -5.2e-69], N[(a * t), $MachinePrecision], If[LessEqual[t, 1.15e-33], N[(z * y), $MachinePrecision], N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.2 \cdot 10^{-69}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-33}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if t < -5.2000000000000004e-69 or 1.14999999999999993e-33 < t Initial program 93.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6451.7
Applied rewrites51.7%
if -5.2000000000000004e-69 < t < 1.14999999999999993e-33Initial program 97.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6432.5
Applied rewrites32.5%
Final simplification43.8%
(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.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6432.2
Applied rewrites32.2%
Final simplification32.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 2024268
(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)))