
(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) 4e+304) (/ (fma (* z t) -9.0 (* x y)) (* a 2.0)) (* 0.5 (* x (/ y a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+304) {
tmp = fma((z * t), -9.0, (x * y)) / (a * 2.0);
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 4e+304) tmp = Float64(fma(Float64(z * t), -9.0, Float64(x * y)) / Float64(a * 2.0)); else tmp = Float64(0.5 * Float64(x * Float64(y / a))); 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], 4e+304], N[(N[(N[(z * t), $MachinePrecision] * -9.0 + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 4 \cdot 10^{+304}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot t, -9, x \cdot y\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < 3.9999999999999998e304Initial program 96.5%
associate-*l*96.8%
Simplified96.8%
sub-neg96.8%
+-commutative96.8%
distribute-rgt-neg-in96.8%
distribute-lft-neg-in96.8%
metadata-eval96.8%
*-commutative96.8%
associate-*r*96.9%
fma-def96.9%
Applied egg-rr96.9%
if 3.9999999999999998e304 < (*.f64 x y) Initial program 57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
neg-mul-157.9%
associate-/l*57.9%
associate-/r/57.9%
*-commutative57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
distribute-lft-neg-out57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
Taylor expanded in x around inf 63.2%
associate-/l*99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification97.1%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -1.1e-89)
(and (not (<= y -1.75e-168))
(or (<= y -4e-200)
(and (not (<= y 2.25e+17))
(or (<= y 8e+87) (not (<= y 3.6e+130)))))))
(* 0.5 (* y (/ x a)))
(* -4.5 (/ (* z t) a))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.1e-89) || (!(y <= -1.75e-168) && ((y <= -4e-200) || (!(y <= 2.25e+17) && ((y <= 8e+87) || !(y <= 3.6e+130)))))) {
tmp = 0.5 * (y * (x / 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 ((y <= (-1.1d-89)) .or. (.not. (y <= (-1.75d-168))) .and. (y <= (-4d-200)) .or. (.not. (y <= 2.25d+17)) .and. (y <= 8d+87) .or. (.not. (y <= 3.6d+130))) then
tmp = 0.5d0 * (y * (x / 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 ((y <= -1.1e-89) || (!(y <= -1.75e-168) && ((y <= -4e-200) || (!(y <= 2.25e+17) && ((y <= 8e+87) || !(y <= 3.6e+130)))))) {
tmp = 0.5 * (y * (x / 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 (y <= -1.1e-89) or (not (y <= -1.75e-168) and ((y <= -4e-200) or (not (y <= 2.25e+17) and ((y <= 8e+87) or not (y <= 3.6e+130))))): tmp = 0.5 * (y * (x / 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 ((y <= -1.1e-89) || (!(y <= -1.75e-168) && ((y <= -4e-200) || (!(y <= 2.25e+17) && ((y <= 8e+87) || !(y <= 3.6e+130)))))) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(Float64(z * 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 ((y <= -1.1e-89) || (~((y <= -1.75e-168)) && ((y <= -4e-200) || (~((y <= 2.25e+17)) && ((y <= 8e+87) || ~((y <= 3.6e+130)))))))
tmp = 0.5 * (y * (x / 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[Or[LessEqual[y, -1.1e-89], And[N[Not[LessEqual[y, -1.75e-168]], $MachinePrecision], Or[LessEqual[y, -4e-200], And[N[Not[LessEqual[y, 2.25e+17]], $MachinePrecision], Or[LessEqual[y, 8e+87], N[Not[LessEqual[y, 3.6e+130]], $MachinePrecision]]]]]], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-89} \lor \neg \left(y \leq -1.75 \cdot 10^{-168}\right) \land \left(y \leq -4 \cdot 10^{-200} \lor \neg \left(y \leq 2.25 \cdot 10^{+17}\right) \land \left(y \leq 8 \cdot 10^{+87} \lor \neg \left(y \leq 3.6 \cdot 10^{+130}\right)\right)\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if y < -1.10000000000000006e-89 or -1.74999999999999991e-168 < y < -3.9999999999999999e-200 or 2.25e17 < y < 7.9999999999999997e87 or 3.6000000000000001e130 < y Initial program 90.6%
associate-*l*90.6%
Simplified90.6%
sub-neg90.6%
+-commutative90.6%
distribute-rgt-neg-in90.6%
distribute-lft-neg-in90.6%
metadata-eval90.6%
*-commutative90.6%
associate-*r*90.6%
fma-def90.6%
Applied egg-rr90.6%
Taylor expanded in z around 0 64.1%
associate-*r/68.9%
Simplified68.9%
if -1.10000000000000006e-89 < y < -1.74999999999999991e-168 or -3.9999999999999999e-200 < y < 2.25e17 or 7.9999999999999997e87 < y < 3.6000000000000001e130Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
neg-sub096.6%
associate-+l-96.6%
sub0-neg96.6%
neg-mul-196.6%
associate-/l*96.2%
associate-/r/96.4%
*-commutative96.4%
sub-neg96.4%
+-commutative96.4%
neg-sub096.4%
associate-+l-96.4%
sub0-neg96.4%
distribute-lft-neg-out96.4%
distribute-rgt-neg-in96.4%
Simplified97.3%
Taylor expanded in x around 0 75.7%
Final simplification72.2%
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 (/ (* z t) a))) (t_2 (* 0.5 (* x (/ y a)))))
(if (<= y -1.05e-89)
t_2
(if (<= y -1.75e-168)
t_1
(if (<= y -4e-200)
t_2
(if (or (<= y 7e+21) (and (not (<= y 7.4e+87)) (<= y 3.6e+130)))
t_1
(* 0.5 (* y (/ x a)))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1.05e-89) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if ((y <= 7e+21) || (!(y <= 7.4e+87) && (y <= 3.6e+130))) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * (x * (y / a))
if (y <= (-1.05d-89)) then
tmp = t_2
else if (y <= (-1.75d-168)) then
tmp = t_1
else if (y <= (-4d-200)) then
tmp = t_2
else if ((y <= 7d+21) .or. (.not. (y <= 7.4d+87)) .and. (y <= 3.6d+130)) then
tmp = t_1
else
tmp = 0.5d0 * (y * (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 t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1.05e-89) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if ((y <= 7e+21) || (!(y <= 7.4e+87) && (y <= 3.6e+130))) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * (x * (y / a)) tmp = 0 if y <= -1.05e-89: tmp = t_2 elif y <= -1.75e-168: tmp = t_1 elif y <= -4e-200: tmp = t_2 elif (y <= 7e+21) or (not (y <= 7.4e+87) and (y <= 3.6e+130)): tmp = t_1 else: tmp = 0.5 * (y * (x / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(x * Float64(y / a))) tmp = 0.0 if (y <= -1.05e-89) tmp = t_2; elseif (y <= -1.75e-168) tmp = t_1; elseif (y <= -4e-200) tmp = t_2; elseif ((y <= 7e+21) || (!(y <= 7.4e+87) && (y <= 3.6e+130))) tmp = t_1; else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * (x * (y / a));
tmp = 0.0;
if (y <= -1.05e-89)
tmp = t_2;
elseif (y <= -1.75e-168)
tmp = t_1;
elseif (y <= -4e-200)
tmp = t_2;
elseif ((y <= 7e+21) || (~((y <= 7.4e+87)) && (y <= 3.6e+130)))
tmp = t_1;
else
tmp = 0.5 * (y * (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_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.05e-89], t$95$2, If[LessEqual[y, -1.75e-168], t$95$1, If[LessEqual[y, -4e-200], t$95$2, If[Or[LessEqual[y, 7e+21], And[N[Not[LessEqual[y, 7.4e+87]], $MachinePrecision], LessEqual[y, 3.6e+130]]], t$95$1, N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -1.05 \cdot 10^{-89}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+21} \lor \neg \left(y \leq 7.4 \cdot 10^{+87}\right) \land y \leq 3.6 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if y < -1.05e-89 or -1.74999999999999991e-168 < y < -3.9999999999999999e-200Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.2%
associate-/r/93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
neg-sub093.3%
associate-+l-93.3%
sub0-neg93.3%
distribute-lft-neg-out93.3%
distribute-rgt-neg-in93.3%
Simplified93.3%
Taylor expanded in x around inf 62.5%
associate-/l*67.5%
associate-/r/63.7%
Applied egg-rr63.7%
if -1.05e-89 < y < -1.74999999999999991e-168 or -3.9999999999999999e-200 < y < 7e21 or 7.40000000000000005e87 < y < 3.6000000000000001e130Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
neg-sub096.6%
associate-+l-96.6%
sub0-neg96.6%
neg-mul-196.6%
associate-/l*96.2%
associate-/r/96.4%
*-commutative96.4%
sub-neg96.4%
+-commutative96.4%
neg-sub096.4%
associate-+l-96.4%
sub0-neg96.4%
distribute-lft-neg-out96.4%
distribute-rgt-neg-in96.4%
Simplified97.3%
Taylor expanded in x around 0 75.7%
if 7e21 < y < 7.40000000000000005e87 or 3.6000000000000001e130 < y Initial program 87.2%
associate-*l*87.2%
Simplified87.2%
sub-neg87.2%
+-commutative87.2%
distribute-rgt-neg-in87.2%
distribute-lft-neg-in87.2%
metadata-eval87.2%
*-commutative87.2%
associate-*r*87.1%
fma-def87.1%
Applied egg-rr87.1%
Taylor expanded in z around 0 66.1%
associate-*r/70.7%
Simplified70.7%
Final simplification71.1%
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 (/ (* z t) a))) (t_2 (* 0.5 (* x (/ y a)))))
(if (<= y -1.1e-89)
t_2
(if (<= y -1.8e-168)
t_1
(if (<= y -4e-200)
t_2
(if (<= y 1.65e+18)
t_1
(if (<= y 1.15e+88)
(* 0.5 (/ y (/ a x)))
(if (<= y 3.6e+130) t_1 (* 0.5 (* y (/ x a)))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1.1e-89) {
tmp = t_2;
} else if (y <= -1.8e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 1.65e+18) {
tmp = t_1;
} else if (y <= 1.15e+88) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 3.6e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * (x * (y / a))
if (y <= (-1.1d-89)) then
tmp = t_2
else if (y <= (-1.8d-168)) then
tmp = t_1
else if (y <= (-4d-200)) then
tmp = t_2
else if (y <= 1.65d+18) then
tmp = t_1
else if (y <= 1.15d+88) then
tmp = 0.5d0 * (y / (a / x))
else if (y <= 3.6d+130) then
tmp = t_1
else
tmp = 0.5d0 * (y * (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 t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1.1e-89) {
tmp = t_2;
} else if (y <= -1.8e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 1.65e+18) {
tmp = t_1;
} else if (y <= 1.15e+88) {
tmp = 0.5 * (y / (a / x));
} else if (y <= 3.6e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * (x * (y / a)) tmp = 0 if y <= -1.1e-89: tmp = t_2 elif y <= -1.8e-168: tmp = t_1 elif y <= -4e-200: tmp = t_2 elif y <= 1.65e+18: tmp = t_1 elif y <= 1.15e+88: tmp = 0.5 * (y / (a / x)) elif y <= 3.6e+130: tmp = t_1 else: tmp = 0.5 * (y * (x / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(x * Float64(y / a))) tmp = 0.0 if (y <= -1.1e-89) tmp = t_2; elseif (y <= -1.8e-168) tmp = t_1; elseif (y <= -4e-200) tmp = t_2; elseif (y <= 1.65e+18) tmp = t_1; elseif (y <= 1.15e+88) tmp = Float64(0.5 * Float64(y / Float64(a / x))); elseif (y <= 3.6e+130) tmp = t_1; else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * (x * (y / a));
tmp = 0.0;
if (y <= -1.1e-89)
tmp = t_2;
elseif (y <= -1.8e-168)
tmp = t_1;
elseif (y <= -4e-200)
tmp = t_2;
elseif (y <= 1.65e+18)
tmp = t_1;
elseif (y <= 1.15e+88)
tmp = 0.5 * (y / (a / x));
elseif (y <= 3.6e+130)
tmp = t_1;
else
tmp = 0.5 * (y * (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_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e-89], t$95$2, If[LessEqual[y, -1.8e-168], t$95$1, If[LessEqual[y, -4e-200], t$95$2, If[LessEqual[y, 1.65e+18], t$95$1, If[LessEqual[y, 1.15e+88], N[(0.5 * N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+130], t$95$1, N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{-89}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.8 \cdot 10^{-168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+88}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if y < -1.10000000000000006e-89 or -1.7999999999999999e-168 < y < -3.9999999999999999e-200Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.2%
associate-/r/93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
neg-sub093.3%
associate-+l-93.3%
sub0-neg93.3%
distribute-lft-neg-out93.3%
distribute-rgt-neg-in93.3%
Simplified93.3%
Taylor expanded in x around inf 62.5%
associate-/l*67.5%
associate-/r/63.7%
Applied egg-rr63.7%
if -1.10000000000000006e-89 < y < -1.7999999999999999e-168 or -3.9999999999999999e-200 < y < 1.65e18 or 1.1500000000000001e88 < y < 3.6000000000000001e130Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
neg-sub096.6%
associate-+l-96.6%
sub0-neg96.6%
neg-mul-196.6%
associate-/l*96.2%
associate-/r/96.4%
*-commutative96.4%
sub-neg96.4%
+-commutative96.4%
neg-sub096.4%
associate-+l-96.4%
sub0-neg96.4%
distribute-lft-neg-out96.4%
distribute-rgt-neg-in96.4%
Simplified97.3%
Taylor expanded in x around 0 75.7%
if 1.65e18 < y < 1.1500000000000001e88Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
associate-/l*99.7%
associate-/r/99.7%
*-commutative99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in x around inf 75.1%
associate-/l*68.1%
frac-2neg68.1%
div-inv68.1%
Applied egg-rr68.1%
un-div-inv68.1%
add-sqr-sqrt0.0%
sqrt-unprod3.0%
sqr-neg3.0%
sqrt-unprod3.0%
add-sqr-sqrt3.0%
add-sqr-sqrt10.9%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod25.0%
add-sqr-sqrt68.1%
Applied egg-rr68.1%
if 3.6000000000000001e130 < y Initial program 84.1%
associate-*l*84.0%
Simplified84.0%
sub-neg84.0%
+-commutative84.0%
distribute-rgt-neg-in84.0%
distribute-lft-neg-in84.0%
metadata-eval84.0%
*-commutative84.0%
associate-*r*84.0%
fma-def84.0%
Applied egg-rr84.0%
Taylor expanded in z around 0 63.9%
associate-*r/71.4%
Simplified71.4%
Final simplification71.1%
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 (/ (* z t) a))) (t_2 (* 0.5 (* x (/ y a)))))
(if (<= y -1e-89)
t_2
(if (<= y -1.75e-168)
t_1
(if (<= y -4e-200)
t_2
(if (<= y 7.6e+22)
t_1
(if (<= y 1.1e+88)
(* 0.5 (/ (* x y) a))
(if (<= y 3.1e+130) t_1 (* 0.5 (* y (/ x a)))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1e-89) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 7.6e+22) {
tmp = t_1;
} else if (y <= 1.1e+88) {
tmp = 0.5 * ((x * y) / a);
} else if (y <= 3.1e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * (x * (y / a))
if (y <= (-1d-89)) then
tmp = t_2
else if (y <= (-1.75d-168)) then
tmp = t_1
else if (y <= (-4d-200)) then
tmp = t_2
else if (y <= 7.6d+22) then
tmp = t_1
else if (y <= 1.1d+88) then
tmp = 0.5d0 * ((x * y) / a)
else if (y <= 3.1d+130) then
tmp = t_1
else
tmp = 0.5d0 * (y * (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 t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -1e-89) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 7.6e+22) {
tmp = t_1;
} else if (y <= 1.1e+88) {
tmp = 0.5 * ((x * y) / a);
} else if (y <= 3.1e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * (x * (y / a)) tmp = 0 if y <= -1e-89: tmp = t_2 elif y <= -1.75e-168: tmp = t_1 elif y <= -4e-200: tmp = t_2 elif y <= 7.6e+22: tmp = t_1 elif y <= 1.1e+88: tmp = 0.5 * ((x * y) / a) elif y <= 3.1e+130: tmp = t_1 else: tmp = 0.5 * (y * (x / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(x * Float64(y / a))) tmp = 0.0 if (y <= -1e-89) tmp = t_2; elseif (y <= -1.75e-168) tmp = t_1; elseif (y <= -4e-200) tmp = t_2; elseif (y <= 7.6e+22) tmp = t_1; elseif (y <= 1.1e+88) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (y <= 3.1e+130) tmp = t_1; else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * (x * (y / a));
tmp = 0.0;
if (y <= -1e-89)
tmp = t_2;
elseif (y <= -1.75e-168)
tmp = t_1;
elseif (y <= -4e-200)
tmp = t_2;
elseif (y <= 7.6e+22)
tmp = t_1;
elseif (y <= 1.1e+88)
tmp = 0.5 * ((x * y) / a);
elseif (y <= 3.1e+130)
tmp = t_1;
else
tmp = 0.5 * (y * (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_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1e-89], t$95$2, If[LessEqual[y, -1.75e-168], t$95$1, If[LessEqual[y, -4e-200], t$95$2, If[LessEqual[y, 7.6e+22], t$95$1, If[LessEqual[y, 1.1e+88], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+130], t$95$1, N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -1 \cdot 10^{-89}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 7.6 \cdot 10^{+22}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+88}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if y < -1.00000000000000004e-89 or -1.74999999999999991e-168 < y < -3.9999999999999999e-200Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.2%
associate-/r/93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
neg-sub093.3%
associate-+l-93.3%
sub0-neg93.3%
distribute-lft-neg-out93.3%
distribute-rgt-neg-in93.3%
Simplified93.3%
Taylor expanded in x around inf 62.5%
associate-/l*67.5%
associate-/r/63.7%
Applied egg-rr63.7%
if -1.00000000000000004e-89 < y < -1.74999999999999991e-168 or -3.9999999999999999e-200 < y < 7.6000000000000008e22 or 1.10000000000000004e88 < y < 3.1e130Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
neg-sub096.6%
associate-+l-96.6%
sub0-neg96.6%
neg-mul-196.6%
associate-/l*96.2%
associate-/r/96.4%
*-commutative96.4%
sub-neg96.4%
+-commutative96.4%
neg-sub096.4%
associate-+l-96.4%
sub0-neg96.4%
distribute-lft-neg-out96.4%
distribute-rgt-neg-in96.4%
Simplified97.3%
Taylor expanded in x around 0 75.7%
if 7.6000000000000008e22 < y < 1.10000000000000004e88Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
associate-/l*99.7%
associate-/r/99.7%
*-commutative99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in x around inf 75.1%
if 3.1e130 < y Initial program 84.1%
associate-*l*84.0%
Simplified84.0%
sub-neg84.0%
+-commutative84.0%
distribute-rgt-neg-in84.0%
distribute-lft-neg-in84.0%
metadata-eval84.0%
*-commutative84.0%
associate-*r*84.0%
fma-def84.0%
Applied egg-rr84.0%
Taylor expanded in z around 0 63.9%
associate-*r/71.4%
Simplified71.4%
Final simplification71.4%
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 (/ (* z t) a))) (t_2 (* 0.5 (* x (/ y a)))))
(if (<= y -4.7e-90)
t_2
(if (<= y -1.75e-168)
t_1
(if (<= y -4e-200)
t_2
(if (<= y 4.9e+20)
(* (* z t) (/ -4.5 a))
(if (<= y 1.15e+88)
(* 0.5 (/ (* x y) a))
(if (<= y 2.25e+130) t_1 (* 0.5 (* y (/ x a)))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -4.7e-90) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 4.9e+20) {
tmp = (z * t) * (-4.5 / a);
} else if (y <= 1.15e+88) {
tmp = 0.5 * ((x * y) / a);
} else if (y <= 2.25e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * (x * (y / a))
if (y <= (-4.7d-90)) then
tmp = t_2
else if (y <= (-1.75d-168)) then
tmp = t_1
else if (y <= (-4d-200)) then
tmp = t_2
else if (y <= 4.9d+20) then
tmp = (z * t) * ((-4.5d0) / a)
else if (y <= 1.15d+88) then
tmp = 0.5d0 * ((x * y) / a)
else if (y <= 2.25d+130) then
tmp = t_1
else
tmp = 0.5d0 * (y * (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 t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * (x * (y / a));
double tmp;
if (y <= -4.7e-90) {
tmp = t_2;
} else if (y <= -1.75e-168) {
tmp = t_1;
} else if (y <= -4e-200) {
tmp = t_2;
} else if (y <= 4.9e+20) {
tmp = (z * t) * (-4.5 / a);
} else if (y <= 1.15e+88) {
tmp = 0.5 * ((x * y) / a);
} else if (y <= 2.25e+130) {
tmp = t_1;
} else {
tmp = 0.5 * (y * (x / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * (x * (y / a)) tmp = 0 if y <= -4.7e-90: tmp = t_2 elif y <= -1.75e-168: tmp = t_1 elif y <= -4e-200: tmp = t_2 elif y <= 4.9e+20: tmp = (z * t) * (-4.5 / a) elif y <= 1.15e+88: tmp = 0.5 * ((x * y) / a) elif y <= 2.25e+130: tmp = t_1 else: tmp = 0.5 * (y * (x / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(x * Float64(y / a))) tmp = 0.0 if (y <= -4.7e-90) tmp = t_2; elseif (y <= -1.75e-168) tmp = t_1; elseif (y <= -4e-200) tmp = t_2; elseif (y <= 4.9e+20) tmp = Float64(Float64(z * t) * Float64(-4.5 / a)); elseif (y <= 1.15e+88) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (y <= 2.25e+130) tmp = t_1; else tmp = Float64(0.5 * Float64(y * Float64(x / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * (x * (y / a));
tmp = 0.0;
if (y <= -4.7e-90)
tmp = t_2;
elseif (y <= -1.75e-168)
tmp = t_1;
elseif (y <= -4e-200)
tmp = t_2;
elseif (y <= 4.9e+20)
tmp = (z * t) * (-4.5 / a);
elseif (y <= 1.15e+88)
tmp = 0.5 * ((x * y) / a);
elseif (y <= 2.25e+130)
tmp = t_1;
else
tmp = 0.5 * (y * (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_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.7e-90], t$95$2, If[LessEqual[y, -1.75e-168], t$95$1, If[LessEqual[y, -4e-200], t$95$2, If[LessEqual[y, 4.9e+20], N[(N[(z * t), $MachinePrecision] * N[(-4.5 / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e+88], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.25e+130], t$95$1, N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -4.7 \cdot 10^{-90}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.75 \cdot 10^{-168}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-200}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.9 \cdot 10^{+20}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \frac{-4.5}{a}\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{+88}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;y \leq 2.25 \cdot 10^{+130}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\end{array}
\end{array}
if y < -4.7e-90 or -1.74999999999999991e-168 < y < -3.9999999999999999e-200Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.2%
associate-/r/93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
neg-sub093.3%
associate-+l-93.3%
sub0-neg93.3%
distribute-lft-neg-out93.3%
distribute-rgt-neg-in93.3%
Simplified93.3%
Taylor expanded in x around inf 62.5%
associate-/l*67.5%
associate-/r/63.7%
Applied egg-rr63.7%
if -4.7e-90 < y < -1.74999999999999991e-168 or 1.1500000000000001e88 < y < 2.2500000000000002e130Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.3%
associate-/r/93.2%
*-commutative93.2%
sub-neg93.2%
+-commutative93.2%
neg-sub093.2%
associate-+l-93.2%
sub0-neg93.2%
distribute-lft-neg-out93.2%
distribute-rgt-neg-in93.2%
Simplified96.4%
Taylor expanded in x around 0 64.5%
if -3.9999999999999999e-200 < y < 4.9e20Initial program 97.6%
associate-*l*97.6%
Simplified97.6%
sub-neg97.6%
+-commutative97.6%
distribute-rgt-neg-in97.6%
distribute-lft-neg-in97.6%
metadata-eval97.6%
*-commutative97.6%
associate-*r*97.6%
fma-def97.7%
Applied egg-rr97.7%
Taylor expanded in z around inf 79.2%
associate-*r/79.3%
*-commutative79.3%
*-rgt-identity79.3%
times-frac79.3%
/-rgt-identity79.3%
*-commutative79.3%
Simplified79.3%
if 4.9e20 < y < 1.1500000000000001e88Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
neg-mul-199.7%
associate-/l*99.7%
associate-/r/99.7%
*-commutative99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
Simplified99.7%
Taylor expanded in x around inf 75.1%
if 2.2500000000000002e130 < y Initial program 84.1%
associate-*l*84.0%
Simplified84.0%
sub-neg84.0%
+-commutative84.0%
distribute-rgt-neg-in84.0%
distribute-lft-neg-in84.0%
metadata-eval84.0%
*-commutative84.0%
associate-*r*84.0%
fma-def84.0%
Applied egg-rr84.0%
Taylor expanded in z around 0 63.9%
associate-*r/71.4%
Simplified71.4%
Final simplification71.4%
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) 4e+304) (/ (- (* x y) (* z (* t 9.0))) (* a 2.0)) (* 0.5 (* x (/ y a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+304) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = 0.5 * (x * (y / 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 ((x * y) <= 4d+304) then
tmp = ((x * y) - (z * (t * 9.0d0))) / (a * 2.0d0)
else
tmp = 0.5d0 * (x * (y / 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 ((x * y) <= 4e+304) {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 4e+304: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) else: tmp = 0.5 * (x * (y / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 4e+304) tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); else tmp = Float64(0.5 * Float64(x * Float64(y / a))); 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) <= 4e+304)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
else
tmp = 0.5 * (x * (y / 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[N[(x * y), $MachinePrecision], 4e+304], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 4 \cdot 10^{+304}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < 3.9999999999999998e304Initial program 96.5%
associate-*l*96.8%
Simplified96.8%
if 3.9999999999999998e304 < (*.f64 x y) Initial program 57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
neg-mul-157.9%
associate-/l*57.9%
associate-/r/57.9%
*-commutative57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
distribute-lft-neg-out57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
Taylor expanded in x around inf 63.2%
associate-/l*99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification97.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) 4e+304) (/ (- (* x y) (* t (* z 9.0))) (* a 2.0)) (* 0.5 (* x (/ y a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 4e+304) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = 0.5 * (x * (y / 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 ((x * y) <= 4d+304) then
tmp = ((x * y) - (t * (z * 9.0d0))) / (a * 2.0d0)
else
tmp = 0.5d0 * (x * (y / 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 ((x * y) <= 4e+304) {
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
} else {
tmp = 0.5 * (x * (y / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 4e+304: tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0) else: tmp = 0.5 * (x * (y / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 4e+304) tmp = Float64(Float64(Float64(x * y) - Float64(t * Float64(z * 9.0))) / Float64(a * 2.0)); else tmp = Float64(0.5 * Float64(x * Float64(y / a))); 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) <= 4e+304)
tmp = ((x * y) - (t * (z * 9.0))) / (a * 2.0);
else
tmp = 0.5 * (x * (y / 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[N[(x * y), $MachinePrecision], 4e+304], N[(N[(N[(x * y), $MachinePrecision] - N[(t * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 4 \cdot 10^{+304}:\\
\;\;\;\;\frac{x \cdot y - t \cdot \left(z \cdot 9\right)}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < 3.9999999999999998e304Initial program 96.5%
if 3.9999999999999998e304 < (*.f64 x y) Initial program 57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
neg-mul-157.9%
associate-/l*57.9%
associate-/r/57.9%
*-commutative57.9%
sub-neg57.9%
+-commutative57.9%
neg-sub057.9%
associate-+l-57.9%
sub0-neg57.9%
distribute-lft-neg-out57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
Taylor expanded in x around inf 63.2%
associate-/l*99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification96.8%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= y 7.5e+124) (* -4.5 (/ (* z t) a)) (* -4.5 (/ z (/ a t)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 7.5e+124) {
tmp = -4.5 * ((z * t) / a);
} 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 (y <= 7.5d+124) then
tmp = (-4.5d0) * ((z * t) / a)
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 (y <= 7.5e+124) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if y <= 7.5e+124: tmp = -4.5 * ((z * t) / a) 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 (y <= 7.5e+124) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); 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 (y <= 7.5e+124)
tmp = -4.5 * ((z * t) / a);
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[y, 7.5e+124], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $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}\;y \leq 7.5 \cdot 10^{+124}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if y < 7.50000000000000038e124Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
associate-/l*95.4%
associate-/r/95.5%
*-commutative95.5%
sub-neg95.5%
+-commutative95.5%
neg-sub095.5%
associate-+l-95.5%
sub0-neg95.5%
distribute-lft-neg-out95.5%
distribute-rgt-neg-in95.5%
Simplified96.0%
Taylor expanded in x around 0 60.1%
if 7.50000000000000038e124 < y Initial program 84.3%
sub-neg84.3%
+-commutative84.3%
neg-sub084.3%
associate-+l-84.3%
sub0-neg84.3%
neg-mul-184.3%
associate-/l*84.2%
associate-/r/84.2%
*-commutative84.2%
sub-neg84.2%
+-commutative84.2%
neg-sub084.2%
associate-+l-84.2%
sub0-neg84.2%
distribute-lft-neg-out84.2%
distribute-rgt-neg-in84.2%
Simplified84.3%
Taylor expanded in x around 0 28.5%
associate-/l*34.3%
associate-/r/36.2%
Simplified36.2%
*-commutative36.2%
clear-num36.2%
un-div-inv36.1%
Applied egg-rr36.1%
Final simplification55.5%
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 93.5%
sub-neg93.5%
+-commutative93.5%
neg-sub093.5%
associate-+l-93.5%
sub0-neg93.5%
neg-mul-193.5%
associate-/l*93.2%
associate-/r/93.4%
*-commutative93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
distribute-lft-neg-out93.4%
distribute-rgt-neg-in93.4%
Simplified93.7%
Taylor expanded in x around 0 54.0%
associate-/l*50.3%
associate-/r/53.6%
Simplified53.6%
Final simplification53.6%
(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 2023224
(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)))