
(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 15 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 5e+295) t_1 (fma z (+ y (* a (+ b (/ t z)))) x))))
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 <= 5e+295) {
tmp = t_1;
} else {
tmp = fma(z, (y + (a * (b + (t / z)))), x);
}
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 <= 5e+295) tmp = t_1; else tmp = fma(z, Float64(y + Float64(a * Float64(b + Float64(t / z)))), x); 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, 5e+295], t$95$1, N[(z * N[(y + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $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 5 \cdot 10^{+295}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y + a \cdot \left(b + \frac{t}{z}\right), x\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < 4.99999999999999991e295Initial program 97.8%
if 4.99999999999999991e295 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 65.1%
Taylor expanded in z around inf
associate-+r+N/A
+-commutativeN/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
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64100.0
Simplified100.0%
Final simplification98.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z (+ y (* a (+ b (/ t z)))) x))) (if (<= z -1.22e-79) t_1 (if (<= z 6.7e-135) (fma a (fma b z t) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(z, (y + (a * (b + (t / z)))), x);
double tmp;
if (z <= -1.22e-79) {
tmp = t_1;
} else if (z <= 6.7e-135) {
tmp = fma(a, fma(b, z, t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(z, Float64(y + Float64(a * Float64(b + Float64(t / z)))), x) tmp = 0.0 if (z <= -1.22e-79) tmp = t_1; elseif (z <= 6.7e-135) tmp = fma(a, fma(b, z, t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y + N[(a * N[(b + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.22e-79], t$95$1, If[LessEqual[z, 6.7e-135], N[(a * N[(b * z + t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, y + a \cdot \left(b + \frac{t}{z}\right), x\right)\\
\mathbf{if}\;z \leq -1.22 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{-135}:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.22e-79 or 6.7000000000000004e-135 < z Initial program 86.8%
Taylor expanded in z around inf
associate-+r+N/A
+-commutativeN/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
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6498.8
Simplified98.8%
if -1.22e-79 < z < 6.7000000000000004e-135Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6493.1
Simplified93.1%
Final simplification97.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.55e+186)
(* z (fma a b y))
(if (<= z -1.35e-78)
(fma z y (* a (fma b z t)))
(if (<= z 8.4e-135) (fma a (fma b z t) x) (fma z (+ y (* a b)) x)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.55e+186) {
tmp = z * fma(a, b, y);
} else if (z <= -1.35e-78) {
tmp = fma(z, y, (a * fma(b, z, t)));
} else if (z <= 8.4e-135) {
tmp = fma(a, fma(b, z, t), x);
} else {
tmp = fma(z, (y + (a * b)), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.55e+186) tmp = Float64(z * fma(a, b, y)); elseif (z <= -1.35e-78) tmp = fma(z, y, Float64(a * fma(b, z, t))); elseif (z <= 8.4e-135) tmp = fma(a, fma(b, z, t), x); else tmp = fma(z, Float64(y + Float64(a * b)), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.55e+186], N[(z * N[(a * b + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.35e-78], N[(z * y + N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.4e-135], N[(a * N[(b * z + t), $MachinePrecision] + x), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+186}:\\
\;\;\;\;z \cdot \mathsf{fma}\left(a, b, y\right)\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-78}:\\
\;\;\;\;\mathsf{fma}\left(z, y, a \cdot \mathsf{fma}\left(b, z, t\right)\right)\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{-135}:\\
\;\;\;\;\mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y + a \cdot b, x\right)\\
\end{array}
\end{array}
if z < -1.5500000000000001e186Initial program 85.3%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6496.5
Simplified96.5%
if -1.5500000000000001e186 < z < -1.34999999999999997e-78Initial program 88.2%
Taylor expanded in x around 0
associate-+r+N/A
distribute-lft-inN/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6490.4
Simplified90.4%
if -1.34999999999999997e-78 < z < 8.4000000000000001e-135Initial program 99.4%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6493.1
Simplified93.1%
if 8.4000000000000001e-135 < z Initial program 86.4%
Taylor expanded in z around inf
associate-+r+N/A
+-commutativeN/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
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6498.0
Simplified98.0%
Taylor expanded in t around 0
*-lowering-*.f6492.2
Simplified92.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6.5e-29) (fma z (fma a b y) x) (if (<= b 3800000000000.0) (fma a t (fma z y x)) (fma z (+ y (* a b)) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.5e-29) {
tmp = fma(z, fma(a, b, y), x);
} else if (b <= 3800000000000.0) {
tmp = fma(a, t, fma(z, y, x));
} else {
tmp = fma(z, (y + (a * b)), x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6.5e-29) tmp = fma(z, fma(a, b, y), x); elseif (b <= 3800000000000.0) tmp = fma(a, t, fma(z, y, x)); else tmp = fma(z, Float64(y + Float64(a * b)), x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6.5e-29], N[(z * N[(a * b + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[b, 3800000000000.0], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.5 \cdot 10^{-29}:\\
\;\;\;\;\mathsf{fma}\left(z, \mathsf{fma}\left(a, b, y\right), x\right)\\
\mathbf{elif}\;b \leq 3800000000000:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y + a \cdot b, x\right)\\
\end{array}
\end{array}
if b < -6.5e-29Initial program 92.2%
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.f6482.2
Simplified82.2%
if -6.5e-29 < b < 3.8e12Initial program 89.8%
Taylor expanded in b around 0
Simplified93.6%
if 3.8e12 < b Initial program 92.3%
Taylor expanded in z around inf
associate-+r+N/A
+-commutativeN/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
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6490.9
Simplified90.9%
Taylor expanded in t around 0
*-lowering-*.f6491.4
Simplified91.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -0.019)
(fma a t x)
(if (<= t -8.2e-55)
(* (* z a) b)
(if (<= t 1.9e+91) (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 <= -0.019) {
tmp = fma(a, t, x);
} else if (t <= -8.2e-55) {
tmp = (z * a) * b;
} else if (t <= 1.9e+91) {
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 <= -0.019) tmp = fma(a, t, x); elseif (t <= -8.2e-55) tmp = Float64(Float64(z * a) * b); elseif (t <= 1.9e+91) 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, -0.019], N[(a * t + x), $MachinePrecision], If[LessEqual[t, -8.2e-55], N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision], If[LessEqual[t, 1.9e+91], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.019:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq -8.2 \cdot 10^{-55}:\\
\;\;\;\;\left(z \cdot a\right) \cdot b\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -0.0189999999999999995 or 1.8999999999999999e91 < t Initial program 89.7%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6470.5
Simplified70.5%
if -0.0189999999999999995 < t < -8.1999999999999996e-55Initial program 99.9%
Taylor expanded in z around inf
associate-+r+N/A
+-commutativeN/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
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-/l*N/A
distribute-lft-outN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6482.9
Simplified82.9%
Taylor expanded in a around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6473.8
Simplified73.8%
Taylor expanded in b around inf
Simplified73.8%
if -8.1999999999999996e-55 < t < 1.8999999999999999e91Initial program 91.1%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6464.1
Simplified64.1%
Final simplification66.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma z (fma a b y) x)))
(if (<= b -1.15e-20)
t_1
(if (<= b 120000000000.0) (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 (b <= -1.15e-20) {
tmp = t_1;
} else if (b <= 120000000000.0) {
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 (b <= -1.15e-20) tmp = t_1; elseif (b <= 120000000000.0) 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[b, -1.15e-20], t$95$1, If[LessEqual[b, 120000000000.0], 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}\;b \leq -1.15 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 120000000000:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.15e-20 or 1.2e11 < b Initial program 92.2%
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.f6486.1
Simplified86.1%
if -1.15e-20 < b < 1.2e11Initial program 89.8%
Taylor expanded in b around 0
Simplified93.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma a (fma b z t) x))) (if (<= a -3.75e-25) t_1 (if (<= a 3.8e+104) (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(a, fma(b, z, t), x);
double tmp;
if (a <= -3.75e-25) {
tmp = t_1;
} else if (a <= 3.8e+104) {
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(a, fma(b, z, t), x) tmp = 0.0 if (a <= -3.75e-25) tmp = t_1; elseif (a <= 3.8e+104) 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[(a * N[(b * z + t), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -3.75e-25], t$95$1, If[LessEqual[a, 3.8e+104], N[(a * t + N[(z * y + x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \mathsf{fma}\left(b, z, t\right), x\right)\\
\mathbf{if}\;a \leq -3.75 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.74999999999999994e-25 or 3.79999999999999969e104 < a Initial program 83.5%
Taylor expanded in y around 0
distribute-lft-inN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6489.2
Simplified89.2%
if -3.74999999999999994e-25 < a < 3.79999999999999969e104Initial program 96.9%
Taylor expanded in b around 0
Simplified85.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (fma a b y)))) (if (<= z -2.65e+85) t_1 (if (<= z 1.05e+117) (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 = z * fma(a, b, y);
double tmp;
if (z <= -2.65e+85) {
tmp = t_1;
} else if (z <= 1.05e+117) {
tmp = fma(a, t, fma(z, y, 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 <= -2.65e+85) tmp = t_1; elseif (z <= 1.05e+117) 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]), $MachinePrecision]}, If[LessEqual[z, -2.65e+85], t$95$1, If[LessEqual[z, 1.05e+117], N[(a * t + N[(z * y + x), $MachinePrecision]), $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 -2.65 \cdot 10^{+85}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.65e85 or 1.0500000000000001e117 < z Initial program 80.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6486.5
Simplified86.5%
if -2.65e85 < z < 1.0500000000000001e117Initial program 97.7%
Taylor expanded in b around 0
Simplified84.4%
(FPCore (x y z t a b) :precision binary64 (if (<= z -2.1e+40) (* y z) (if (<= z -8.2e-190) (* t a) (if (<= z 1.6e-81) x (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.1e+40) {
tmp = y * z;
} else if (z <= -8.2e-190) {
tmp = t * a;
} else if (z <= 1.6e-81) {
tmp = x;
} else {
tmp = y * z;
}
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 (z <= (-2.1d+40)) then
tmp = y * z
else if (z <= (-8.2d-190)) then
tmp = t * a
else if (z <= 1.6d-81) then
tmp = x
else
tmp = y * z
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 (z <= -2.1e+40) {
tmp = y * z;
} else if (z <= -8.2e-190) {
tmp = t * a;
} else if (z <= 1.6e-81) {
tmp = x;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -2.1e+40: tmp = y * z elif z <= -8.2e-190: tmp = t * a elif z <= 1.6e-81: tmp = x else: tmp = y * z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.1e+40) tmp = Float64(y * z); elseif (z <= -8.2e-190) tmp = Float64(t * a); elseif (z <= 1.6e-81) tmp = x; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -2.1e+40) tmp = y * z; elseif (z <= -8.2e-190) tmp = t * a; elseif (z <= 1.6e-81) tmp = x; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.1e+40], N[(y * z), $MachinePrecision], If[LessEqual[z, -8.2e-190], N[(t * a), $MachinePrecision], If[LessEqual[z, 1.6e-81], x, N[(y * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+40}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-190}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-81}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -2.1000000000000001e40 or 1.6e-81 < z Initial program 85.3%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6446.0
Simplified46.0%
if -2.1000000000000001e40 < z < -8.2000000000000004e-190Initial program 97.1%
Taylor expanded in t around inf
*-lowering-*.f6441.2
Simplified41.2%
if -8.2000000000000004e-190 < z < 1.6e-81Initial program 99.9%
Taylor expanded in x around inf
Simplified52.2%
Final simplification46.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* z (fma a b y)))) (if (<= z -1.7e+40) t_1 (if (<= z 9e-73) (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 <= -1.7e+40) {
tmp = t_1;
} else if (z <= 9e-73) {
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 <= -1.7e+40) tmp = t_1; elseif (z <= 9e-73) 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, -1.7e+40], t$95$1, If[LessEqual[z, 9e-73], 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 -1.7 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-73}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.69999999999999994e40 or 9e-73 < z Initial program 85.1%
Taylor expanded in z around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6479.8
Simplified79.8%
if -1.69999999999999994e40 < z < 9e-73Initial program 98.7%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6474.7
Simplified74.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -3.4e-17) t_1 (if (<= a 2.7e+77) (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.4e-17) {
tmp = t_1;
} else if (a <= 2.7e+77) {
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.4e-17) tmp = t_1; elseif (a <= 2.7e+77) 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.4e-17], t$95$1, If[LessEqual[a, 2.7e+77], 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.4 \cdot 10^{-17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.3999999999999998e-17 or 2.6999999999999998e77 < a Initial program 83.0%
Taylor expanded in a around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6477.5
Simplified77.5%
if -3.3999999999999998e-17 < a < 2.6999999999999998e77Initial program 98.2%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6475.1
Simplified75.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -3.4e+15) (fma a t x) (if (<= t 4.9e+90) (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.4e+15) {
tmp = fma(a, t, x);
} else if (t <= 4.9e+90) {
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.4e+15) tmp = fma(a, t, x); elseif (t <= 4.9e+90) 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.4e+15], N[(a * t + x), $MachinePrecision], If[LessEqual[t, 4.9e+90], N[(z * y + x), $MachinePrecision], N[(a * t + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{elif}\;t \leq 4.9 \cdot 10^{+90}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\end{array}
\end{array}
if t < -3.4e15 or 4.9000000000000003e90 < t Initial program 89.4%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6470.6
Simplified70.6%
if -3.4e15 < t < 4.9000000000000003e90Initial program 91.8%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6461.8
Simplified61.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -9e+147) (* y z) (if (<= z 1.9e+122) (fma a t x) (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9e+147) {
tmp = y * z;
} else if (z <= 1.9e+122) {
tmp = fma(a, t, x);
} else {
tmp = y * z;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9e+147) tmp = Float64(y * z); elseif (z <= 1.9e+122) tmp = fma(a, t, x); else tmp = Float64(y * z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9e+147], N[(y * z), $MachinePrecision], If[LessEqual[z, 1.9e+122], N[(a * t + x), $MachinePrecision], N[(y * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+147}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -9.00000000000000016e147 or 1.8999999999999999e122 < z Initial program 80.1%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6454.9
Simplified54.9%
if -9.00000000000000016e147 < z < 1.8999999999999999e122Initial program 96.2%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6462.5
Simplified62.5%
Final simplification60.0%
(FPCore (x y z t a b) :precision binary64 (if (<= a -240000000.0) (* t a) (if (<= a 1.26e+82) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -240000000.0) {
tmp = t * a;
} else if (a <= 1.26e+82) {
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 (a <= (-240000000.0d0)) then
tmp = t * a
else if (a <= 1.26d+82) 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 (a <= -240000000.0) {
tmp = t * a;
} else if (a <= 1.26e+82) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -240000000.0: tmp = t * a elif a <= 1.26e+82: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -240000000.0) tmp = Float64(t * a); elseif (a <= 1.26e+82) 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 (a <= -240000000.0) tmp = t * a; elseif (a <= 1.26e+82) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -240000000.0], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.26e+82], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -240000000:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 1.26 \cdot 10^{+82}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -2.4e8 or 1.2600000000000001e82 < a Initial program 82.4%
Taylor expanded in t around inf
*-lowering-*.f6438.9
Simplified38.9%
if -2.4e8 < a < 1.2600000000000001e82Initial program 98.2%
Taylor expanded in x around inf
Simplified34.7%
Final simplification36.6%
(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 90.9%
Taylor expanded in x around inf
Simplified24.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 2024201
(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)))