
(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 10 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: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -2e+300)
(fma (* x (/ 0.5 a)) y (* (/ 0.5 a) (* z (* t -9.0))))
(if (<= (* x y) 1e+245)
(/ (- (* x y) (* (* z t) 9.0)) (* a 2.0))
(/ 1.0 (* 2.0 (/ (/ a x) y))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+300) {
tmp = fma((x * (0.5 / a)), y, ((0.5 / a) * (z * (t * -9.0))));
} else if ((x * y) <= 1e+245) {
tmp = ((x * y) - ((z * t) * 9.0)) / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / y));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+300) tmp = fma(Float64(x * Float64(0.5 / a)), y, Float64(Float64(0.5 / a) * Float64(z * Float64(t * -9.0)))); elseif (Float64(x * y) <= 1e+245) tmp = Float64(Float64(Float64(x * y) - Float64(Float64(z * t) * 9.0)) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(2.0 * Float64(Float64(a / x) / y))); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+300], N[(N[(x * N[(0.5 / a), $MachinePrecision]), $MachinePrecision] * y + N[(N[(0.5 / a), $MachinePrecision] * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+245], N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 * N[(N[(a / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot \frac{0.5}{a}, y, \frac{0.5}{a} \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+245}:\\
\;\;\;\;\frac{x \cdot y - \left(z \cdot t\right) \cdot 9}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot \frac{\frac{a}{x}}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e300Initial program 58.5%
sub-neg58.5%
+-commutative58.5%
neg-sub058.5%
associate-+l-58.5%
sub0-neg58.5%
neg-mul-158.5%
associate-/l*58.5%
associate-/r/58.6%
*-commutative58.6%
sub-neg58.6%
+-commutative58.6%
neg-sub058.6%
associate-+l-58.6%
sub0-neg58.6%
distribute-lft-neg-out58.6%
distribute-rgt-neg-in58.6%
Simplified64.8%
*-commutative64.8%
fma-udef58.6%
*-commutative58.6%
metadata-eval58.6%
distribute-lft-neg-in58.6%
distribute-rgt-neg-in58.6%
distribute-lft-in58.6%
distribute-rgt-neg-in58.6%
distribute-lft-neg-in58.6%
metadata-eval58.6%
*-commutative58.6%
Applied egg-rr58.6%
associate-*r*93.6%
fma-def99.8%
Applied egg-rr99.8%
if -2.0000000000000001e300 < (*.f64 x y) < 1.00000000000000004e245Initial program 93.2%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in z around 0 93.3%
*-commutative93.3%
Simplified93.3%
if 1.00000000000000004e245 < (*.f64 x y) Initial program 73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
neg-mul-173.9%
associate-/l*73.9%
associate-/r/73.9%
*-commutative73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
distribute-lft-neg-out73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in x around inf 73.9%
*-commutative73.9%
associate-/l*99.7%
associate-*l/99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
*-un-lft-identity99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification94.1%
NOTE: x and y 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) (/ x a))
(if (<= (* x y) 1e+245)
(/ (- (* x y) (* z (* t 9.0))) (* a 2.0))
(/ 1.0 (* 2.0 (/ (/ a x) y))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = (y * 0.5) * (x / a);
} else if ((x * y) <= 1e+245) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / y));
}
return tmp;
}
assert x < y;
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) * (x / a);
} else if ((x * y) <= 1e+245) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = (y * 0.5) * (x / a) elif (x * y) <= 1e+245: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) else: tmp = 1.0 / (2.0 * ((a / x) / y)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(Float64(y * 0.5) * Float64(x / a)); elseif (Float64(x * y) <= 1e+245) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(2.0 * Float64(Float64(a / x) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = (y * 0.5) * (x / a);
elseif ((x * y) <= 1e+245)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = 1.0 / (2.0 * ((a / x) / y));
end
tmp_2 = tmp;
end
NOTE: x and y 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[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+245], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 * N[(N[(a / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+245}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot \frac{\frac{a}{x}}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 55.8%
sub-neg55.8%
+-commutative55.8%
neg-sub055.8%
associate-+l-55.8%
sub0-neg55.8%
neg-mul-155.8%
associate-/l*55.8%
associate-/r/55.8%
*-commutative55.8%
sub-neg55.8%
+-commutative55.8%
neg-sub055.8%
associate-+l-55.8%
sub0-neg55.8%
distribute-lft-neg-out55.8%
distribute-rgt-neg-in55.8%
Simplified62.5%
Taylor expanded in x around inf 55.8%
*-commutative55.8%
associate-/l*93.1%
associate-*l/93.1%
Simplified93.1%
div-inv93.1%
Applied egg-rr93.1%
Taylor expanded in a around 0 93.1%
if -inf.0 < (*.f64 x y) < 1.00000000000000004e245Initial program 93.3%
associate-*l*92.4%
Simplified92.4%
if 1.00000000000000004e245 < (*.f64 x y) Initial program 73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
neg-mul-173.9%
associate-/l*73.9%
associate-/r/73.9%
*-commutative73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
distribute-lft-neg-out73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in x around inf 73.9%
*-commutative73.9%
associate-/l*99.7%
associate-*l/99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
*-un-lft-identity99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification92.9%
NOTE: x and y 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) (/ x a))
(if (<= (* x y) 1e+245)
(/ (- (* x y) (* (* z t) 9.0)) (* a 2.0))
(/ 1.0 (* 2.0 (/ (/ a x) y))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -((double) INFINITY)) {
tmp = (y * 0.5) * (x / a);
} else if ((x * y) <= 1e+245) {
tmp = ((x * y) - ((z * t) * 9.0)) / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / y));
}
return tmp;
}
assert x < y;
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) * (x / a);
} else if ((x * y) <= 1e+245) {
tmp = ((x * y) - ((z * t) * 9.0)) / (a * 2.0);
} else {
tmp = 1.0 / (2.0 * ((a / x) / y));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -math.inf: tmp = (y * 0.5) * (x / a) elif (x * y) <= 1e+245: tmp = ((x * y) - ((z * t) * 9.0)) / (a * 2.0) else: tmp = 1.0 / (2.0 * ((a / x) / y)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= Float64(-Inf)) tmp = Float64(Float64(y * 0.5) * Float64(x / a)); elseif (Float64(x * y) <= 1e+245) tmp = Float64(Float64(Float64(x * y) - Float64(Float64(z * t) * 9.0)) / Float64(a * 2.0)); else tmp = Float64(1.0 / Float64(2.0 * Float64(Float64(a / x) / y))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -Inf)
tmp = (y * 0.5) * (x / a);
elseif ((x * y) <= 1e+245)
tmp = ((x * y) - ((z * t) * 9.0)) / (a * 2.0);
else
tmp = 1.0 / (2.0 * ((a / x) / y));
end
tmp_2 = tmp;
end
NOTE: x and y 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[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+245], N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(2.0 * N[(N[(a / x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+245}:\\
\;\;\;\;\frac{x \cdot y - \left(z \cdot t\right) \cdot 9}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{2 \cdot \frac{\frac{a}{x}}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -inf.0Initial program 55.8%
sub-neg55.8%
+-commutative55.8%
neg-sub055.8%
associate-+l-55.8%
sub0-neg55.8%
neg-mul-155.8%
associate-/l*55.8%
associate-/r/55.8%
*-commutative55.8%
sub-neg55.8%
+-commutative55.8%
neg-sub055.8%
associate-+l-55.8%
sub0-neg55.8%
distribute-lft-neg-out55.8%
distribute-rgt-neg-in55.8%
Simplified62.5%
Taylor expanded in x around inf 55.8%
*-commutative55.8%
associate-/l*93.1%
associate-*l/93.1%
Simplified93.1%
div-inv93.1%
Applied egg-rr93.1%
Taylor expanded in a around 0 93.1%
if -inf.0 < (*.f64 x y) < 1.00000000000000004e245Initial program 93.3%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in z around 0 93.3%
*-commutative93.3%
Simplified93.3%
if 1.00000000000000004e245 < (*.f64 x y) Initial program 73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
neg-mul-173.9%
associate-/l*73.9%
associate-/r/73.9%
*-commutative73.9%
sub-neg73.9%
+-commutative73.9%
neg-sub073.9%
associate-+l-73.9%
sub0-neg73.9%
distribute-lft-neg-out73.9%
distribute-rgt-neg-in73.9%
Simplified73.9%
Taylor expanded in x around inf 73.9%
*-commutative73.9%
associate-/l*99.7%
associate-*l/99.7%
Simplified99.7%
clear-num99.6%
inv-pow99.6%
Applied egg-rr99.6%
unpow-199.6%
*-un-lft-identity99.6%
*-commutative99.6%
times-frac99.6%
metadata-eval99.6%
Applied egg-rr99.6%
Final simplification93.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ t (/ a z)))))
(if (<= z -4.2e+57)
t_1
(if (<= z -4.45e-17)
(* (* y 0.5) (/ x a))
(if (<= z -1.2e-40)
(* -4.5 (* t (/ z a)))
(if (<= z 1.3e-130) (* x (/ (* y 0.5) a)) t_1))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (t / (a / z));
double tmp;
if (z <= -4.2e+57) {
tmp = t_1;
} else if (z <= -4.45e-17) {
tmp = (y * 0.5) * (x / a);
} else if (z <= -1.2e-40) {
tmp = -4.5 * (t * (z / a));
} else if (z <= 1.3e-130) {
tmp = x * ((y * 0.5) / a);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y 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) :: t_1
real(8) :: tmp
t_1 = (-4.5d0) * (t / (a / z))
if (z <= (-4.2d+57)) then
tmp = t_1
else if (z <= (-4.45d-17)) then
tmp = (y * 0.5d0) * (x / a)
else if (z <= (-1.2d-40)) then
tmp = (-4.5d0) * (t * (z / a))
else if (z <= 1.3d-130) then
tmp = x * ((y * 0.5d0) / a)
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (t / (a / z));
double tmp;
if (z <= -4.2e+57) {
tmp = t_1;
} else if (z <= -4.45e-17) {
tmp = (y * 0.5) * (x / a);
} else if (z <= -1.2e-40) {
tmp = -4.5 * (t * (z / a));
} else if (z <= 1.3e-130) {
tmp = x * ((y * 0.5) / a);
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * (t / (a / z)) tmp = 0 if z <= -4.2e+57: tmp = t_1 elif z <= -4.45e-17: tmp = (y * 0.5) * (x / a) elif z <= -1.2e-40: tmp = -4.5 * (t * (z / a)) elif z <= 1.3e-130: tmp = x * ((y * 0.5) / a) else: tmp = t_1 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(t / Float64(a / z))) tmp = 0.0 if (z <= -4.2e+57) tmp = t_1; elseif (z <= -4.45e-17) tmp = Float64(Float64(y * 0.5) * Float64(x / a)); elseif (z <= -1.2e-40) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (z <= 1.3e-130) tmp = Float64(x * Float64(Float64(y * 0.5) / a)); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * (t / (a / z));
tmp = 0.0;
if (z <= -4.2e+57)
tmp = t_1;
elseif (z <= -4.45e-17)
tmp = (y * 0.5) * (x / a);
elseif (z <= -1.2e-40)
tmp = -4.5 * (t * (z / a));
elseif (z <= 1.3e-130)
tmp = x * ((y * 0.5) / a);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.2e+57], t$95$1, If[LessEqual[z, -4.45e-17], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-40], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e-130], N[(x * N[(N[(y * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.45 \cdot 10^{-17}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-40}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-130}:\\
\;\;\;\;x \cdot \frac{y \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.19999999999999982e57 or 1.3e-130 < z Initial program 86.8%
sub-neg86.8%
+-commutative86.8%
neg-sub086.8%
associate-+l-86.8%
sub0-neg86.8%
neg-mul-186.8%
associate-/l*86.8%
associate-/r/86.7%
*-commutative86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
distribute-lft-neg-out86.7%
distribute-rgt-neg-in86.7%
Simplified87.5%
Taylor expanded in x around 0 58.0%
associate-/l*63.4%
Simplified63.4%
if -4.19999999999999982e57 < z < -4.4500000000000002e-17Initial program 92.2%
sub-neg92.2%
+-commutative92.2%
neg-sub092.2%
associate-+l-92.2%
sub0-neg92.2%
neg-mul-192.2%
associate-/l*91.5%
associate-/r/91.8%
*-commutative91.8%
sub-neg91.8%
+-commutative91.8%
neg-sub091.8%
associate-+l-91.8%
sub0-neg91.8%
distribute-lft-neg-out91.8%
distribute-rgt-neg-in91.8%
Simplified91.8%
Taylor expanded in x around inf 63.2%
*-commutative63.2%
associate-/l*55.4%
associate-*l/55.4%
Simplified55.4%
div-inv55.4%
Applied egg-rr55.4%
Taylor expanded in a around 0 55.3%
if -4.4500000000000002e-17 < z < -1.19999999999999996e-40Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
neg-mul-199.2%
associate-/l*98.8%
associate-/r/99.2%
*-commutative99.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
distribute-lft-neg-out99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in x around 0 72.8%
associate-/l*72.8%
Simplified72.8%
Taylor expanded in t around 0 72.8%
*-commutative72.8%
associate-/l*72.8%
associate-/r/72.8%
Simplified72.8%
if -1.19999999999999996e-40 < z < 1.3e-130Initial program 93.2%
sub-neg93.2%
+-commutative93.2%
neg-sub093.2%
associate-+l-93.2%
sub0-neg93.2%
neg-mul-193.2%
associate-/l*92.3%
associate-/r/93.1%
*-commutative93.1%
sub-neg93.1%
+-commutative93.1%
neg-sub093.1%
associate-+l-93.1%
sub0-neg93.1%
distribute-lft-neg-out93.1%
distribute-rgt-neg-in93.1%
Simplified91.2%
Taylor expanded in x around inf 66.5%
*-commutative66.5%
associate-/l*65.7%
associate-*l/65.7%
Simplified65.7%
associate-/r/59.8%
Applied egg-rr59.8%
Final simplification61.7%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ t (/ a z)))))
(if (<= z -3e+57)
t_1
(if (<= z -3.7e-14)
(* (* y 0.5) (/ x a))
(if (<= z -1.2e-37)
(* -4.5 (* t (/ z a)))
(if (<= z 6.8e-130) (/ (* x y) (* a 2.0)) t_1))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (t / (a / z));
double tmp;
if (z <= -3e+57) {
tmp = t_1;
} else if (z <= -3.7e-14) {
tmp = (y * 0.5) * (x / a);
} else if (z <= -1.2e-37) {
tmp = -4.5 * (t * (z / a));
} else if (z <= 6.8e-130) {
tmp = (x * y) / (a * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x and y 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) :: t_1
real(8) :: tmp
t_1 = (-4.5d0) * (t / (a / z))
if (z <= (-3d+57)) then
tmp = t_1
else if (z <= (-3.7d-14)) then
tmp = (y * 0.5d0) * (x / a)
else if (z <= (-1.2d-37)) then
tmp = (-4.5d0) * (t * (z / a))
else if (z <= 6.8d-130) then
tmp = (x * y) / (a * 2.0d0)
else
tmp = t_1
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * (t / (a / z));
double tmp;
if (z <= -3e+57) {
tmp = t_1;
} else if (z <= -3.7e-14) {
tmp = (y * 0.5) * (x / a);
} else if (z <= -1.2e-37) {
tmp = -4.5 * (t * (z / a));
} else if (z <= 6.8e-130) {
tmp = (x * y) / (a * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * (t / (a / z)) tmp = 0 if z <= -3e+57: tmp = t_1 elif z <= -3.7e-14: tmp = (y * 0.5) * (x / a) elif z <= -1.2e-37: tmp = -4.5 * (t * (z / a)) elif z <= 6.8e-130: tmp = (x * y) / (a * 2.0) else: tmp = t_1 return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(t / Float64(a / z))) tmp = 0.0 if (z <= -3e+57) tmp = t_1; elseif (z <= -3.7e-14) tmp = Float64(Float64(y * 0.5) * Float64(x / a)); elseif (z <= -1.2e-37) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (z <= 6.8e-130) tmp = Float64(Float64(x * y) / Float64(a * 2.0)); else tmp = t_1; end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * (t / (a / z));
tmp = 0.0;
if (z <= -3e+57)
tmp = t_1;
elseif (z <= -3.7e-14)
tmp = (y * 0.5) * (x / a);
elseif (z <= -1.2e-37)
tmp = -4.5 * (t * (z / a));
elseif (z <= 6.8e-130)
tmp = (x * y) / (a * 2.0);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+57], t$95$1, If[LessEqual[z, -3.7e-14], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-37], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.8e-130], N[(N[(x * y), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -3 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-14}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-37}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-130}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3e57 or 6.8000000000000001e-130 < z Initial program 86.8%
sub-neg86.8%
+-commutative86.8%
neg-sub086.8%
associate-+l-86.8%
sub0-neg86.8%
neg-mul-186.8%
associate-/l*86.8%
associate-/r/86.7%
*-commutative86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
distribute-lft-neg-out86.7%
distribute-rgt-neg-in86.7%
Simplified87.5%
Taylor expanded in x around 0 58.0%
associate-/l*63.4%
Simplified63.4%
if -3e57 < z < -3.70000000000000001e-14Initial program 92.2%
sub-neg92.2%
+-commutative92.2%
neg-sub092.2%
associate-+l-92.2%
sub0-neg92.2%
neg-mul-192.2%
associate-/l*91.5%
associate-/r/91.8%
*-commutative91.8%
sub-neg91.8%
+-commutative91.8%
neg-sub091.8%
associate-+l-91.8%
sub0-neg91.8%
distribute-lft-neg-out91.8%
distribute-rgt-neg-in91.8%
Simplified91.8%
Taylor expanded in x around inf 63.2%
*-commutative63.2%
associate-/l*55.4%
associate-*l/55.4%
Simplified55.4%
div-inv55.4%
Applied egg-rr55.4%
Taylor expanded in a around 0 55.3%
if -3.70000000000000001e-14 < z < -1.19999999999999995e-37Initial program 99.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
neg-mul-199.2%
associate-/l*98.8%
associate-/r/99.2%
*-commutative99.2%
sub-neg99.2%
+-commutative99.2%
neg-sub099.2%
associate-+l-99.2%
sub0-neg99.2%
distribute-lft-neg-out99.2%
distribute-rgt-neg-in99.2%
Simplified99.2%
Taylor expanded in x around 0 72.8%
associate-/l*72.8%
Simplified72.8%
Taylor expanded in t around 0 72.8%
*-commutative72.8%
associate-/l*72.8%
associate-/r/72.8%
Simplified72.8%
if -1.19999999999999995e-37 < z < 6.8000000000000001e-130Initial program 93.2%
associate-*l*91.3%
Simplified91.3%
Taylor expanded in x around inf 66.5%
Final simplification64.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (or (<= z -4.3e+57) (not (<= z 6.8e-130))) (* -4.5 (/ t (/ a z))) (* (* y 0.5) (/ x a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.3e+57) || !(z <= 6.8e-130)) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
NOTE: x and y 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 <= (-4.3d+57)) .or. (.not. (z <= 6.8d-130))) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = (y * 0.5d0) * (x / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.3e+57) || !(z <= 6.8e-130)) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = (y * 0.5) * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (z <= -4.3e+57) or not (z <= 6.8e-130): tmp = -4.5 * (t / (a / z)) else: tmp = (y * 0.5) * (x / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.3e+57) || !(z <= 6.8e-130)) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(Float64(y * 0.5) * Float64(x / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((z <= -4.3e+57) || ~((z <= 6.8e-130)))
tmp = -4.5 * (t / (a / z));
else
tmp = (y * 0.5) * (x / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.3e+57], N[Not[LessEqual[z, 6.8e-130]], $MachinePrecision]], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 0.5), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+57} \lor \neg \left(z \leq 6.8 \cdot 10^{-130}\right):\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 0.5\right) \cdot \frac{x}{a}\\
\end{array}
\end{array}
if z < -4.30000000000000033e57 or 6.8000000000000001e-130 < z Initial program 86.8%
sub-neg86.8%
+-commutative86.8%
neg-sub086.8%
associate-+l-86.8%
sub0-neg86.8%
neg-mul-186.8%
associate-/l*86.8%
associate-/r/86.7%
*-commutative86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
distribute-lft-neg-out86.7%
distribute-rgt-neg-in86.7%
Simplified87.5%
Taylor expanded in x around 0 58.0%
associate-/l*63.4%
Simplified63.4%
if -4.30000000000000033e57 < z < 6.8000000000000001e-130Initial program 93.2%
sub-neg93.2%
+-commutative93.2%
neg-sub093.2%
associate-+l-93.2%
sub0-neg93.2%
neg-mul-193.2%
associate-/l*92.4%
associate-/r/93.0%
*-commutative93.0%
sub-neg93.0%
+-commutative93.0%
neg-sub093.0%
associate-+l-93.0%
sub0-neg93.0%
distribute-lft-neg-out93.0%
distribute-rgt-neg-in93.0%
Simplified91.4%
Taylor expanded in x around inf 65.1%
*-commutative65.1%
associate-/l*63.5%
associate-*l/63.5%
Simplified63.5%
div-inv63.4%
Applied egg-rr63.4%
Taylor expanded in a around 0 63.7%
Final simplification63.6%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 1.35e+133) (* -4.5 (* t (/ z a))) (* -4.5 (* z (/ t a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.35e+133) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: x and y 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 (t <= 1.35d+133) then
tmp = (-4.5d0) * (t * (z / a))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 1.35e+133) {
tmp = -4.5 * (t * (z / a));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 1.35e+133: tmp = -4.5 * (t * (z / a)) else: tmp = -4.5 * (z * (t / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 1.35e+133) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 1.35e+133)
tmp = -4.5 * (t * (z / a));
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 1.35e+133], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.35 \cdot 10^{+133}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if t < 1.3500000000000001e133Initial program 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
sub0-neg90.3%
neg-mul-190.3%
associate-/l*89.9%
associate-/r/90.2%
*-commutative90.2%
sub-neg90.2%
+-commutative90.2%
neg-sub090.2%
associate-+l-90.2%
sub0-neg90.2%
distribute-lft-neg-out90.2%
distribute-rgt-neg-in90.2%
Simplified89.8%
Taylor expanded in x around 0 45.1%
associate-/l*45.2%
Simplified45.2%
Taylor expanded in t around 0 45.1%
*-commutative45.1%
associate-/l*46.8%
associate-/r/45.2%
Simplified45.2%
if 1.3500000000000001e133 < t Initial program 86.9%
sub-neg86.9%
+-commutative86.9%
neg-sub086.9%
associate-+l-86.9%
sub0-neg86.9%
neg-mul-186.9%
associate-/l*86.7%
associate-/r/86.7%
*-commutative86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
distribute-lft-neg-out86.7%
distribute-rgt-neg-in86.7%
Simplified86.8%
Taylor expanded in x around 0 68.4%
associate-/l*68.4%
associate-/r/81.1%
Simplified81.1%
Final simplification51.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 5.2e+134) (* -4.5 (/ t (/ a z))) (* -4.5 (* z (/ t a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.2e+134) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: x and y 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 (t <= 5.2d+134) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.2e+134) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 5.2e+134: tmp = -4.5 * (t / (a / z)) else: tmp = -4.5 * (z * (t / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.2e+134) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 5.2e+134)
tmp = -4.5 * (t / (a / z));
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.2e+134], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.2 \cdot 10^{+134}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if t < 5.2000000000000003e134Initial program 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
sub0-neg90.3%
neg-mul-190.3%
associate-/l*89.9%
associate-/r/90.2%
*-commutative90.2%
sub-neg90.2%
+-commutative90.2%
neg-sub090.2%
associate-+l-90.2%
sub0-neg90.2%
distribute-lft-neg-out90.2%
distribute-rgt-neg-in90.2%
Simplified89.8%
Taylor expanded in x around 0 45.1%
associate-/l*45.2%
Simplified45.2%
if 5.2000000000000003e134 < t Initial program 86.9%
sub-neg86.9%
+-commutative86.9%
neg-sub086.9%
associate-+l-86.9%
sub0-neg86.9%
neg-mul-186.9%
associate-/l*86.7%
associate-/r/86.7%
*-commutative86.7%
sub-neg86.7%
+-commutative86.7%
neg-sub086.7%
associate-+l-86.7%
sub0-neg86.7%
distribute-lft-neg-out86.7%
distribute-rgt-neg-in86.7%
Simplified86.8%
Taylor expanded in x around 0 68.4%
associate-/l*68.4%
associate-/r/81.1%
Simplified81.1%
Final simplification51.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 5.4e+131) (* -4.5 (/ t (/ a z))) (* -4.5 (/ z (/ a t)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.4e+131) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
NOTE: x and y 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 (t <= 5.4d+131) then
tmp = (-4.5d0) * (t / (a / z))
else
tmp = (-4.5d0) * (z / (a / t))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.4e+131) {
tmp = -4.5 * (t / (a / z));
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if t <= 5.4e+131: tmp = -4.5 * (t / (a / z)) else: tmp = -4.5 * (z / (a / t)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.4e+131) tmp = Float64(-4.5 * Float64(t / Float64(a / z))); else tmp = Float64(-4.5 * Float64(z / Float64(a / t))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 5.4e+131)
tmp = -4.5 * (t / (a / z));
else
tmp = -4.5 * (z / (a / t));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.4e+131], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.4 \cdot 10^{+131}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if t < 5.40000000000000008e131Initial program 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
sub0-neg90.3%
neg-mul-190.3%
associate-/l*89.9%
associate-/r/90.2%
*-commutative90.2%
sub-neg90.2%
+-commutative90.2%
neg-sub090.2%
associate-+l-90.2%
sub0-neg90.2%
distribute-lft-neg-out90.2%
distribute-rgt-neg-in90.2%
Simplified89.8%
Taylor expanded in x around 0 45.1%
associate-/l*45.2%
Simplified45.2%
if 5.40000000000000008e131 < t Initial program 86.9%
associate-*l*84.6%
Simplified84.6%
Taylor expanded in z around 0 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in x around 0 68.4%
*-commutative68.4%
associate-/l*81.2%
Simplified81.2%
Final simplification51.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
NOTE: x and y 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 x < y;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
NOTE: x and y 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}
[x, y] = \mathsf{sort}([x, y])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 89.7%
sub-neg89.7%
+-commutative89.7%
neg-sub089.7%
associate-+l-89.7%
sub0-neg89.7%
neg-mul-189.7%
associate-/l*89.4%
associate-/r/89.6%
*-commutative89.6%
sub-neg89.6%
+-commutative89.6%
neg-sub089.6%
associate-+l-89.6%
sub0-neg89.6%
distribute-lft-neg-out89.6%
distribute-rgt-neg-in89.6%
Simplified89.3%
Taylor expanded in x around 0 49.1%
associate-/l*49.2%
associate-/r/52.4%
Simplified52.4%
Final simplification52.4%
(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 2023182
(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)))