
(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 14 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 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b))))
(if (<= t_1 INFINITY)
t_1
(* b (fma z (+ a (/ y b)) (fma a (/ t b) (/ x b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = b * fma(z, (a + (y / b)), fma(a, (t / b), (x / b)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(b * fma(z, Float64(a + Float64(y / b)), fma(a, Float64(t / b), Float64(x / b)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(b * N[(z * N[(a + N[(y / b), $MachinePrecision]), $MachinePrecision] + N[(a * N[(t / b), $MachinePrecision] + N[(x / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;b \cdot \mathsf{fma}\left(z, a + \frac{y}{b}, \mathsf{fma}\left(a, \frac{t}{b}, \frac{x}{b}\right)\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.2%
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 inf
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64100.0
Simplified100.0%
Final simplification97.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* a (fma b z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = a * fma(b, z, t);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(z * a) * b)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(a * fma(b, z, t)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(z \cdot a\right) \cdot b\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \mathsf{fma}\left(b, z, t\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.2%
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 a around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6490.0
Simplified90.0%
Final simplification96.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -2e+221)
(* z (* a b))
(if (<= b -3.8e+29)
(fma a t x)
(if (<= b 2.65e-6) (fma z y x) (* (* z a) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -2e+221) {
tmp = z * (a * b);
} else if (b <= -3.8e+29) {
tmp = fma(a, t, x);
} else if (b <= 2.65e-6) {
tmp = fma(z, y, x);
} else {
tmp = (z * a) * b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -2e+221) tmp = Float64(z * Float64(a * b)); elseif (b <= -3.8e+29) tmp = fma(a, t, x); elseif (b <= 2.65e-6) tmp = fma(z, y, x); else tmp = Float64(Float64(z * a) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -2e+221], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -3.8e+29], N[(a * t + x), $MachinePrecision], If[LessEqual[b, 2.65e-6], N[(z * y + x), $MachinePrecision], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2 \cdot 10^{+221}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq -3.8 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;b \leq 2.65 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\end{array}
\end{array}
if b < -2.0000000000000001e221Initial program 95.1%
Taylor expanded in x around inf
associate-+r+N/A
associate-+r+N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified76.6%
Taylor expanded in b around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6467.4
Simplified67.4%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6467.7
Applied egg-rr67.7%
if -2.0000000000000001e221 < b < -3.79999999999999971e29Initial program 94.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6480.0
Simplified80.0%
if -3.79999999999999971e29 < b < 2.65e-6Initial program 92.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6467.4
Simplified67.4%
if 2.65e-6 < b Initial program 94.4%
Taylor expanded in x around inf
associate-+r+N/A
associate-+r+N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified82.8%
Taylor expanded in b around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.9
Simplified64.9%
Final simplification68.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= b -7.5e+220)
(* a (* z b))
(if (<= b -1.8e+29)
(fma a t x)
(if (<= b 2.65e-6) (fma z y x) (* (* z a) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -7.5e+220) {
tmp = a * (z * b);
} else if (b <= -1.8e+29) {
tmp = fma(a, t, x);
} else if (b <= 2.65e-6) {
tmp = fma(z, y, x);
} else {
tmp = (z * a) * b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -7.5e+220) tmp = Float64(a * Float64(z * b)); elseif (b <= -1.8e+29) tmp = fma(a, t, x); elseif (b <= 2.65e-6) tmp = fma(z, y, x); else tmp = Float64(Float64(z * a) * b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -7.5e+220], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, -1.8e+29], N[(a * t + x), $MachinePrecision], If[LessEqual[b, 2.65e-6], N[(z * y + x), $MachinePrecision], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -7.5 \cdot 10^{+220}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;b \leq -1.8 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;b \leq 2.65 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\end{array}
\end{array}
if b < -7.5000000000000003e220Initial program 95.1%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f6467.5
Simplified67.5%
if -7.5000000000000003e220 < b < -1.79999999999999988e29Initial program 94.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6480.0
Simplified80.0%
if -1.79999999999999988e29 < b < 2.65e-6Initial program 92.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6467.4
Simplified67.4%
if 2.65e-6 < b Initial program 94.4%
Taylor expanded in x around inf
associate-+r+N/A
associate-+r+N/A
distribute-lft-inN/A
*-commutativeN/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
Simplified82.8%
Taylor expanded in b around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6464.9
Simplified64.9%
Final simplification68.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= b -1.5e+221)
t_1
(if (<= b -1.15e+29) (fma a t x) (if (<= b 2.65e-6) (fma z y x) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (b <= -1.5e+221) {
tmp = t_1;
} else if (b <= -1.15e+29) {
tmp = fma(a, t, x);
} else if (b <= 2.65e-6) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(z * b)) tmp = 0.0 if (b <= -1.5e+221) tmp = t_1; elseif (b <= -1.15e+29) tmp = fma(a, t, x); elseif (b <= 2.65e-6) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.5e+221], t$95$1, If[LessEqual[b, -1.15e+29], N[(a * t + x), $MachinePrecision], If[LessEqual[b, 2.65e-6], N[(z * y + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;b \leq -1.5 \cdot 10^{+221}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -1.15 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;b \leq 2.65 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.5000000000000001e221 or 2.65e-6 < b Initial program 94.6%
Taylor expanded in b around inf
*-lowering-*.f64N/A
*-lowering-*.f6464.5
Simplified64.5%
if -1.5000000000000001e221 < b < -1.1500000000000001e29Initial program 94.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6480.0
Simplified80.0%
if -1.1500000000000001e29 < b < 2.65e-6Initial program 92.4%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6467.4
Simplified67.4%
Final simplification68.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z (fma a b y) x))) (if (<= z -18000.0) t_1 (if (<= z 2e-51) (fma a t (fma z y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, fma(a, b, y), x);
double tmp;
if (z <= -18000.0) {
tmp = t_1;
} else if (z <= 2e-51) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, fma(a, b, y), x) tmp = 0.0 if (z <= -18000.0) tmp = t_1; elseif (z <= 2e-51) tmp = fma(a, t, fma(z, y, x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -18000.0], t$95$1, If[LessEqual[z, 2e-51], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\mathbf{if}\;z \leq -18000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -18000 or 2e-51 < z Initial program 89.0%
Taylor expanded in t around 0
+-commutativeN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6489.5
Simplified89.5%
if -18000 < z < 2e-51Initial program 99.1%
Taylor expanded in b around 0
Simplified90.6%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6.2e+221) (* z (fma a b y)) (if (<= b 5.9e+82) (fma a t (fma z y x)) (fma (* z a) b x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.2e+221) {
tmp = z * fma(a, b, y);
} else if (b <= 5.9e+82) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = fma((z * a), b, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6.2e+221) tmp = Float64(z * fma(a, b, y)); elseif (b <= 5.9e+82) tmp = fma(a, t, fma(z, y, x)); else tmp = fma(Float64(z * a), b, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6.2e+221], N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.9e+82], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], N[(N[(z * a), $MachinePrecision] * b + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.2 \cdot 10^{+221}:\\
\;\;\;\;z \cdot \mathsf{fma}\left(a, b, y\right)\\
\mathbf{elif}\;b \leq 5.9 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot a, b, x\right)\\
\end{array}
\end{array}
if b < -6.20000000000000013e221Initial program 95.1%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6486.2
Simplified86.2%
if -6.20000000000000013e221 < b < 5.8999999999999997e82Initial program 93.0%
Taylor expanded in b around 0
Simplified87.7%
if 5.8999999999999997e82 < b Initial program 94.2%
Taylor expanded in x around inf
Simplified85.1%
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6485.1
Applied egg-rr85.1%
Final simplification87.0%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.6e+148) x (if (<= x 2.2e-182) (* t a) (if (<= x 2.2e+99) (* y z) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.6e+148) {
tmp = x;
} else if (x <= 2.2e-182) {
tmp = t * a;
} else if (x <= 2.2e+99) {
tmp = y * z;
} else {
tmp = x;
}
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 (x <= (-2.6d+148)) then
tmp = x
else if (x <= 2.2d-182) then
tmp = t * a
else if (x <= 2.2d+99) then
tmp = y * z
else
tmp = x
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 (x <= -2.6e+148) {
tmp = x;
} else if (x <= 2.2e-182) {
tmp = t * a;
} else if (x <= 2.2e+99) {
tmp = y * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.6e+148: tmp = x elif x <= 2.2e-182: tmp = t * a elif x <= 2.2e+99: tmp = y * z else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.6e+148) tmp = x; elseif (x <= 2.2e-182) tmp = Float64(t * a); elseif (x <= 2.2e+99) tmp = Float64(y * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.6e+148) tmp = x; elseif (x <= 2.2e-182) tmp = t * a; elseif (x <= 2.2e+99) tmp = y * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.6e+148], x, If[LessEqual[x, 2.2e-182], N[(t * a), $MachinePrecision], If[LessEqual[x, 2.2e+99], N[(y * z), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{+148}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-182}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+99}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.6e148 or 2.19999999999999978e99 < x Initial program 94.9%
Taylor expanded in x around inf
Simplified55.7%
if -2.6e148 < x < 2.2e-182Initial program 95.0%
Taylor expanded in t around inf
*-lowering-*.f6437.6
Simplified37.6%
if 2.2e-182 < x < 2.19999999999999978e99Initial program 87.9%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6446.1
Simplified46.1%
Final simplification44.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (fma a b y)))) (if (<= z -2050000000000.0) t_1 (if (<= z 1.5e-51) (fma a t x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * fma(a, b, y);
double tmp;
if (z <= -2050000000000.0) {
tmp = t_1;
} else if (z <= 1.5e-51) {
tmp = fma(a, t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * fma(a, b, y)) tmp = 0.0 if (z <= -2050000000000.0) tmp = t_1; elseif (z <= 1.5e-51) 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[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2050000000000.0], t$95$1, If[LessEqual[z, 1.5e-51], N[(a * t + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \mathsf{fma}\left(a, b, y\right)\\
\mathbf{if}\;z \leq -2050000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-51}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.05e12 or 1.50000000000000001e-51 < z Initial program 89.0%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6478.9
Simplified78.9%
if -2.05e12 < z < 1.50000000000000001e-51Initial program 99.1%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6480.8
Simplified80.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -3.6e-6) t_1 (if (<= a 6.5e-38) (fma z y x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * fma(b, z, t);
double tmp;
if (a <= -3.6e-6) {
tmp = t_1;
} else if (a <= 6.5e-38) {
tmp = fma(z, y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * fma(b, z, t)) tmp = 0.0 if (a <= -3.6e-6) tmp = t_1; elseif (a <= 6.5e-38) tmp = fma(z, y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.6e-6], t$95$1, If[LessEqual[a, 6.5e-38], N[(z * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \mathsf{fma}\left(b, z, t\right)\\
\mathbf{if}\;a \leq -3.6 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.59999999999999984e-6 or 6.49999999999999949e-38 < a Initial program 88.4%
Taylor expanded in a around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6473.7
Simplified73.7%
if -3.59999999999999984e-6 < a < 6.49999999999999949e-38Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6477.0
Simplified77.0%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.7e+180) (fma a t x) (if (<= t 1.9e-52) (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 (t <= -3.7e+180) {
tmp = fma(a, t, x);
} else if (t <= 1.9e-52) {
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 (t <= -3.7e+180) tmp = fma(a, t, x); elseif (t <= 1.9e-52) tmp = fma(z, y, x); else tmp = fma(a, t, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.7e+180], N[(a * t + x), $MachinePrecision], If[LessEqual[t, 1.9e-52], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{+180}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -3.7000000000000002e180 or 1.9000000000000002e-52 < t Initial program 89.1%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6468.8
Simplified68.8%
if -3.7000000000000002e180 < t < 1.9000000000000002e-52Initial program 95.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6464.7
Simplified64.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.02e+132) (* y z) (if (<= y 5.6e+208) (fma a t x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.02e+132) {
tmp = y * z;
} else if (y <= 5.6e+208) {
tmp = fma(a, t, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.02e+132) tmp = Float64(y * z); elseif (y <= 5.6e+208) tmp = fma(a, t, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.02e+132], N[(y * z), $MachinePrecision], If[LessEqual[y, 5.6e+208], N[(a * t + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.02 \cdot 10^{+132}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if y < -1.0200000000000001e132 or 5.60000000000000045e208 < y Initial program 90.7%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6468.9
Simplified68.9%
if -1.0200000000000001e132 < y < 5.60000000000000045e208Initial program 94.1%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6456.0
Simplified56.0%
Final simplification58.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.02e+70) (* t a) (if (<= t 3.5e-75) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.02e+70) {
tmp = t * a;
} else if (t <= 3.5e-75) {
tmp = x;
} else {
tmp = t * a;
}
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 <= (-1.02d+70)) then
tmp = t * a
else if (t <= 3.5d-75) then
tmp = x
else
tmp = t * a
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 <= -1.02e+70) {
tmp = t * a;
} else if (t <= 3.5e-75) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.02e+70: tmp = t * a elif t <= 3.5e-75: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.02e+70) tmp = Float64(t * a); elseif (t <= 3.5e-75) tmp = x; else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.02e+70) tmp = t * a; elseif (t <= 3.5e-75) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.02e+70], N[(t * a), $MachinePrecision], If[LessEqual[t, 3.5e-75], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.02 \cdot 10^{+70}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-75}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -1.02e70 or 3.49999999999999985e-75 < t Initial program 89.2%
Taylor expanded in t around inf
*-lowering-*.f6448.5
Simplified48.5%
if -1.02e70 < t < 3.49999999999999985e-75Initial program 96.6%
Taylor expanded in x around inf
Simplified35.3%
Final simplification41.0%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 93.4%
Taylor expanded in x around inf
Simplified27.4%
(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 2024196
(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)))