
(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 (* a (+ (/ x a) (fma z (+ b (/ y a)) t)))))
(if (<= a -9e+45)
t_1
(if (<= a 8.5e-18) (+ (+ (+ x (* z y)) (* a t)) (* b (* a z))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * ((x / a) + fma(z, (b + (y / a)), t));
double tmp;
if (a <= -9e+45) {
tmp = t_1;
} else if (a <= 8.5e-18) {
tmp = ((x + (z * y)) + (a * t)) + (b * (a * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(Float64(x / a) + fma(z, Float64(b + Float64(y / a)), t))) tmp = 0.0 if (a <= -9e+45) tmp = t_1; elseif (a <= 8.5e-18) tmp = Float64(Float64(Float64(x + Float64(z * y)) + Float64(a * t)) + Float64(b * Float64(a * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(N[(x / a), $MachinePrecision] + N[(z * N[(b + N[(y / a), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -9e+45], t$95$1, If[LessEqual[a, 8.5e-18], N[(N[(N[(x + N[(z * y), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(\frac{x}{a} + \mathsf{fma}\left(z, b + \frac{y}{a}, t\right)\right)\\
\mathbf{if}\;a \leq -9 \cdot 10^{+45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 8.5 \cdot 10^{-18}:\\
\;\;\;\;\left(\left(x + z \cdot y\right) + a \cdot t\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -8.9999999999999997e45 or 8.4999999999999995e-18 < a Initial program 83.4%
Taylor expanded in a around inf
*-lowering-*.f64N/A
+-commutativeN/A
+-commutativeN/A
associate-+l+N/A
associate-+l+N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-/l*N/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6499.9
Simplified99.9%
if -8.9999999999999997e45 < a < 8.4999999999999995e-18Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (+ (+ x (* z y)) (* a t)) (* b (* a z))))) (if (<= t_1 INFINITY) t_1 (fma z y (* a (fma b z t))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((x + (z * y)) + (a * t)) + (b * (a * z));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(z, y, (a * fma(b, z, t)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(x + Float64(z * y)) + Float64(a * t)) + Float64(b * Float64(a * z))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(z, y, 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[(z * y), $MachinePrecision]), $MachinePrecision] + N[(a * t), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(z * y + N[(a * N[(b * z + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x + z \cdot y\right) + a \cdot t\right) + b \cdot \left(a \cdot z\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, a \cdot \mathsf{fma}\left(b, z, t\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 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.f6491.7
Simplified91.7%
Final simplification97.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma z (fma a b y) x))) (if (<= z -1.06e-22) t_1 (if (<= z 5.5e+131) (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 <= -1.06e-22) {
tmp = t_1;
} else if (z <= 5.5e+131) {
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 <= -1.06e-22) tmp = t_1; elseif (z <= 5.5e+131) 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, -1.06e-22], t$95$1, If[LessEqual[z, 5.5e+131], 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 -1.06 \cdot 10^{-22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+131}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.06000000000000008e-22 or 5.49999999999999971e131 < z Initial program 87.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.f6492.9
Simplified92.9%
if -1.06000000000000008e-22 < z < 5.49999999999999971e131Initial program 97.1%
Taylor expanded in b around 0
Simplified92.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -4e+58) t_1 (if (<= a 1.4e+233) (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 = a * fma(b, z, t);
double tmp;
if (a <= -4e+58) {
tmp = t_1;
} else if (a <= 1.4e+233) {
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(a * fma(b, z, t)) tmp = 0.0 if (a <= -4e+58) tmp = t_1; elseif (a <= 1.4e+233) 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]), $MachinePrecision]}, If[LessEqual[a, -4e+58], t$95$1, If[LessEqual[a, 1.4e+233], N[(a * t + N[(z * y + x), $MachinePrecision]), $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 -4 \cdot 10^{+58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+233}:\\
\;\;\;\;\mathsf{fma}\left(a, t, \mathsf{fma}\left(z, y, x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.99999999999999978e58 or 1.40000000000000005e233 < a Initial program 81.8%
Taylor expanded in a around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6486.3
Simplified86.3%
if -3.99999999999999978e58 < a < 1.40000000000000005e233Initial program 97.2%
Taylor expanded in b around 0
Simplified89.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* a (fma b z t)))) (if (<= a -3.9e-13) t_1 (if (<= a 1.5e+26) (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.9e-13) {
tmp = t_1;
} else if (a <= 1.5e+26) {
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.9e-13) tmp = t_1; elseif (a <= 1.5e+26) 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.9e-13], t$95$1, If[LessEqual[a, 1.5e+26], 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.9 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.90000000000000004e-13 or 1.49999999999999999e26 < a Initial program 85.0%
Taylor expanded in a around inf
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6479.2
Simplified79.2%
if -3.90000000000000004e-13 < a < 1.49999999999999999e26Initial program 99.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6484.3
Simplified84.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.02e-67) (fma z y x) (if (<= z 5.2e+115) (fma a t x) (fma z y x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.02e-67) {
tmp = fma(z, y, x);
} else if (z <= 5.2e+115) {
tmp = fma(a, t, x);
} else {
tmp = fma(z, y, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.02e-67) tmp = fma(z, y, x); elseif (z <= 5.2e+115) tmp = fma(a, t, x); else tmp = fma(z, y, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.02e-67], N[(z * y + x), $MachinePrecision], If[LessEqual[z, 5.2e+115], N[(a * t + x), $MachinePrecision], N[(z * y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.02 \cdot 10^{-67}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, y, x\right)\\
\end{array}
\end{array}
if z < -1.01999999999999993e-67 or 5.2000000000000001e115 < z Initial program 87.9%
Taylor expanded in a around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6462.5
Simplified62.5%
if -1.01999999999999993e-67 < z < 5.2000000000000001e115Initial program 97.6%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6478.5
Simplified78.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.2e+108) (* z y) (if (<= z 1.85e+124) (fma a t x) (* z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.2e+108) {
tmp = z * y;
} else if (z <= 1.85e+124) {
tmp = fma(a, t, x);
} else {
tmp = z * y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.2e+108) tmp = Float64(z * y); elseif (z <= 1.85e+124) tmp = fma(a, t, x); else tmp = Float64(z * y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.2e+108], N[(z * y), $MachinePrecision], If[LessEqual[z, 1.85e+124], N[(a * t + x), $MachinePrecision], N[(z * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+108}:\\
\;\;\;\;z \cdot y\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+124}:\\
\;\;\;\;\mathsf{fma}\left(a, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot y\\
\end{array}
\end{array}
if z < -3.1999999999999999e108 or 1.85000000000000004e124 < z Initial program 81.6%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6454.3
Simplified54.3%
if -3.1999999999999999e108 < z < 1.85000000000000004e124Initial program 98.2%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f6471.2
Simplified71.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.25e-5) x (if (<= x 2.7e+140) (* z y) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.25e-5) {
tmp = x;
} else if (x <= 2.7e+140) {
tmp = z * y;
} 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.25d-5)) then
tmp = x
else if (x <= 2.7d+140) then
tmp = z * y
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.25e-5) {
tmp = x;
} else if (x <= 2.7e+140) {
tmp = z * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.25e-5: tmp = x elif x <= 2.7e+140: tmp = z * y else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.25e-5) tmp = x; elseif (x <= 2.7e+140) tmp = Float64(z * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.25e-5) tmp = x; elseif (x <= 2.7e+140) tmp = z * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.25e-5], x, If[LessEqual[x, 2.7e+140], N[(z * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.25 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.7 \cdot 10^{+140}:\\
\;\;\;\;z \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.25000000000000014e-5 or 2.70000000000000018e140 < x Initial program 95.3%
Taylor expanded in x around inf
Simplified55.8%
if -2.25000000000000014e-5 < x < 2.70000000000000018e140Initial program 90.8%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6441.6
Simplified41.6%
(FPCore (x y z t a b) :precision binary64 (if (<= a -2.4e-8) (* a t) (if (<= a 5e+26) x (* a t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.4e-8) {
tmp = a * t;
} else if (a <= 5e+26) {
tmp = x;
} 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 <= (-2.4d-8)) then
tmp = a * t
else if (a <= 5d+26) then
tmp = x
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 <= -2.4e-8) {
tmp = a * t;
} else if (a <= 5e+26) {
tmp = x;
} else {
tmp = a * t;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -2.4e-8: tmp = a * t elif a <= 5e+26: tmp = x else: tmp = a * t return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.4e-8) tmp = Float64(a * t); elseif (a <= 5e+26) tmp = x; else tmp = Float64(a * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -2.4e-8) tmp = a * t; elseif (a <= 5e+26) tmp = x; else tmp = a * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.4e-8], N[(a * t), $MachinePrecision], If[LessEqual[a, 5e+26], x, N[(a * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-8}:\\
\;\;\;\;a \cdot t\\
\mathbf{elif}\;a \leq 5 \cdot 10^{+26}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;a \cdot t\\
\end{array}
\end{array}
if a < -2.39999999999999998e-8 or 5.0000000000000001e26 < a Initial program 84.9%
Taylor expanded in t around inf
*-lowering-*.f6444.3
Simplified44.3%
if -2.39999999999999998e-8 < a < 5.0000000000000001e26Initial program 99.9%
Taylor expanded in x around inf
Simplified47.7%
(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 92.7%
Taylor expanded in x around inf
Simplified29.0%
(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 2024195
(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)))