
(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 11 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}
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (* z 9.0) t)))
(if (<= t_1 (- INFINITY))
(* (/ t a) (* z -4.5))
(if (<= t_1 5e+280)
(/ (- (* x y) t_1) (* a 2.0))
(* -4.5 (/ t (/ a z)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t / a) * (z * -4.5);
} else if (t_1 <= 5e+280) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (t / a) * (z * -4.5);
} else if (t_1 <= 5e+280) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -math.inf: tmp = (t / a) * (z * -4.5) elif t_1 <= 5e+280: tmp = ((x * y) - t_1) / (a * 2.0) else: tmp = -4.5 * (t / (a / z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * 9.0) * t) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t / a) * Float64(z * -4.5)); elseif (t_1 <= 5e+280) tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); else tmp = Float64(-4.5 * Float64(t / Float64(a / z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -Inf)
tmp = (t / a) * (z * -4.5);
elseif (t_1 <= 5e+280)
tmp = ((x * y) - t_1) / (a * 2.0);
else
tmp = -4.5 * (t / (a / z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t / a), $MachinePrecision] * N[(z * -4.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+280], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;\frac{t}{a} \cdot \left(z \cdot -4.5\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+280}:\\
\;\;\;\;\frac{x \cdot y - t_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -inf.0Initial program 63.3%
sub-neg63.3%
+-commutative63.3%
associate-*l*63.3%
distribute-rgt-neg-in63.3%
fma-def63.3%
*-commutative63.3%
distribute-rgt-neg-in63.3%
metadata-eval63.3%
Simplified63.3%
add-cube-cbrt63.3%
pow363.3%
div-inv63.3%
metadata-eval63.3%
div-inv63.3%
clear-num63.3%
Applied egg-rr63.3%
Taylor expanded in z around inf 68.9%
*-commutative68.9%
associate-*r/94.1%
Simplified94.1%
rem-cube-cbrt94.6%
associate-*r*94.8%
Applied egg-rr94.8%
if -inf.0 < (*.f64 (*.f64 z 9) t) < 5.0000000000000002e280Initial program 96.2%
if 5.0000000000000002e280 < (*.f64 (*.f64 z 9) t) Initial program 52.1%
div-sub52.1%
+-rgt-identity52.1%
div-sub52.1%
+-rgt-identity52.1%
fma-neg59.2%
associate-*l*59.2%
distribute-rgt-neg-in59.2%
*-commutative59.2%
distribute-rgt-neg-in59.2%
metadata-eval59.2%
Simplified59.2%
Taylor expanded in x around 0 59.3%
associate-/l*92.7%
Simplified92.7%
Final simplification96.0%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (- (* x y) (* (* z 9.0) t)) -4e+277) (fma -4.5 (* z (/ t a)) (fma 0.5 (/ y (/ a x)) (/ 0.0 t))) (/ (fma x y (* z (* t -9.0))) (* a 2.0))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) - ((z * 9.0) * t)) <= -4e+277) {
tmp = fma(-4.5, (z * (t / a)), fma(0.5, (y / (a / x)), (0.0 / t)));
} else {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) <= -4e+277) tmp = fma(-4.5, Float64(z * Float64(t / a)), fma(0.5, Float64(y / Float64(a / x)), Float64(0.0 / t))); else tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); end return tmp end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], -4e+277], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision] + N[(0.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \leq -4 \cdot 10^{+277}:\\
\;\;\;\;\mathsf{fma}\left(-4.5, z \cdot \frac{t}{a}, \mathsf{fma}\left(0.5, \frac{y}{\frac{a}{x}}, \frac{0}{t}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -4.00000000000000001e277Initial program 63.7%
sub-neg63.7%
+-commutative63.7%
neg-sub063.7%
associate-+l-63.7%
sub0-neg63.7%
neg-mul-163.7%
associate-/l*63.7%
associate-/r/63.7%
*-commutative63.7%
sub-neg63.7%
+-commutative63.7%
neg-sub063.7%
associate-+l-63.7%
sub0-neg63.7%
distribute-lft-neg-out63.7%
distribute-rgt-neg-in63.7%
Simplified63.8%
Applied egg-rr4.0%
Taylor expanded in t around inf 19.8%
fma-def19.8%
*-commutative19.8%
associate-*r/30.6%
fma-def30.6%
associate-/l*30.6%
associate-*r/30.6%
distribute-rgt-out30.6%
metadata-eval30.6%
mul0-rgt92.0%
metadata-eval92.0%
Simplified92.0%
if -4.00000000000000001e277 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 94.7%
div-sub93.8%
+-rgt-identity93.8%
div-sub94.7%
+-rgt-identity94.7%
fma-neg95.5%
associate-*l*95.5%
distribute-rgt-neg-in95.5%
*-commutative95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
Simplified95.5%
Final simplification95.2%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (- (* x y) (* (* z 9.0) t)) -4e+277) (+ (fma -4.5 (* z (/ t a)) (* y (* x (/ 0.5 a)))) (/ 0.0 z)) (/ (fma x y (* z (* t -9.0))) (* a 2.0))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((x * y) - ((z * 9.0) * t)) <= -4e+277) {
tmp = fma(-4.5, (z * (t / a)), (y * (x * (0.5 / a)))) + (0.0 / z);
} else {
tmp = fma(x, y, (z * (t * -9.0))) / (a * 2.0);
}
return tmp;
}
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) <= -4e+277) tmp = Float64(fma(-4.5, Float64(z * Float64(t / a)), Float64(y * Float64(x * Float64(0.5 / a)))) + Float64(0.0 / z)); else tmp = Float64(fma(x, y, Float64(z * Float64(t * -9.0))) / Float64(a * 2.0)); end return tmp end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], -4e+277], N[(N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision] + N[(y * N[(x * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0 / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \leq -4 \cdot 10^{+277}:\\
\;\;\;\;\mathsf{fma}\left(-4.5, z \cdot \frac{t}{a}, y \cdot \left(x \cdot \frac{0.5}{a}\right)\right) + \frac{0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -4.00000000000000001e277Initial program 63.7%
sub-neg63.7%
+-commutative63.7%
neg-sub063.7%
associate-+l-63.7%
sub0-neg63.7%
neg-mul-163.7%
associate-/l*63.7%
associate-/r/63.7%
*-commutative63.7%
sub-neg63.7%
+-commutative63.7%
neg-sub063.7%
associate-+l-63.7%
sub0-neg63.7%
distribute-lft-neg-out63.7%
distribute-rgt-neg-in63.7%
Simplified63.8%
Applied egg-rr4.0%
Taylor expanded in z around inf 19.8%
+-commutative19.8%
associate-+r+19.8%
fma-def19.8%
*-commutative19.8%
associate-*r/30.6%
associate-*r/30.6%
*-commutative30.6%
associate-*l/30.6%
associate-*r*30.6%
associate-*r/30.6%
Simplified92.1%
if -4.00000000000000001e277 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 94.7%
div-sub93.8%
+-rgt-identity93.8%
div-sub94.7%
+-rgt-identity94.7%
fma-neg95.5%
associate-*l*95.5%
distribute-rgt-neg-in95.5%
*-commutative95.5%
distribute-rgt-neg-in95.5%
metadata-eval95.5%
Simplified95.5%
Final simplification95.2%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e-44)
(* x (* y (/ 0.5 a)))
(if (<= (* x y) 2e-133)
(* -4.5 (/ t (/ a z)))
(if (or (<= (* x y) 5e+59) (not (<= (* x y) 1e+130)))
(* (* x y) (/ 0.5 a))
(* -4.5 (* z (/ t a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = -4.5 * (t / (a / z));
} else if (((x * y) <= 5e+59) || !((x * y) <= 1e+130)) {
tmp = (x * y) * (0.5 / a);
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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) <= (-2d-44)) then
tmp = x * (y * (0.5d0 / a))
else if ((x * y) <= 2d-133) then
tmp = (-4.5d0) * (t / (a / z))
else if (((x * y) <= 5d+59) .or. (.not. ((x * y) <= 1d+130))) then
tmp = (x * y) * (0.5d0 / a)
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = -4.5 * (t / (a / z));
} else if (((x * y) <= 5e+59) || !((x * y) <= 1e+130)) {
tmp = (x * y) * (0.5 / a);
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-44: tmp = x * (y * (0.5 / a)) elif (x * y) <= 2e-133: tmp = -4.5 * (t / (a / z)) elif ((x * y) <= 5e+59) or not ((x * y) <= 1e+130): tmp = (x * y) * (0.5 / a) else: tmp = -4.5 * (z * (t / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-44) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 2e-133) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif ((Float64(x * y) <= 5e+59) || !(Float64(x * y) <= 1e+130)) tmp = Float64(Float64(x * y) * Float64(0.5 / a)); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-44)
tmp = x * (y * (0.5 / a));
elseif ((x * y) <= 2e-133)
tmp = -4.5 * (t / (a / z));
elseif (((x * y) <= 5e+59) || ~(((x * y) <= 1e+130)))
tmp = (x * y) * (0.5 / a);
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-44], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-133], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 5e+59], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1e+130]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-44}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-133}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+59} \lor \neg \left(x \cdot y \leq 10^{+130}\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999991e-44Initial program 90.4%
div-sub89.0%
+-rgt-identity89.0%
div-sub90.4%
+-rgt-identity90.4%
fma-neg91.8%
associate-*l*91.8%
distribute-rgt-neg-in91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in x around inf 69.8%
associate-*r/69.8%
*-commutative69.8%
*-commutative69.8%
*-commutative69.8%
Simplified69.8%
*-commutative69.8%
associate-*r/69.9%
associate-*l*71.3%
Applied egg-rr71.3%
if -1.99999999999999991e-44 < (*.f64 x y) < 2.0000000000000001e-133Initial program 90.3%
div-sub90.3%
+-rgt-identity90.3%
div-sub90.3%
+-rgt-identity90.3%
fma-neg90.3%
associate-*l*90.3%
distribute-rgt-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 79.1%
associate-/l*84.1%
Simplified84.1%
if 2.0000000000000001e-133 < (*.f64 x y) < 4.9999999999999997e59 or 1.0000000000000001e130 < (*.f64 x y) Initial program 94.1%
sub-neg94.1%
+-commutative94.1%
neg-sub094.1%
associate-+l-94.1%
sub0-neg94.1%
neg-mul-194.1%
associate-/l*93.7%
associate-/r/93.9%
*-commutative93.9%
sub-neg93.9%
+-commutative93.9%
neg-sub093.9%
associate-+l-93.9%
sub0-neg93.9%
distribute-lft-neg-out93.9%
distribute-rgt-neg-in93.9%
Simplified95.1%
Taylor expanded in x around inf 75.4%
if 4.9999999999999997e59 < (*.f64 x y) < 1.0000000000000001e130Initial program 88.8%
div-sub89.0%
+-rgt-identity89.0%
div-sub88.8%
+-rgt-identity88.8%
fma-neg88.8%
associate-*l*89.2%
distribute-rgt-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around 0 64.3%
associate-/l*63.9%
associate-/r/74.5%
Simplified74.5%
Final simplification77.3%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e-44)
(* x (* y (/ 0.5 a)))
(if (<= (* x y) 2e-133)
(* -4.5 (/ t (/ a z)))
(if (<= (* x y) 5e+59)
(* (* x y) (/ 0.5 a))
(if (<= (* x y) 1e+130)
(* -4.5 (* z (/ t a)))
(* (* y 0.5) (/ x a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 5e+59) {
tmp = (x * y) * (0.5 / a);
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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) <= (-2d-44)) then
tmp = x * (y * (0.5d0 / a))
else if ((x * y) <= 2d-133) then
tmp = (-4.5d0) * (t / (a / z))
else if ((x * y) <= 5d+59) then
tmp = (x * y) * (0.5d0 / a)
else if ((x * y) <= 1d+130) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (y * 0.5d0) * (x / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = -4.5 * (t / (a / z));
} else if ((x * y) <= 5e+59) {
tmp = (x * y) * (0.5 / a);
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-44: tmp = x * (y * (0.5 / a)) elif (x * y) <= 2e-133: tmp = -4.5 * (t / (a / z)) elif (x * y) <= 5e+59: tmp = (x * y) * (0.5 / a) elif (x * y) <= 1e+130: tmp = -4.5 * (z * (t / a)) else: tmp = (y * 0.5) * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-44) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 2e-133) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); elseif (Float64(x * y) <= 5e+59) tmp = Float64(Float64(x * y) * Float64(0.5 / a)); elseif (Float64(x * y) <= 1e+130) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(Float64(y * 0.5) * Float64(x / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-44)
tmp = x * (y * (0.5 / a));
elseif ((x * y) <= 2e-133)
tmp = -4.5 * (t / (a / z));
elseif ((x * y) <= 5e+59)
tmp = (x * y) * (0.5 / a);
elseif ((x * y) <= 1e+130)
tmp = -4.5 * (z * (t / a));
else
tmp = (y * 0.5) * (x / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-44], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-133], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+59], N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+130], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-44}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-133}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+59}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+130}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999991e-44Initial program 90.4%
div-sub89.0%
+-rgt-identity89.0%
div-sub90.4%
+-rgt-identity90.4%
fma-neg91.8%
associate-*l*91.8%
distribute-rgt-neg-in91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in x around inf 69.8%
associate-*r/69.8%
*-commutative69.8%
*-commutative69.8%
*-commutative69.8%
Simplified69.8%
*-commutative69.8%
associate-*r/69.9%
associate-*l*71.3%
Applied egg-rr71.3%
if -1.99999999999999991e-44 < (*.f64 x y) < 2.0000000000000001e-133Initial program 90.3%
div-sub90.3%
+-rgt-identity90.3%
div-sub90.3%
+-rgt-identity90.3%
fma-neg90.3%
associate-*l*90.3%
distribute-rgt-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 79.1%
associate-/l*84.1%
Simplified84.1%
if 2.0000000000000001e-133 < (*.f64 x y) < 4.9999999999999997e59Initial program 96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
neg-mul-196.9%
associate-/l*96.1%
associate-/r/96.8%
*-commutative96.8%
sub-neg96.8%
+-commutative96.8%
neg-sub096.8%
associate-+l-96.8%
sub0-neg96.8%
distribute-lft-neg-out96.8%
distribute-rgt-neg-in96.8%
Simplified96.7%
Taylor expanded in x around inf 65.3%
if 4.9999999999999997e59 < (*.f64 x y) < 1.0000000000000001e130Initial program 88.8%
div-sub89.0%
+-rgt-identity89.0%
div-sub88.8%
+-rgt-identity88.8%
fma-neg88.8%
associate-*l*89.2%
distribute-rgt-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around 0 64.3%
associate-/l*63.9%
associate-/r/74.5%
Simplified74.5%
if 1.0000000000000001e130 < (*.f64 x y) Initial program 92.0%
sub-neg92.0%
+-commutative92.0%
associate-*l*92.0%
distribute-rgt-neg-in92.0%
fma-def94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
metadata-eval94.0%
Simplified94.0%
add-cube-cbrt93.4%
pow393.4%
div-inv93.5%
metadata-eval93.5%
div-inv93.5%
clear-num93.5%
Applied egg-rr93.5%
cbrt-prod93.3%
Applied egg-rr93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in z around 0 82.7%
pow-base-182.7%
associate-*r*82.7%
metadata-eval82.7%
associate-*r/82.7%
associate-*r*82.7%
/-rgt-identity82.7%
*-commutative82.7%
associate-*l/84.5%
/-rgt-identity84.5%
*-commutative84.5%
Simplified84.5%
Final simplification77.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e-44)
(* x (* y (/ 0.5 a)))
(if (<= (* x y) 2e-133)
(/ (* t -4.5) (/ a z))
(if (<= (* x y) 5e+59)
(* (* x y) (/ 0.5 a))
(if (<= (* x y) 1e+130)
(* -4.5 (* z (/ t a)))
(* (* y 0.5) (/ x a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = (t * -4.5) / (a / z);
} else if ((x * y) <= 5e+59) {
tmp = (x * y) * (0.5 / a);
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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) <= (-2d-44)) then
tmp = x * (y * (0.5d0 / a))
else if ((x * y) <= 2d-133) then
tmp = (t * (-4.5d0)) / (a / z)
else if ((x * y) <= 5d+59) then
tmp = (x * y) * (0.5d0 / a)
else if ((x * y) <= 1d+130) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (y * 0.5d0) * (x / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = (t * -4.5) / (a / z);
} else if ((x * y) <= 5e+59) {
tmp = (x * y) * (0.5 / a);
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-44: tmp = x * (y * (0.5 / a)) elif (x * y) <= 2e-133: tmp = (t * -4.5) / (a / z) elif (x * y) <= 5e+59: tmp = (x * y) * (0.5 / a) elif (x * y) <= 1e+130: tmp = -4.5 * (z * (t / a)) else: tmp = (y * 0.5) * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-44) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 2e-133) tmp = Float64(Float64(t * -4.5) / Float64(a / z)); elseif (Float64(x * y) <= 5e+59) tmp = Float64(Float64(x * y) * Float64(0.5 / a)); elseif (Float64(x * y) <= 1e+130) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(Float64(y * 0.5) * Float64(x / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-44)
tmp = x * (y * (0.5 / a));
elseif ((x * y) <= 2e-133)
tmp = (t * -4.5) / (a / z);
elseif ((x * y) <= 5e+59)
tmp = (x * y) * (0.5 / a);
elseif ((x * y) <= 1e+130)
tmp = -4.5 * (z * (t / a));
else
tmp = (y * 0.5) * (x / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-44], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-133], N[(N[(t * -4.5), $MachinePrecision] / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+59], N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+130], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-44}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+59}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+130}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999991e-44Initial program 90.4%
div-sub89.0%
+-rgt-identity89.0%
div-sub90.4%
+-rgt-identity90.4%
fma-neg91.8%
associate-*l*91.8%
distribute-rgt-neg-in91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in x around inf 69.8%
associate-*r/69.8%
*-commutative69.8%
*-commutative69.8%
*-commutative69.8%
Simplified69.8%
*-commutative69.8%
associate-*r/69.9%
associate-*l*71.3%
Applied egg-rr71.3%
if -1.99999999999999991e-44 < (*.f64 x y) < 2.0000000000000001e-133Initial program 90.3%
div-sub90.3%
+-rgt-identity90.3%
div-sub90.3%
+-rgt-identity90.3%
fma-neg90.3%
associate-*l*90.3%
distribute-rgt-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 79.1%
associate-/l*84.1%
Simplified84.1%
associate-*r/84.1%
Applied egg-rr84.1%
if 2.0000000000000001e-133 < (*.f64 x y) < 4.9999999999999997e59Initial program 96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
neg-mul-196.9%
associate-/l*96.1%
associate-/r/96.8%
*-commutative96.8%
sub-neg96.8%
+-commutative96.8%
neg-sub096.8%
associate-+l-96.8%
sub0-neg96.8%
distribute-lft-neg-out96.8%
distribute-rgt-neg-in96.8%
Simplified96.7%
Taylor expanded in x around inf 65.3%
if 4.9999999999999997e59 < (*.f64 x y) < 1.0000000000000001e130Initial program 88.8%
div-sub89.0%
+-rgt-identity89.0%
div-sub88.8%
+-rgt-identity88.8%
fma-neg88.8%
associate-*l*89.2%
distribute-rgt-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around 0 64.3%
associate-/l*63.9%
associate-/r/74.5%
Simplified74.5%
if 1.0000000000000001e130 < (*.f64 x y) Initial program 92.0%
sub-neg92.0%
+-commutative92.0%
associate-*l*92.0%
distribute-rgt-neg-in92.0%
fma-def94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
metadata-eval94.0%
Simplified94.0%
add-cube-cbrt93.4%
pow393.4%
div-inv93.5%
metadata-eval93.5%
div-inv93.5%
clear-num93.5%
Applied egg-rr93.5%
cbrt-prod93.3%
Applied egg-rr93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in z around 0 82.7%
pow-base-182.7%
associate-*r*82.7%
metadata-eval82.7%
associate-*r/82.7%
associate-*r*82.7%
/-rgt-identity82.7%
*-commutative82.7%
associate-*l/84.5%
/-rgt-identity84.5%
*-commutative84.5%
Simplified84.5%
Final simplification77.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e-44)
(* x (* y (/ 0.5 a)))
(if (<= (* x y) 2e-133)
(/ (* t -4.5) (/ a z))
(if (<= (* x y) 5e+59)
(/ (* (* x y) 0.5) a)
(if (<= (* x y) 1e+130)
(* -4.5 (* z (/ t a)))
(* (* y 0.5) (/ x a)))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = (t * -4.5) / (a / z);
} else if ((x * y) <= 5e+59) {
tmp = ((x * y) * 0.5) / a;
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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) <= (-2d-44)) then
tmp = x * (y * (0.5d0 / a))
else if ((x * y) <= 2d-133) then
tmp = (t * (-4.5d0)) / (a / z)
else if ((x * y) <= 5d+59) then
tmp = ((x * y) * 0.5d0) / a
else if ((x * y) <= 1d+130) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (y * 0.5d0) * (x / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e-44) {
tmp = x * (y * (0.5 / a));
} else if ((x * y) <= 2e-133) {
tmp = (t * -4.5) / (a / z);
} else if ((x * y) <= 5e+59) {
tmp = ((x * y) * 0.5) / a;
} else if ((x * y) <= 1e+130) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e-44: tmp = x * (y * (0.5 / a)) elif (x * y) <= 2e-133: tmp = (t * -4.5) / (a / z) elif (x * y) <= 5e+59: tmp = ((x * y) * 0.5) / a elif (x * y) <= 1e+130: tmp = -4.5 * (z * (t / a)) else: tmp = (y * 0.5) * (x / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e-44) tmp = Float64(x * Float64(y * Float64(0.5 / a))); elseif (Float64(x * y) <= 2e-133) tmp = Float64(Float64(t * -4.5) / Float64(a / z)); elseif (Float64(x * y) <= 5e+59) tmp = Float64(Float64(Float64(x * y) * 0.5) / a); elseif (Float64(x * y) <= 1e+130) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(Float64(y * 0.5) * Float64(x / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e-44)
tmp = x * (y * (0.5 / a));
elseif ((x * y) <= 2e-133)
tmp = (t * -4.5) / (a / z);
elseif ((x * y) <= 5e+59)
tmp = ((x * y) * 0.5) / a;
elseif ((x * y) <= 1e+130)
tmp = -4.5 * (z * (t / a));
else
tmp = (y * 0.5) * (x / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e-44], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e-133], N[(N[(t * -4.5), $MachinePrecision] / N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+59], N[(N[(N[(x * y), $MachinePrecision] * 0.5), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+130], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{-44}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{-133}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a}{z}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+59}:\\
\;\;\;\;\frac{\left(x \cdot y\right) \cdot 0.5}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+130}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999991e-44Initial program 90.4%
div-sub89.0%
+-rgt-identity89.0%
div-sub90.4%
+-rgt-identity90.4%
fma-neg91.8%
associate-*l*91.8%
distribute-rgt-neg-in91.8%
*-commutative91.8%
distribute-rgt-neg-in91.8%
metadata-eval91.8%
Simplified91.8%
Taylor expanded in x around inf 69.8%
associate-*r/69.8%
*-commutative69.8%
*-commutative69.8%
*-commutative69.8%
Simplified69.8%
*-commutative69.8%
associate-*r/69.9%
associate-*l*71.3%
Applied egg-rr71.3%
if -1.99999999999999991e-44 < (*.f64 x y) < 2.0000000000000001e-133Initial program 90.3%
div-sub90.3%
+-rgt-identity90.3%
div-sub90.3%
+-rgt-identity90.3%
fma-neg90.3%
associate-*l*90.3%
distribute-rgt-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 79.1%
associate-/l*84.1%
Simplified84.1%
associate-*r/84.1%
Applied egg-rr84.1%
if 2.0000000000000001e-133 < (*.f64 x y) < 4.9999999999999997e59Initial program 96.9%
div-sub96.9%
+-rgt-identity96.9%
div-sub96.9%
+-rgt-identity96.9%
fma-neg96.9%
associate-*l*96.9%
distribute-rgt-neg-in96.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
metadata-eval96.9%
Simplified96.9%
Taylor expanded in x around inf 65.4%
associate-*r/65.4%
*-commutative65.4%
*-commutative65.4%
*-commutative65.4%
Simplified65.4%
if 4.9999999999999997e59 < (*.f64 x y) < 1.0000000000000001e130Initial program 88.8%
div-sub89.0%
+-rgt-identity89.0%
div-sub88.8%
+-rgt-identity88.8%
fma-neg88.8%
associate-*l*89.2%
distribute-rgt-neg-in89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
Simplified89.2%
Taylor expanded in x around 0 64.3%
associate-/l*63.9%
associate-/r/74.5%
Simplified74.5%
if 1.0000000000000001e130 < (*.f64 x y) Initial program 92.0%
sub-neg92.0%
+-commutative92.0%
associate-*l*92.0%
distribute-rgt-neg-in92.0%
fma-def94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
metadata-eval94.0%
Simplified94.0%
add-cube-cbrt93.4%
pow393.4%
div-inv93.5%
metadata-eval93.5%
div-inv93.5%
clear-num93.5%
Applied egg-rr93.5%
cbrt-prod93.3%
Applied egg-rr93.3%
*-commutative93.3%
Simplified93.3%
Taylor expanded in z around 0 82.7%
pow-base-182.7%
associate-*r*82.7%
metadata-eval82.7%
associate-*r/82.7%
associate-*r*82.7%
/-rgt-identity82.7%
*-commutative82.7%
associate-*l/84.5%
/-rgt-identity84.5%
*-commutative84.5%
Simplified84.5%
Final simplification77.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) (- INFINITY)) (/ (* y 0.5) (/ a x)) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = (y * 0.5) / (a / x);
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -Double.POSITIVE_INFINITY) {
tmp = (y * 0.5) / (a / x);
} else {
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = (y * 0.5) / (a / x) else: tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(Float64(y * 0.5) / Float64(a / x)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = (y * 0.5) / (a / x);
else
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], (-Infinity)], N[(N[(y * 0.5), $MachinePrecision] / N[(a / x), $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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{y \cdot 0.5}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 48.8%
sub-neg48.8%
+-commutative48.8%
associate-*l*48.8%
distribute-rgt-neg-in48.8%
fma-def48.8%
*-commutative48.8%
distribute-rgt-neg-in48.8%
metadata-eval48.8%
Simplified48.8%
add-cube-cbrt48.8%
pow348.8%
div-inv48.8%
metadata-eval48.8%
div-inv48.8%
clear-num48.8%
Applied egg-rr48.8%
cbrt-prod48.8%
Applied egg-rr48.8%
*-commutative48.8%
Simplified48.8%
Taylor expanded in z around 0 48.8%
pow-base-148.8%
associate-*r*48.8%
metadata-eval48.8%
associate-*r/48.8%
associate-*r*48.8%
/-rgt-identity48.8%
*-commutative48.8%
associate-*l/84.8%
/-rgt-identity84.8%
*-commutative84.8%
Simplified84.8%
*-commutative84.8%
clear-num84.9%
un-div-inv84.9%
Applied egg-rr84.9%
if -inf.0 < (*.f64 x y) Initial program 93.8%
associate-*l*93.8%
Simplified93.8%
Final simplification93.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= z -150000000.0) (not (<= z 1.75e-131))) (* -4.5 (/ t (/ a z))) (* x (* y (/ 0.5 a)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -150000000.0) || !(z <= 1.75e-131)) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = x * (y * (0.5 / a));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
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 ((z <= (-150000000.0d0)) .or. (.not. (z <= 1.75d-131))) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = x * (y * (0.5d0 / a))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -150000000.0) || !(z <= 1.75e-131)) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = x * (y * (0.5 / a));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z <= -150000000.0) or not (z <= 1.75e-131): tmp = -4.5 * (t / (a / z)) else: tmp = x * (y * (0.5 / a)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -150000000.0) || !(z <= 1.75e-131)) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(x * Float64(y * Float64(0.5 / a))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z <= -150000000.0) || ~((z <= 1.75e-131)))
tmp = -4.5 * (t / (a / z));
else
tmp = x * (y * (0.5 / a));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -150000000.0], N[Not[LessEqual[z, 1.75e-131]], $MachinePrecision]], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -150000000 \lor \neg \left(z \leq 1.75 \cdot 10^{-131}\right):\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \frac{0.5}{a}\right)\\
\end{array}
\end{array}
if z < -1.5e8 or 1.7500000000000001e-131 < z Initial program 89.1%
div-sub87.9%
+-rgt-identity87.9%
div-sub89.1%
+-rgt-identity89.1%
fma-neg90.3%
associate-*l*90.3%
distribute-rgt-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in x around 0 51.2%
associate-/l*55.7%
Simplified55.7%
if -1.5e8 < z < 1.7500000000000001e-131Initial program 95.6%
div-sub95.6%
+-rgt-identity95.6%
div-sub95.6%
+-rgt-identity95.6%
fma-neg95.6%
associate-*l*95.6%
distribute-rgt-neg-in95.6%
*-commutative95.6%
distribute-rgt-neg-in95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in x around inf 73.3%
associate-*r/73.3%
*-commutative73.3%
*-commutative73.3%
*-commutative73.3%
Simplified73.3%
*-commutative73.3%
associate-*r/73.4%
associate-*l*70.9%
Applied egg-rr70.9%
Final simplification61.4%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 91.5%
div-sub90.7%
+-rgt-identity90.7%
div-sub91.5%
+-rgt-identity91.5%
fma-neg92.3%
associate-*l*92.3%
distribute-rgt-neg-in92.3%
*-commutative92.3%
distribute-rgt-neg-in92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in x around 0 46.5%
associate-/l*49.0%
associate-/r/48.3%
Simplified48.3%
Final simplification48.3%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (/ t (/ a z))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
NOTE: z and t should be sorted in increasing order before calling this function.
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) * (t / (a / z))
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t / (a / z));
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (t / (a / z))
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t / Float64(a / z))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t / (a / z));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \frac{t}{\frac{a}{z}}
\end{array}
Initial program 91.5%
div-sub90.7%
+-rgt-identity90.7%
div-sub91.5%
+-rgt-identity91.5%
fma-neg92.3%
associate-*l*92.3%
distribute-rgt-neg-in92.3%
*-commutative92.3%
distribute-rgt-neg-in92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in x around 0 46.5%
associate-/l*49.0%
Simplified49.0%
Final simplification49.0%
(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 2023240
(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)))