
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (<= t_1 -5e+226)
(fma -4.5 (/ t (/ a z)) (* 0.5 (/ x (/ a y))))
(if (<= t_1 5e+286)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(fma (* y (/ 0.5 a)) x (* z (/ -4.5 (/ a t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if (t_1 <= -5e+226) {
tmp = fma(-4.5, (t / (a / z)), (0.5 * (x / (a / y))));
} else if (t_1 <= 5e+286) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = fma((y * (0.5 / a)), x, (z * (-4.5 / (a / t))));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if (t_1 <= -5e+226) tmp = fma(-4.5, Float64(t / Float64(a / z)), Float64(0.5 * Float64(x / Float64(a / y)))); elseif (t_1 <= 5e+286) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = fma(Float64(y * Float64(0.5 / a)), x, Float64(z * Float64(-4.5 / Float64(a / t)))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+226], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+286], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] * x + N[(z * N[(-4.5 / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+226}:\\
\;\;\;\;\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, 0.5 \cdot \frac{x}{\frac{a}{y}}\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+286}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \frac{0.5}{a}, x, z \cdot \frac{-4.5}{\frac{a}{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -5.0000000000000005e226Initial program 71.4%
associate-*l*73.3%
Simplified73.3%
Taylor expanded in x around 0 71.2%
fma-def71.2%
associate-/l*82.5%
associate-/l*97.8%
Simplified97.8%
if -5.0000000000000005e226 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 5.0000000000000004e286Initial program 97.5%
associate-*l*97.5%
Simplified97.5%
if 5.0000000000000004e286 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 56.4%
associate-*l*56.4%
Simplified56.4%
Taylor expanded in x around 0 53.6%
fma-def53.6%
associate-/l*64.1%
associate-/l*91.4%
Simplified91.4%
fma-udef91.4%
associate-/r/94.2%
+-commutative94.2%
*-commutative94.2%
div-inv94.2%
clear-num94.2%
associate-*l*94.2%
associate-/r/91.3%
*-commutative91.3%
div-inv91.3%
clear-num91.3%
associate-*l*91.3%
Applied egg-rr91.3%
*-commutative91.3%
fma-def94.1%
associate-*l/94.1%
associate-*r/94.1%
*-commutative94.1%
*-commutative94.1%
associate-*r/94.0%
associate-/r/96.9%
associate-/l*96.9%
associate-/r/96.8%
Applied egg-rr96.8%
Final simplification97.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 -5e+226) (not (<= t_1 4e+117)))
(fma -4.5 (/ t (/ a z)) (* 0.5 (/ x (/ a y))))
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -5e+226) || !(t_1 <= 4e+117)) {
tmp = fma(-4.5, (t / (a / z)), (0.5 * (x / (a / y))));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if ((t_1 <= -5e+226) || !(t_1 <= 4e+117)) tmp = fma(-4.5, Float64(t / Float64(a / z)), Float64(0.5 * Float64(x / Float64(a / y)))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+226], N[Not[LessEqual[t$95$1, 4e+117]], $MachinePrecision]], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+226} \lor \neg \left(t_1 \leq 4 \cdot 10^{+117}\right):\\
\;\;\;\;\mathsf{fma}\left(-4.5, \frac{t}{\frac{a}{z}}, 0.5 \cdot \frac{x}{\frac{a}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -5.0000000000000005e226 or 4.0000000000000002e117 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 73.3%
associate-*l*74.2%
Simplified74.2%
Taylor expanded in x around 0 72.3%
fma-def72.3%
associate-/l*80.8%
associate-/l*95.4%
Simplified95.4%
if -5.0000000000000005e226 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 4.0000000000000002e117Initial program 97.1%
associate-*l*97.1%
Simplified97.1%
Final simplification96.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+261)))
(+ (* x (* 0.5 (/ y a))) (* t (* -4.5 (/ z a))))
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+261)) {
tmp = (x * (0.5 * (y / a))) + (t * (-4.5 * (z / a)));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+261)) {
tmp = (x * (0.5 * (y / a))) + (t * (-4.5 * (z / a)));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - ((z * 9.0) * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+261): tmp = (x * (0.5 * (y / a))) + (t * (-4.5 * (z / a))) else: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+261)) tmp = Float64(Float64(x * Float64(0.5 * Float64(y / a))) + Float64(t * Float64(-4.5 * Float64(z / a)))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - ((z * 9.0) * t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+261))) tmp = (x * (0.5 * (y / a))) + (t * (-4.5 * (z / a))); else tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+261]], $MachinePrecision]], N[(N[(x * N[(0.5 * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+261}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right) + t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -inf.0 or 5.0000000000000001e261 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 60.1%
associate-*l*61.4%
Simplified61.4%
Taylor expanded in x around 0 58.7%
fma-def58.7%
associate-/l*71.3%
associate-/l*93.1%
Simplified93.1%
fma-udef93.1%
associate-/r/93.1%
+-commutative93.1%
*-commutative93.1%
div-inv93.0%
clear-num93.1%
associate-*l*93.1%
associate-/r/93.1%
*-commutative93.1%
div-inv93.1%
clear-num93.1%
associate-*l*93.1%
Applied egg-rr93.1%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 5.0000000000000001e261Initial program 97.6%
associate-*l*97.6%
Simplified97.6%
Final simplification96.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* 0.5 (/ x (/ a y)))))
(if (<= (* x y) -1e-17)
t_1
(if (<= (* x y) 4e-268)
(* -4.5 (/ t (/ a z)))
(if (<= (* x y) 5e-224)
t_1
(if (<= (* x y) 1e+30)
(* -4.5 (* z (/ t a)))
(* 0.5 (* y (/ x a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (x / (a / y));
double tmp;
if ((x * y) <= -1e-17) {
tmp = t_1;
} else if ((x * y) <= 4e-268) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 5e-224) {
tmp = t_1;
} else if ((x * y) <= 1e+30) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = 0.5d0 * (x / (a / y))
if ((x * y) <= (-1d-17)) then
tmp = t_1
else if ((x * y) <= 4d-268) then
tmp = (-4.5d0) * (t / (a / z))
else if ((x * y) <= 5d-224) then
tmp = t_1
else if ((x * y) <= 1d+30) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = 0.5d0 * (y * (x / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 0.5 * (x / (a / y));
double tmp;
if ((x * y) <= -1e-17) {
tmp = t_1;
} else if ((x * y) <= 4e-268) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 5e-224) {
tmp = t_1;
} else if ((x * y) <= 1e+30) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 0.5 * (x / (a / y)) tmp = 0 if (x * y) <= -1e-17: tmp = t_1 elif (x * y) <= 4e-268: tmp = -4.5 * (t / (a / z)) elif (x * y) <= 5e-224: tmp = t_1 elif (x * y) <= 1e+30: tmp = -4.5 * (z * (t / a)) else: tmp = 0.5 * (y * (x / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(0.5 * Float64(x / Float64(a / y))) tmp = 0.0 if (Float64(x * y) <= -1e-17) tmp = t_1; elseif (Float64(x * y) <= 4e-268) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (Float64(x * y) <= 5e-224) tmp = t_1; elseif (Float64(x * y) <= 1e+30) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 0.5 * (x / (a / y)); tmp = 0.0; if ((x * y) <= -1e-17) tmp = t_1; elseif ((x * y) <= 4e-268) tmp = -4.5 * (t / (a / z)); elseif ((x * y) <= 5e-224) tmp = t_1; elseif ((x * y) <= 1e+30) tmp = -4.5 * (z * (t / a)); else tmp = 0.5 * (y * (x / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e-17], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 4e-268], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-224], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+30], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot \frac{x}{\frac{a}{y}}\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 4 \cdot 10^{-268}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+30}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000007e-17 or 3.99999999999999983e-268 < (*.f64 x y) < 4.9999999999999999e-224Initial program 86.5%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in x around inf 71.1%
associate-/l*77.0%
Simplified77.0%
if -1.00000000000000007e-17 < (*.f64 x y) < 3.99999999999999983e-268Initial program 91.0%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in x around 0 77.7%
associate-/l*77.0%
Simplified77.0%
if 4.9999999999999999e-224 < (*.f64 x y) < 1e30Initial program 92.8%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in x around 0 68.4%
associate-/l*68.6%
associate-/r/68.4%
Simplified68.4%
if 1e30 < (*.f64 x y) Initial program 74.2%
associate-*l*74.2%
Simplified74.2%
Taylor expanded in x around inf 63.5%
associate-/l*75.3%
Simplified75.3%
associate-/r/77.1%
Applied egg-rr77.1%
Final simplification75.6%
(FPCore (x y z t a)
:precision binary64
(if (<= t -5.6e-75)
(* -4.5 (/ z (/ a t)))
(if (<= t 3.9e+86)
(* 0.5 (* x (/ y a)))
(if (<= t 2e+170)
(* -4.5 (/ (* z t) a))
(if (<= t 8.1e+192) (* 0.5 (* y (/ x a))) (* -4.5 (* z (/ t a))))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e-75) {
tmp = -4.5 * (z / (a / t));
} else if (t <= 3.9e+86) {
tmp = 0.5 * (x * (y / a));
} else if (t <= 2e+170) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 8.1e+192) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= (-5.6d-75)) then
tmp = (-4.5d0) * (z / (a / t))
else if (t <= 3.9d+86) then
tmp = 0.5d0 * (x * (y / a))
else if (t <= 2d+170) then
tmp = (-4.5d0) * ((z * t) / a)
else if (t <= 8.1d+192) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e-75) {
tmp = -4.5 * (z / (a / t));
} else if (t <= 3.9e+86) {
tmp = 0.5 * (x * (y / a));
} else if (t <= 2e+170) {
tmp = -4.5 * ((z * t) / a);
} else if (t <= 8.1e+192) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.6e-75: tmp = -4.5 * (z / (a / t)) elif t <= 3.9e+86: tmp = 0.5 * (x * (y / a)) elif t <= 2e+170: tmp = -4.5 * ((z * t) / a) elif t <= 8.1e+192: tmp = 0.5 * (y * (x / a)) else: tmp = -4.5 * (z * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.6e-75) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); elseif (t <= 3.9e+86) tmp = Float64(0.5 * Float64(x * Float64(y / a))); elseif (t <= 2e+170) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (t <= 8.1e+192) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.6e-75) tmp = -4.5 * (z / (a / t)); elseif (t <= 3.9e+86) tmp = 0.5 * (x * (y / a)); elseif (t <= 2e+170) tmp = -4.5 * ((z * t) / a); elseif (t <= 8.1e+192) tmp = 0.5 * (y * (x / a)); else tmp = -4.5 * (z * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.6e-75], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.9e+86], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+170], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.1e+192], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{-75}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+170}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;t \leq 8.1 \cdot 10^{+192}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if t < -5.59999999999999996e-75Initial program 82.0%
associate-*l*82.0%
Simplified82.0%
Taylor expanded in x around 0 56.4%
associate-/l*62.0%
associate-/r/62.7%
Simplified62.7%
*-commutative62.7%
clear-num62.6%
un-div-inv63.8%
Applied egg-rr63.8%
if -5.59999999999999996e-75 < t < 3.9000000000000002e86Initial program 90.9%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in x around inf 65.3%
associate-*r/67.0%
Simplified67.0%
if 3.9000000000000002e86 < t < 2.00000000000000007e170Initial program 87.2%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in x around 0 73.9%
if 2.00000000000000007e170 < t < 8.10000000000000019e192Initial program 68.6%
associate-*l*68.6%
Simplified68.6%
Taylor expanded in x around inf 35.6%
associate-/l*67.0%
Simplified67.0%
associate-/r/67.0%
Applied egg-rr67.0%
if 8.10000000000000019e192 < t Initial program 77.5%
associate-*l*77.6%
Simplified77.6%
Taylor expanded in x around 0 69.5%
associate-/l*81.8%
associate-/r/87.2%
Simplified87.2%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* x y) -5e+306) (not (<= (* x y) 1e+276))) (* 0.5 (* y (/ x a))) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e+306) || !((x * y) <= 1e+276)) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (((x * y) <= (-5d+306)) .or. (.not. ((x * y) <= 1d+276))) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) <= -5e+306) || !((x * y) <= 1e+276)) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((x * y) <= -5e+306) or not ((x * y) <= 1e+276): tmp = 0.5 * (y * (x / a)) else: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(x * y) <= -5e+306) || !(Float64(x * y) <= 1e+276)) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((x * y) <= -5e+306) || ~(((x * y) <= 1e+276))) tmp = 0.5 * (y * (x / a)); else tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5e+306], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+276]], $MachinePrecision]], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{+306} \lor \neg \left(x \cdot y \leq 10^{+276}\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999993e306 or 1.0000000000000001e276 < (*.f64 x y) Initial program 54.4%
associate-*l*54.4%
Simplified54.4%
Taylor expanded in x around inf 54.4%
associate-/l*92.3%
Simplified92.3%
associate-/r/92.4%
Applied egg-rr92.4%
if -4.99999999999999993e306 < (*.f64 x y) < 1.0000000000000001e276Initial program 92.8%
associate-*l*93.2%
Simplified93.2%
Final simplification93.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.2e-75) (* -4.5 (/ z (/ a t))) (if (<= t 1.3e+87) (* 0.5 (* x (/ y a))) (* -4.5 (* z (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.2e-75) {
tmp = -4.5 * (z / (a / t));
} else if (t <= 1.3e+87) {
tmp = 0.5 * (x * (y / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (t <= (-6.2d-75)) then
tmp = (-4.5d0) * (z / (a / t))
else if (t <= 1.3d+87) then
tmp = 0.5d0 * (x * (y / a))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.2e-75) {
tmp = -4.5 * (z / (a / t));
} else if (t <= 1.3e+87) {
tmp = 0.5 * (x * (y / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.2e-75: tmp = -4.5 * (z / (a / t)) elif t <= 1.3e+87: tmp = 0.5 * (x * (y / a)) else: tmp = -4.5 * (z * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.2e-75) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); elseif (t <= 1.3e+87) tmp = Float64(0.5 * Float64(x * Float64(y / a))); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.2e-75) tmp = -4.5 * (z / (a / t)); elseif (t <= 1.3e+87) tmp = 0.5 * (x * (y / a)); else tmp = -4.5 * (z * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.2e-75], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+87], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.2 \cdot 10^{-75}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+87}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if t < -6.20000000000000013e-75Initial program 82.0%
associate-*l*82.0%
Simplified82.0%
Taylor expanded in x around 0 56.4%
associate-/l*62.0%
associate-/r/62.7%
Simplified62.7%
*-commutative62.7%
clear-num62.6%
un-div-inv63.8%
Applied egg-rr63.8%
if -6.20000000000000013e-75 < t < 1.29999999999999999e87Initial program 90.9%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in x around inf 65.3%
associate-*r/67.0%
Simplified67.0%
if 1.29999999999999999e87 < t Initial program 80.6%
associate-*l*80.6%
Simplified80.6%
Taylor expanded in x around 0 68.6%
associate-/l*72.7%
associate-/r/80.6%
Simplified80.6%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
real(8) function code(x, y, z, t, a)
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
code = (-4.5d0) * (z * (t / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
def code(x, y, z, t, a): return -4.5 * (z * (t / a))
function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
function tmp = code(x, y, z, t, a) tmp = -4.5 * (z * (t / a)); end
code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 86.8%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in x around 0 48.0%
associate-/l*49.9%
associate-/r/51.8%
Simplified51.8%
Final simplification51.8%
(FPCore (x y z t a)
:precision binary64
(if (< a -2.090464557976709e+86)
(- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z))))
(if (< a 2.144030707833976e+99)
(/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))
(- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: tmp
if (a < (-2.090464557976709d+86)) then
tmp = (0.5d0 * ((y * x) / a)) - (4.5d0 * (t / (a / z)))
else if (a < 2.144030707833976d+99) then
tmp = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
else
tmp = ((y / a) * (x * 0.5d0)) - ((t / a) * (z * 4.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a < -2.090464557976709e+86) {
tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z)));
} else if (a < 2.144030707833976e+99) {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
} else {
tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a < -2.090464557976709e+86: tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))) elif a < 2.144030707833976e+99: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) else: tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a < -2.090464557976709e+86) tmp = Float64(Float64(0.5 * Float64(Float64(y * x) / a)) - Float64(4.5 * Float64(t / Float64(a / z)))); elseif (a < 2.144030707833976e+99) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); else tmp = Float64(Float64(Float64(y / a) * Float64(x * 0.5)) - Float64(Float64(t / a) * Float64(z * 4.5))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a < -2.090464557976709e+86) tmp = (0.5 * ((y * x) / a)) - (4.5 * (t / (a / z))); elseif (a < 2.144030707833976e+99) tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0); else tmp = ((y / a) * (x * 0.5)) - ((t / a) * (z * 4.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Less[a, -2.090464557976709e+86], N[(N[(0.5 * N[(N[(y * x), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[a, 2.144030707833976e+99], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / a), $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * N[(z * 4.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a < -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;a < 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\end{array}
\end{array}
herbie shell --seed 2024018
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))