
(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 (* z (+ y (* a 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 = z * (y + (a * 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 = z * (y + (a * 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 = z * (y + (a * 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(z * Float64(y + Float64(a * 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 = z * (y + (a * 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[(z * N[(y + N[(a * 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}:\\
\;\;\;\;z \cdot \left(y + a \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 98.4%
if +inf.0 < (+.f64 (+.f64 (+.f64 x (*.f64 y z)) (*.f64 t a)) (*.f64 (*.f64 a z) b)) Initial program 0.0%
associate-+l+0.0%
associate-*l*0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.2e+192) (not (<= z 7.2e+150))) (+ x (* z (+ y (* a b)))) (+ (+ x (* y z)) (+ (* a (* z b)) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.2e+192) || !(z <= 7.2e+150)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = (x + (y * z)) + ((a * (z * b)) + (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 ((z <= (-2.2d+192)) .or. (.not. (z <= 7.2d+150))) then
tmp = x + (z * (y + (a * b)))
else
tmp = (x + (y * z)) + ((a * (z * b)) + (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 ((z <= -2.2e+192) || !(z <= 7.2e+150)) {
tmp = x + (z * (y + (a * b)));
} else {
tmp = (x + (y * z)) + ((a * (z * b)) + (t * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.2e+192) or not (z <= 7.2e+150): tmp = x + (z * (y + (a * b))) else: tmp = (x + (y * z)) + ((a * (z * b)) + (t * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.2e+192) || !(z <= 7.2e+150)) tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); else tmp = Float64(Float64(x + Float64(y * z)) + Float64(Float64(a * Float64(z * b)) + Float64(t * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.2e+192) || ~((z <= 7.2e+150))) tmp = x + (z * (y + (a * b))); else tmp = (x + (y * z)) + ((a * (z * b)) + (t * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.2e+192], N[Not[LessEqual[z, 7.2e+150]], $MachinePrecision]], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{+192} \lor \neg \left(z \leq 7.2 \cdot 10^{+150}\right):\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot z\right) + \left(a \cdot \left(z \cdot b\right) + t \cdot a\right)\\
\end{array}
\end{array}
if z < -2.2000000000000001e192 or 7.19999999999999972e150 < z Initial program 86.5%
+-commutative86.5%
+-commutative86.5%
associate-+l+86.5%
associate-+r+86.5%
*-commutative86.5%
associate-*l*89.4%
*-commutative89.4%
distribute-lft-out97.0%
fma-def97.0%
fma-def97.0%
+-commutative97.0%
fma-def97.0%
Simplified97.0%
Taylor expanded in t around 0 94.4%
if -2.2000000000000001e192 < z < 7.19999999999999972e150Initial program 98.4%
associate-+l+98.4%
associate-*l*98.0%
Simplified98.0%
Final simplification97.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* z b))))
(if (<= t -5.6e+82)
(* t a)
(if (<= t -9.5e-245)
t_1
(if (<= t 1.4e-298)
(* y z)
(if (<= t 5.3e-195)
x
(if (<= t 3.5e-112)
(* y z)
(if (<= t 1.35e+51) t_1 (if (<= t 1.3e+112) x (* 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 (t <= -5.6e+82) {
tmp = t * a;
} else if (t <= -9.5e-245) {
tmp = t_1;
} else if (t <= 1.4e-298) {
tmp = y * z;
} else if (t <= 5.3e-195) {
tmp = x;
} else if (t <= 3.5e-112) {
tmp = y * z;
} else if (t <= 1.35e+51) {
tmp = t_1;
} else if (t <= 1.3e+112) {
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) :: t_1
real(8) :: tmp
t_1 = a * (z * b)
if (t <= (-5.6d+82)) then
tmp = t * a
else if (t <= (-9.5d-245)) then
tmp = t_1
else if (t <= 1.4d-298) then
tmp = y * z
else if (t <= 5.3d-195) then
tmp = x
else if (t <= 3.5d-112) then
tmp = y * z
else if (t <= 1.35d+51) then
tmp = t_1
else if (t <= 1.3d+112) 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 t_1 = a * (z * b);
double tmp;
if (t <= -5.6e+82) {
tmp = t * a;
} else if (t <= -9.5e-245) {
tmp = t_1;
} else if (t <= 1.4e-298) {
tmp = y * z;
} else if (t <= 5.3e-195) {
tmp = x;
} else if (t <= 3.5e-112) {
tmp = y * z;
} else if (t <= 1.35e+51) {
tmp = t_1;
} else if (t <= 1.3e+112) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (z * b) tmp = 0 if t <= -5.6e+82: tmp = t * a elif t <= -9.5e-245: tmp = t_1 elif t <= 1.4e-298: tmp = y * z elif t <= 5.3e-195: tmp = x elif t <= 3.5e-112: tmp = y * z elif t <= 1.35e+51: tmp = t_1 elif t <= 1.3e+112: tmp = x 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 (t <= -5.6e+82) tmp = Float64(t * a); elseif (t <= -9.5e-245) tmp = t_1; elseif (t <= 1.4e-298) tmp = Float64(y * z); elseif (t <= 5.3e-195) tmp = x; elseif (t <= 3.5e-112) tmp = Float64(y * z); elseif (t <= 1.35e+51) tmp = t_1; elseif (t <= 1.3e+112) tmp = x; 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 (t <= -5.6e+82) tmp = t * a; elseif (t <= -9.5e-245) tmp = t_1; elseif (t <= 1.4e-298) tmp = y * z; elseif (t <= 5.3e-195) tmp = x; elseif (t <= 3.5e-112) tmp = y * z; elseif (t <= 1.35e+51) tmp = t_1; elseif (t <= 1.3e+112) tmp = x; 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[t, -5.6e+82], N[(t * a), $MachinePrecision], If[LessEqual[t, -9.5e-245], t$95$1, If[LessEqual[t, 1.4e-298], N[(y * z), $MachinePrecision], If[LessEqual[t, 5.3e-195], x, If[LessEqual[t, 3.5e-112], N[(y * z), $MachinePrecision], If[LessEqual[t, 1.35e+51], t$95$1, If[LessEqual[t, 1.3e+112], x, N[(t * a), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(z \cdot b\right)\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{+82}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;t \leq -9.5 \cdot 10^{-245}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{-298}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;t \leq 5.3 \cdot 10^{-195}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{-112}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+112}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if t < -5.6000000000000001e82 or 1.3e112 < t Initial program 94.0%
associate-+l+94.0%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in t around inf 56.7%
if -5.6000000000000001e82 < t < -9.5000000000000002e-245 or 3.49999999999999994e-112 < t < 1.34999999999999996e51Initial program 95.6%
associate-+l+95.6%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in z around inf 56.5%
Taylor expanded in y around 0 42.9%
if -9.5000000000000002e-245 < t < 1.39999999999999996e-298 or 5.30000000000000008e-195 < t < 3.49999999999999994e-112Initial program 96.9%
associate-+l+96.9%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in y around inf 62.5%
*-commutative62.5%
Simplified62.5%
if 1.39999999999999996e-298 < t < 5.30000000000000008e-195 or 1.34999999999999996e51 < t < 1.3e112Initial program 97.0%
associate-+l+97.0%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in x around inf 59.6%
Final simplification53.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -5e+236)
(* y z)
(if (<= z -8e+218)
(* a (* z b))
(if (<= z -3.2e+154)
(* y z)
(if (or (<= z -1.6e+109) (and (not (<= z -2.12e+24)) (<= z 4e+130)))
(+ x (* t a))
(* z (* a b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5e+236) {
tmp = y * z;
} else if (z <= -8e+218) {
tmp = a * (z * b);
} else if (z <= -3.2e+154) {
tmp = y * z;
} else if ((z <= -1.6e+109) || (!(z <= -2.12e+24) && (z <= 4e+130))) {
tmp = x + (t * a);
} else {
tmp = 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 (z <= (-5d+236)) then
tmp = y * z
else if (z <= (-8d+218)) then
tmp = a * (z * b)
else if (z <= (-3.2d+154)) then
tmp = y * z
else if ((z <= (-1.6d+109)) .or. (.not. (z <= (-2.12d+24))) .and. (z <= 4d+130)) then
tmp = x + (t * a)
else
tmp = 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 (z <= -5e+236) {
tmp = y * z;
} else if (z <= -8e+218) {
tmp = a * (z * b);
} else if (z <= -3.2e+154) {
tmp = y * z;
} else if ((z <= -1.6e+109) || (!(z <= -2.12e+24) && (z <= 4e+130))) {
tmp = x + (t * a);
} else {
tmp = z * (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -5e+236: tmp = y * z elif z <= -8e+218: tmp = a * (z * b) elif z <= -3.2e+154: tmp = y * z elif (z <= -1.6e+109) or (not (z <= -2.12e+24) and (z <= 4e+130)): tmp = x + (t * a) else: tmp = z * (a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5e+236) tmp = Float64(y * z); elseif (z <= -8e+218) tmp = Float64(a * Float64(z * b)); elseif (z <= -3.2e+154) tmp = Float64(y * z); elseif ((z <= -1.6e+109) || (!(z <= -2.12e+24) && (z <= 4e+130))) tmp = Float64(x + Float64(t * a)); else tmp = Float64(z * Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -5e+236) tmp = y * z; elseif (z <= -8e+218) tmp = a * (z * b); elseif (z <= -3.2e+154) tmp = y * z; elseif ((z <= -1.6e+109) || (~((z <= -2.12e+24)) && (z <= 4e+130))) tmp = x + (t * a); else tmp = z * (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5e+236], N[(y * z), $MachinePrecision], If[LessEqual[z, -8e+218], N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.2e+154], N[(y * z), $MachinePrecision], If[Or[LessEqual[z, -1.6e+109], And[N[Not[LessEqual[z, -2.12e+24]], $MachinePrecision], LessEqual[z, 4e+130]]], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision], N[(z * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+236}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+218}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{+154}:\\
\;\;\;\;y \cdot z\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+109} \lor \neg \left(z \leq -2.12 \cdot 10^{+24}\right) \land z \leq 4 \cdot 10^{+130}:\\
\;\;\;\;x + t \cdot a\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -4.9999999999999997e236 or -8.00000000000000066e218 < z < -3.2e154Initial program 83.6%
associate-+l+83.6%
associate-*l*83.3%
Simplified83.3%
Taylor expanded in y around inf 67.6%
*-commutative67.6%
Simplified67.6%
if -4.9999999999999997e236 < z < -8.00000000000000066e218Initial program 77.8%
associate-+l+77.8%
associate-*l*77.8%
Simplified77.8%
Taylor expanded in z around inf 91.0%
Taylor expanded in y around 0 80.4%
if -3.2e154 < z < -1.6000000000000001e109 or -2.1200000000000001e24 < z < 4.0000000000000002e130Initial program 98.2%
associate-+l+98.2%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in z around 0 75.7%
if -1.6000000000000001e109 < z < -2.1200000000000001e24 or 4.0000000000000002e130 < z Initial program 94.9%
associate-+l+94.9%
associate-*l*80.9%
Simplified80.9%
Taylor expanded in z around inf 78.7%
Taylor expanded in a around inf 48.2%
associate-*r*52.8%
*-commutative52.8%
Simplified52.8%
Final simplification69.7%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= z -2.6e+16)
(not (or (<= z 6e-81) (and (not (<= z 7.2e+30)) (<= z 2.9e+122)))))
(* z (+ y (* a b)))
(+ x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.6e+16) || !((z <= 6e-81) || (!(z <= 7.2e+30) && (z <= 2.9e+122)))) {
tmp = z * (y + (a * b));
} else {
tmp = x + (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 ((z <= (-2.6d+16)) .or. (.not. (z <= 6d-81) .or. (.not. (z <= 7.2d+30)) .and. (z <= 2.9d+122))) then
tmp = z * (y + (a * b))
else
tmp = x + (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 ((z <= -2.6e+16) || !((z <= 6e-81) || (!(z <= 7.2e+30) && (z <= 2.9e+122)))) {
tmp = z * (y + (a * b));
} else {
tmp = x + (t * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.6e+16) or not ((z <= 6e-81) or (not (z <= 7.2e+30) and (z <= 2.9e+122))): tmp = z * (y + (a * b)) else: tmp = x + (t * a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.6e+16) || !((z <= 6e-81) || (!(z <= 7.2e+30) && (z <= 2.9e+122)))) tmp = Float64(z * Float64(y + Float64(a * b))); else tmp = Float64(x + Float64(t * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -2.6e+16) || ~(((z <= 6e-81) || (~((z <= 7.2e+30)) && (z <= 2.9e+122))))) tmp = z * (y + (a * b)); else tmp = x + (t * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.6e+16], N[Not[Or[LessEqual[z, 6e-81], And[N[Not[LessEqual[z, 7.2e+30]], $MachinePrecision], LessEqual[z, 2.9e+122]]]], $MachinePrecision]], N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+16} \lor \neg \left(z \leq 6 \cdot 10^{-81} \lor \neg \left(z \leq 7.2 \cdot 10^{+30}\right) \land z \leq 2.9 \cdot 10^{+122}\right):\\
\;\;\;\;z \cdot \left(y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot a\\
\end{array}
\end{array}
if z < -2.6e16 or 5.9999999999999998e-81 < z < 7.2000000000000004e30 or 2.9000000000000001e122 < z Initial program 92.8%
associate-+l+92.8%
associate-*l*86.1%
Simplified86.1%
Taylor expanded in z around inf 78.4%
if -2.6e16 < z < 5.9999999999999998e-81 or 7.2000000000000004e30 < z < 2.9000000000000001e122Initial program 97.7%
associate-+l+97.7%
associate-*l*99.2%
Simplified99.2%
Taylor expanded in z around 0 84.2%
Final simplification81.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1e+60) (not (<= a 9.6e+40))) (* a (+ t (* z b))) (+ x (* z (+ y (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+60) || !(a <= 9.6e+40)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * (y + (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 <= (-1d+60)) .or. (.not. (a <= 9.6d+40))) then
tmp = a * (t + (z * b))
else
tmp = x + (z * (y + (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 <= -1e+60) || !(a <= 9.6e+40)) {
tmp = a * (t + (z * b));
} else {
tmp = x + (z * (y + (a * b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -1e+60) or not (a <= 9.6e+40): tmp = a * (t + (z * b)) else: tmp = x + (z * (y + (a * b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1e+60) || !(a <= 9.6e+40)) tmp = Float64(a * Float64(t + Float64(z * b))); else tmp = Float64(x + Float64(z * Float64(y + Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -1e+60) || ~((a <= 9.6e+40))) tmp = a * (t + (z * b)); else tmp = x + (z * (y + (a * b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1e+60], N[Not[LessEqual[a, 9.6e+40]], $MachinePrecision]], N[(a * N[(t + N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+60} \lor \neg \left(a \leq 9.6 \cdot 10^{+40}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\
\end{array}
\end{array}
if a < -9.9999999999999995e59 or 9.5999999999999999e40 < a Initial program 91.0%
associate-+l+91.0%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in a around inf 90.3%
if -9.9999999999999995e59 < a < 9.5999999999999999e40Initial program 98.6%
+-commutative98.6%
+-commutative98.6%
associate-+l+98.6%
associate-+r+98.6%
*-commutative98.6%
associate-*l*99.3%
*-commutative99.3%
distribute-lft-out100.0%
fma-def100.0%
fma-def100.0%
+-commutative100.0%
fma-def100.0%
Simplified100.0%
Taylor expanded in t around 0 85.9%
Final simplification87.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (* t a))))
(if (<= a -2.1e+39)
t_1
(if (<= a 3.8e-74)
(+ x (* y z))
(if (<= a 2.8e+253) t_1 (* a (* z b)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (t * a);
double tmp;
if (a <= -2.1e+39) {
tmp = t_1;
} else if (a <= 3.8e-74) {
tmp = x + (y * z);
} else if (a <= 2.8e+253) {
tmp = t_1;
} else {
tmp = a * (z * 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) :: t_1
real(8) :: tmp
t_1 = x + (t * a)
if (a <= (-2.1d+39)) then
tmp = t_1
else if (a <= 3.8d-74) then
tmp = x + (y * z)
else if (a <= 2.8d+253) then
tmp = t_1
else
tmp = a * (z * b)
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 <= -2.1e+39) {
tmp = t_1;
} else if (a <= 3.8e-74) {
tmp = x + (y * z);
} else if (a <= 2.8e+253) {
tmp = t_1;
} else {
tmp = a * (z * b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (t * a) tmp = 0 if a <= -2.1e+39: tmp = t_1 elif a <= 3.8e-74: tmp = x + (y * z) elif a <= 2.8e+253: tmp = t_1 else: tmp = a * (z * b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(t * a)) tmp = 0.0 if (a <= -2.1e+39) tmp = t_1; elseif (a <= 3.8e-74) tmp = Float64(x + Float64(y * z)); elseif (a <= 2.8e+253) tmp = t_1; else tmp = Float64(a * Float64(z * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (t * a); tmp = 0.0; if (a <= -2.1e+39) tmp = t_1; elseif (a <= 3.8e-74) tmp = x + (y * z); elseif (a <= 2.8e+253) tmp = t_1; else tmp = a * (z * b); 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, -2.1e+39], t$95$1, If[LessEqual[a, 3.8e-74], N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.8e+253], t$95$1, N[(a * N[(z * b), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot a\\
\mathbf{if}\;a \leq -2.1 \cdot 10^{+39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{-74}:\\
\;\;\;\;x + y \cdot z\\
\mathbf{elif}\;a \leq 2.8 \cdot 10^{+253}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(z \cdot b\right)\\
\end{array}
\end{array}
if a < -2.0999999999999999e39 or 3.7999999999999996e-74 < a < 2.8e253Initial program 92.0%
associate-+l+92.0%
associate-*l*94.4%
Simplified94.4%
Taylor expanded in z around 0 63.5%
if -2.0999999999999999e39 < a < 3.7999999999999996e-74Initial program 99.2%
associate-+l+99.2%
associate-*l*91.2%
Simplified91.2%
Taylor expanded in a around 0 77.3%
if 2.8e253 < a Initial program 91.7%
associate-+l+91.7%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in z around inf 76.0%
Taylor expanded in y around 0 83.5%
Final simplification70.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -1.52e+38) (not (<= a 3.6e+21))) (* 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.52e+38) || !(a <= 3.6e+21)) {
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.52d+38)) .or. (.not. (a <= 3.6d+21))) 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.52e+38) || !(a <= 3.6e+21)) {
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.52e+38) or not (a <= 3.6e+21): 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.52e+38) || !(a <= 3.6e+21)) 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.52e+38) || ~((a <= 3.6e+21))) 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.52e+38], N[Not[LessEqual[a, 3.6e+21]], $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.52 \cdot 10^{+38} \lor \neg \left(a \leq 3.6 \cdot 10^{+21}\right):\\
\;\;\;\;a \cdot \left(t + z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot z\\
\end{array}
\end{array}
if a < -1.51999999999999996e38 or 3.6e21 < a Initial program 91.6%
associate-+l+91.6%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in a around inf 87.9%
if -1.51999999999999996e38 < a < 3.6e21Initial program 98.5%
associate-+l+98.5%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in a around 0 74.1%
Final simplification80.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a -7.8e+55) (* t a) (if (<= a 1.35e-175) x (if (<= a 4.4e-74) (* y z) (* t a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -7.8e+55) {
tmp = t * a;
} else if (a <= 1.35e-175) {
tmp = x;
} else if (a <= 4.4e-74) {
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 <= (-7.8d+55)) then
tmp = t * a
else if (a <= 1.35d-175) then
tmp = x
else if (a <= 4.4d-74) 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 <= -7.8e+55) {
tmp = t * a;
} else if (a <= 1.35e-175) {
tmp = x;
} else if (a <= 4.4e-74) {
tmp = y * z;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -7.8e+55: tmp = t * a elif a <= 1.35e-175: tmp = x elif a <= 4.4e-74: tmp = y * z else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -7.8e+55) tmp = Float64(t * a); elseif (a <= 1.35e-175) tmp = x; elseif (a <= 4.4e-74) 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 <= -7.8e+55) tmp = t * a; elseif (a <= 1.35e-175) tmp = x; elseif (a <= 4.4e-74) tmp = y * z; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -7.8e+55], N[(t * a), $MachinePrecision], If[LessEqual[a, 1.35e-175], x, If[LessEqual[a, 4.4e-74], N[(y * z), $MachinePrecision], N[(t * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8 \cdot 10^{+55}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-175}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.4 \cdot 10^{-74}:\\
\;\;\;\;y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -7.80000000000000054e55 or 4.40000000000000021e-74 < a Initial program 91.6%
associate-+l+91.6%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in t around inf 50.9%
if -7.80000000000000054e55 < a < 1.34999999999999999e-175Initial program 99.0%
associate-+l+99.0%
associate-*l*90.3%
Simplified90.3%
Taylor expanded in x around inf 43.8%
if 1.34999999999999999e-175 < a < 4.40000000000000021e-74Initial program 100.0%
associate-+l+100.0%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in y around inf 57.3%
*-commutative57.3%
Simplified57.3%
Final simplification48.8%
(FPCore (x y z t a b) :precision binary64 (if (<= a -9.3e+55) (* t a) (if (<= a 28.0) x (* t a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -9.3e+55) {
tmp = t * a;
} else if (a <= 28.0) {
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 <= (-9.3d+55)) then
tmp = t * a
else if (a <= 28.0d0) 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 <= -9.3e+55) {
tmp = t * a;
} else if (a <= 28.0) {
tmp = x;
} else {
tmp = t * a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -9.3e+55: tmp = t * a elif a <= 28.0: tmp = x else: tmp = t * a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -9.3e+55) tmp = Float64(t * a); elseif (a <= 28.0) 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 <= -9.3e+55) tmp = t * a; elseif (a <= 28.0) tmp = x; else tmp = t * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -9.3e+55], N[(t * a), $MachinePrecision], If[LessEqual[a, 28.0], x, N[(t * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.3 \cdot 10^{+55}:\\
\;\;\;\;t \cdot a\\
\mathbf{elif}\;a \leq 28:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot a\\
\end{array}
\end{array}
if a < -9.30000000000000035e55 or 28 < a Initial program 90.6%
associate-+l+90.6%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in t around inf 54.3%
if -9.30000000000000035e55 < a < 28Initial program 99.3%
associate-+l+99.3%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in x around inf 40.7%
Final simplification46.9%
(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 95.3%
associate-+l+95.3%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in x around inf 26.1%
Final simplification26.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 2023199
(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)))