
(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 (+ (+ (+ x (* y z)) (* t a)) (* (* z a) b)))) (if (<= t_1 INFINITY) t_1 (* a (+ t (* z 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 = a * (t + (z * b));
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = a * (t + (z * b));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = a * (t + (z * 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(a * Float64(t + Float64(z * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((x + (y * z)) + (t * a)) + ((z * a) * b); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = a * (t + (z * b)); end tmp_2 = 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[(t + N[(z * b), $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}:\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) < +inf.0Initial program 99.9%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
*-commutative0.0%
associate-*l*15.8%
Simplified15.8%
Taylor expanded in a around inf 84.2%
Final simplification98.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.5e+49) (not (<= a 1.25e+93))) (+ x (* a (+ t (* z b)))) (+ (+ (+ x (* y z)) (* t a)) (* z (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.5e+49) || !(a <= 1.25e+93)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b));
}
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 <= (-1.5d+49)) .or. (.not. (a <= 1.25d+93))) then
tmp = x + (a * (t + (z * b)))
else
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b))
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 <= -1.5e+49) || !(a <= 1.25e+93)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = ((x + (y * z)) + (t * a)) + (z * (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.5e+49) or not (a <= 1.25e+93): tmp = x + (a * (t + (z * b))) else: tmp = ((x + (y * z)) + (t * a)) + (z * (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.5e+49) || !(a <= 1.25e+93)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(z * Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.5e+49) || ~((a <= 1.25e+93))) tmp = x + (a * (t + (z * b))); else tmp = ((x + (y * z)) + (t * a)) + (z * (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.5e+49], N[Not[LessEqual[a, 1.25e+93]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.5 \cdot 10^{+49} \lor \neg \left(a \leq 1.25 \cdot 10^{+93}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x + y \cdot z\right) + t \cdot a\right) + z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -1.5000000000000001e49 or 1.25e93 < a Initial program 84.0%
associate-+l+84.0%
+-commutative84.0%
*-commutative84.0%
*-commutative84.0%
associate-*l*86.8%
distribute-rgt-out91.5%
fma-def93.4%
*-commutative93.4%
+-commutative93.4%
fma-def93.4%
Simplified93.4%
Taylor expanded in y around 0 94.4%
if -1.5000000000000001e49 < a < 1.25e93Initial program 98.6%
*-commutative98.6%
associate-*l*98.6%
Simplified98.6%
Final simplification96.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= z -4e+238)
t_1
(if (<= z -6.8e+192)
(* y z)
(if (<= z -4.9e-37)
t_1
(if (<= z 2e+79)
(+ x (* t a))
(if (or (<= z 2e+151) (not (<= z 6.8e+224))) t_1 (* y z))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (z <= -4e+238) {
tmp = t_1;
} else if (z <= -6.8e+192) {
tmp = y * z;
} else if (z <= -4.9e-37) {
tmp = t_1;
} else if (z <= 2e+79) {
tmp = x + (t * a);
} else if ((z <= 2e+151) || !(z <= 6.8e+224)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = a * (z * b)
if (z <= (-4d+238)) then
tmp = t_1
else if (z <= (-6.8d+192)) then
tmp = y * z
else if (z <= (-4.9d-37)) then
tmp = t_1
else if (z <= 2d+79) then
tmp = x + (t * a)
else if ((z <= 2d+151) .or. (.not. (z <= 6.8d+224))) then
tmp = t_1
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 t_1 = a * (z * b);
double tmp;
if (z <= -4e+238) {
tmp = t_1;
} else if (z <= -6.8e+192) {
tmp = y * z;
} else if (z <= -4.9e-37) {
tmp = t_1;
} else if (z <= 2e+79) {
tmp = x + (t * a);
} else if ((z <= 2e+151) || !(z <= 6.8e+224)) {
tmp = t_1;
} else {
tmp = y * z;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (z * b) tmp = 0 if z <= -4e+238: tmp = t_1 elif z <= -6.8e+192: tmp = y * z elif z <= -4.9e-37: tmp = t_1 elif z <= 2e+79: tmp = x + (t * a) elif (z <= 2e+151) or not (z <= 6.8e+224): tmp = t_1 else: tmp = y * z return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(z * b)) tmp = 0.0 if (z <= -4e+238) tmp = t_1; elseif (z <= -6.8e+192) tmp = Float64(y * z); elseif (z <= -4.9e-37) tmp = t_1; elseif (z <= 2e+79) tmp = Float64(x + Float64(t * a)); elseif ((z <= 2e+151) || !(z <= 6.8e+224)) tmp = t_1; else tmp = Float64(y * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (z * b); tmp = 0.0; if (z <= -4e+238) tmp = t_1; elseif (z <= -6.8e+192) tmp = y * z; elseif (z <= -4.9e-37) tmp = t_1; elseif (z <= 2e+79) tmp = x + (t * a); elseif ((z <= 2e+151) || ~((z <= 6.8e+224))) tmp = t_1; else tmp = y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+238], t$95$1, If[LessEqual[z, -6.8e+192], N[(y * z), $MachinePrecision], If[LessEqual[z, -4.9e-37], t$95$1, If[LessEqual[z, 2e+79], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2e+151], N[Not[LessEqual[z, 6.8e+224]], $MachinePrecision]], t$95$1, N[(y * z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{+192}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -4.9 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+79}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+151} \lor \neg \left(z \leq 6.8 \cdot 10^{+224}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot z\\
\end{array}
\end{array}
if z < -4.0000000000000002e238 or -6.79999999999999992e192 < z < -4.90000000000000018e-37 or 1.99999999999999993e79 < z < 2.00000000000000003e151 or 6.8000000000000004e224 < z Initial program 85.9%
*-commutative85.9%
associate-*l*87.0%
Simplified87.0%
Taylor expanded in a around inf 65.3%
Taylor expanded in t around 0 54.5%
if -4.0000000000000002e238 < z < -6.79999999999999992e192 or 2.00000000000000003e151 < z < 6.8000000000000004e224Initial program 85.2%
*-commutative85.2%
associate-*l*92.5%
Simplified92.5%
Taylor expanded in y around inf 67.8%
*-commutative67.8%
Simplified67.8%
if -4.90000000000000018e-37 < z < 1.99999999999999993e79Initial program 98.5%
*-commutative98.5%
associate-*l*91.4%
Simplified91.4%
Taylor expanded in z around 0 77.9%
Final simplification68.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= a -1.85e-11)
(* t a)
(if (<= a -4e-177)
x
(if (<= a -8e-211)
(* y z)
(if (<= a 2.7e-301) x (if (<= a 3.5e-94) (* y z) (* t a)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.85e-11) {
tmp = t * a;
} else if (a <= -4e-177) {
tmp = x;
} else if (a <= -8e-211) {
tmp = y * z;
} else if (a <= 2.7e-301) {
tmp = x;
} else if (a <= 3.5e-94) {
tmp = y * z;
} 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 <= (-1.85d-11)) then
tmp = t * a
else if (a <= (-4d-177)) then
tmp = x
else if (a <= (-8d-211)) then
tmp = y * z
else if (a <= 2.7d-301) then
tmp = x
else if (a <= 3.5d-94) then
tmp = y * z
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 <= -1.85e-11) {
tmp = t * a;
} else if (a <= -4e-177) {
tmp = x;
} else if (a <= -8e-211) {
tmp = y * z;
} else if (a <= 2.7e-301) {
tmp = x;
} else if (a <= 3.5e-94) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.85e-11: tmp = t * a elif a <= -4e-177: tmp = x elif a <= -8e-211: tmp = y * z elif a <= 2.7e-301: tmp = x elif a <= 3.5e-94: tmp = y * z else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.85e-11) tmp = Float64(t * a); elseif (a <= -4e-177) tmp = x; elseif (a <= -8e-211) tmp = Float64(y * z); elseif (a <= 2.7e-301) tmp = x; elseif (a <= 3.5e-94) tmp = Float64(y * z); else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -1.85e-11) tmp = t * a; elseif (a <= -4e-177) tmp = x; elseif (a <= -8e-211) tmp = y * z; elseif (a <= 2.7e-301) tmp = x; elseif (a <= 3.5e-94) tmp = y * z; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.85e-11], N[(t * a), $MachinePrecision], If[LessEqual[a, -4e-177], x, If[LessEqual[a, -8e-211], N[(y * z), $MachinePrecision], If[LessEqual[a, 2.7e-301], x, If[LessEqual[a, 3.5e-94], N[(y * z), $MachinePrecision], N[(t * a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.85 \cdot 10^{-11}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq -4 \cdot 10^{-177}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -8 \cdot 10^{-211}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{-301}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.5 \cdot 10^{-94}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -1.8500000000000001e-11 or 3.49999999999999998e-94 < a Initial program 88.0%
*-commutative88.0%
associate-*l*83.9%
Simplified83.9%
Taylor expanded in t around inf 44.7%
if -1.8500000000000001e-11 < a < -3.99999999999999981e-177 or -8.00000000000000069e-211 < a < 2.7e-301Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 53.9%
if -3.99999999999999981e-177 < a < -8.00000000000000069e-211 or 2.7e-301 < a < 3.49999999999999998e-94Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around inf 56.9%
*-commutative56.9%
Simplified56.9%
Final simplification48.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= b -3.5e+105)
t_1
(if (<= b -9.5e+31)
(* y z)
(if (or (<= b -2.3e-30) (not (<= b 1.55e+52))) t_1 (* t a))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (z * b);
double tmp;
if (b <= -3.5e+105) {
tmp = t_1;
} else if (b <= -9.5e+31) {
tmp = y * z;
} else if ((b <= -2.3e-30) || !(b <= 1.55e+52)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = a * (z * b)
if (b <= (-3.5d+105)) then
tmp = t_1
else if (b <= (-9.5d+31)) then
tmp = y * z
else if ((b <= (-2.3d-30)) .or. (.not. (b <= 1.55d+52))) then
tmp = t_1
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 t_1 = a * (z * b);
double tmp;
if (b <= -3.5e+105) {
tmp = t_1;
} else if (b <= -9.5e+31) {
tmp = y * z;
} else if ((b <= -2.3e-30) || !(b <= 1.55e+52)) {
tmp = t_1;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (z * b) tmp = 0 if b <= -3.5e+105: tmp = t_1 elif b <= -9.5e+31: tmp = y * z elif (b <= -2.3e-30) or not (b <= 1.55e+52): tmp = t_1 else: tmp = t * a return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(z * b)) tmp = 0.0 if (b <= -3.5e+105) tmp = t_1; elseif (b <= -9.5e+31) tmp = Float64(y * z); elseif ((b <= -2.3e-30) || !(b <= 1.55e+52)) tmp = t_1; else tmp = Float64(t * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (z * b); tmp = 0.0; if (b <= -3.5e+105) tmp = t_1; elseif (b <= -9.5e+31) tmp = y * z; elseif ((b <= -2.3e-30) || ~((b <= 1.55e+52))) tmp = t_1; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.5e+105], t$95$1, If[LessEqual[b, -9.5e+31], N[(y * z), $MachinePrecision], If[Or[LessEqual[b, -2.3e-30], N[Not[LessEqual[b, 1.55e+52]], $MachinePrecision]], t$95$1, N[(t * a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;b \leq -3.5 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq -9.5 \cdot 10^{+31}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;b \leq -2.3 \cdot 10^{-30} \lor \neg \left(b \leq 1.55 \cdot 10^{+52}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if b < -3.49999999999999991e105 or -9.5000000000000008e31 < b < -2.29999999999999984e-30 or 1.55e52 < b Initial program 91.5%
*-commutative91.5%
associate-*l*84.3%
Simplified84.3%
Taylor expanded in a around inf 65.6%
Taylor expanded in t around 0 57.5%
if -3.49999999999999991e105 < b < -9.5000000000000008e31Initial program 94.1%
*-commutative94.1%
associate-*l*88.2%
Simplified88.2%
Taylor expanded in y around inf 48.4%
*-commutative48.4%
Simplified48.4%
if -2.29999999999999984e-30 < b < 1.55e52Initial program 93.3%
*-commutative93.3%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in t around inf 45.2%
Final simplification51.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.38e-145) (not (<= a 4.6e-95))) (+ x (* a (+ t (* z b)))) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.38e-145) || !(a <= 4.6e-95)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (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 ((a <= (-1.38d-145)) .or. (.not. (a <= 4.6d-95))) then
tmp = x + (a * (t + (z * b)))
else
tmp = x + (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 ((a <= -1.38e-145) || !(a <= 4.6e-95)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.38e-145) or not (a <= 4.6e-95): tmp = x + (a * (t + (z * b))) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.38e-145) || !(a <= 4.6e-95)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(x + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.38e-145) || ~((a <= 4.6e-95))) tmp = x + (a * (t + (z * b))); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.38e-145], N[Not[LessEqual[a, 4.6e-95]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.38 \cdot 10^{-145} \lor \neg \left(a \leq 4.6 \cdot 10^{-95}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -1.38e-145 or 4.59999999999999998e-95 < a Initial program 89.4%
associate-+l+89.4%
+-commutative89.4%
*-commutative89.4%
*-commutative89.4%
associate-*l*90.6%
distribute-rgt-out93.4%
fma-def94.5%
*-commutative94.5%
+-commutative94.5%
fma-def94.5%
Simplified94.5%
Taylor expanded in y around 0 89.2%
if -1.38e-145 < a < 4.59999999999999998e-95Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in a around 0 83.5%
Final simplification87.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.28e-45) (not (<= a 3.8e-72))) (+ x (* a (+ t (* z b)))) (+ x (+ (* t a) (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.28e-45) || !(a <= 3.8e-72)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + ((t * a) + (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 ((a <= (-1.28d-45)) .or. (.not. (a <= 3.8d-72))) then
tmp = x + (a * (t + (z * b)))
else
tmp = x + ((t * a) + (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 ((a <= -1.28e-45) || !(a <= 3.8e-72)) {
tmp = x + (a * (t + (z * b)));
} else {
tmp = x + ((t * a) + (y * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.28e-45) or not (a <= 3.8e-72): tmp = x + (a * (t + (z * b))) else: tmp = x + ((t * a) + (y * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.28e-45) || !(a <= 3.8e-72)) tmp = Float64(x + Float64(a * Float64(t + Float64(z * b)))); else tmp = Float64(x + Float64(Float64(t * a) + Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.28e-45) || ~((a <= 3.8e-72))) tmp = x + (a * (t + (z * b))); else tmp = x + ((t * a) + (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.28e-45], N[Not[LessEqual[a, 3.8e-72]], $MachinePrecision]], N[(x + N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * a), $MachinePrecision] + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{-45} \lor \neg \left(a \leq 3.8 \cdot 10^{-72}\right):\\
\;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t \cdot a + y \cdot z\right)\\
\end{array}
\end{array}
if a < -1.28e-45 or 3.80000000000000002e-72 < a Initial program 87.8%
associate-+l+87.8%
+-commutative87.8%
*-commutative87.8%
*-commutative87.8%
associate-*l*89.7%
distribute-rgt-out92.9%
fma-def94.2%
*-commutative94.2%
+-commutative94.2%
fma-def94.2%
Simplified94.2%
Taylor expanded in y around 0 91.3%
if -1.28e-45 < a < 3.80000000000000002e-72Initial program 99.9%
*-commutative99.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in b around 0 89.6%
Final simplification90.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -1.15e+188)
t_1
(if (<= a -62000000000000.0)
(* a (* z b))
(if (<= a 5e-72) (+ x (* y z)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (t * a);
double tmp;
if (a <= -1.15e+188) {
tmp = t_1;
} else if (a <= -62000000000000.0) {
tmp = a * (z * b);
} else if (a <= 5e-72) {
tmp = x + (y * z);
} 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 = x + (t * a)
if (a <= (-1.15d+188)) then
tmp = t_1
else if (a <= (-62000000000000.0d0)) then
tmp = a * (z * b)
else if (a <= 5d-72) then
tmp = x + (y * z)
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 = x + (t * a);
double tmp;
if (a <= -1.15e+188) {
tmp = t_1;
} else if (a <= -62000000000000.0) {
tmp = a * (z * b);
} else if (a <= 5e-72) {
tmp = x + (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (t * a) tmp = 0 if a <= -1.15e+188: tmp = t_1 elif a <= -62000000000000.0: tmp = a * (z * b) elif a <= 5e-72: tmp = x + (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(t * a)) tmp = 0.0 if (a <= -1.15e+188) tmp = t_1; elseif (a <= -62000000000000.0) tmp = Float64(a * Float64(z * b)); elseif (a <= 5e-72) tmp = Float64(x + Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (t * a); tmp = 0.0; if (a <= -1.15e+188) tmp = t_1; elseif (a <= -62000000000000.0) tmp = a * (z * b); elseif (a <= 5e-72) tmp = x + (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.15e+188], t$95$1, If[LessEqual[a, -62000000000000.0], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5e-72], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -1.15 \cdot 10^{+188}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -62000000000000:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-72}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -1.15000000000000006e188 or 4.9999999999999996e-72 < a Initial program 86.1%
*-commutative86.1%
associate-*l*82.1%
Simplified82.1%
Taylor expanded in z around 0 62.9%
if -1.15000000000000006e188 < a < -6.2e13Initial program 90.5%
*-commutative90.5%
associate-*l*84.7%
Simplified84.7%
Taylor expanded in a around inf 93.4%
Taylor expanded in t around 0 63.1%
if -6.2e13 < a < 4.9999999999999996e-72Initial program 99.9%
*-commutative99.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in a around 0 77.1%
Final simplification68.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.7e+18) (not (<= a 5e-72))) (* a (+ t (* z b))) (+ x (* y z))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.7e+18) || !(a <= 5e-72)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (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 ((a <= (-1.7d+18)) .or. (.not. (a <= 5d-72))) then
tmp = a * (t + (z * b))
else
tmp = x + (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 ((a <= -1.7e+18) || !(a <= 5e-72)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (y * z);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.7e+18) or not (a <= 5e-72): tmp = a * (t + (z * b)) else: tmp = x + (y * z) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.7e+18) || !(a <= 5e-72)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1.7e+18) || ~((a <= 5e-72))) tmp = a * (t + (z * b)); else tmp = x + (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.7e+18], N[Not[LessEqual[a, 5e-72]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{+18} \lor \neg \left(a \leq 5 \cdot 10^{-72}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -1.7e18 or 4.9999999999999996e-72 < a Initial program 87.1%
*-commutative87.1%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in a around inf 79.4%
if -1.7e18 < a < 4.9999999999999996e-72Initial program 99.9%
*-commutative99.9%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in a around 0 77.1%
Final simplification78.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a -1.9e-10) (* t a) (if (<= a 1.95e-17) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -1.9e-10) {
tmp = t * a;
} else if (a <= 1.95e-17) {
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 <= (-1.9d-10)) then
tmp = t * a
else if (a <= 1.95d-17) 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 <= -1.9e-10) {
tmp = t * a;
} else if (a <= 1.95e-17) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -1.9e-10: tmp = t * a elif a <= 1.95e-17: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -1.9e-10) tmp = Float64(t * a); elseif (a <= 1.95e-17) 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 <= -1.9e-10) tmp = t * a; elseif (a <= 1.95e-17) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.9e-10], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.95e-17], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.9 \cdot 10^{-10}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 1.95 \cdot 10^{-17}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -1.8999999999999999e-10 or 1.94999999999999995e-17 < a Initial program 86.4%
*-commutative86.4%
associate-*l*81.7%
Simplified81.7%
Taylor expanded in t around inf 46.9%
if -1.8999999999999999e-10 < a < 1.94999999999999995e-17Initial program 99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 39.1%
Final simplification43.4%
(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.5%
*-commutative92.5%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in x around inf 24.1%
Final simplification24.1%
(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 2023280
(FPCore (x y z t a b)
:name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
:precision binary64
:herbie-target
(if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))
(+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))