
(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, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 -1e+298) (not (<= t_1 1e+288)))
(- (* x (/ y (* a 2.0))) (* (* z 9.0) (/ t (* a 2.0))))
(/ t_1 (* a 2.0)))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -1e+298) || !(t_1 <= 1e+288)) {
tmp = (x * (y / (a * 2.0))) - ((z * 9.0) * (t / (a * 2.0)));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 = (x * y) - ((z * 9.0d0) * t)
if ((t_1 <= (-1d+298)) .or. (.not. (t_1 <= 1d+288))) then
tmp = (x * (y / (a * 2.0d0))) - ((z * 9.0d0) * (t / (a * 2.0d0)))
else
tmp = t_1 / (a * 2.0d0)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - ((z * 9.0) * t);
double tmp;
if ((t_1 <= -1e+298) || !(t_1 <= 1e+288)) {
tmp = (x * (y / (a * 2.0))) - ((z * 9.0) * (t / (a * 2.0)));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - ((z * 9.0) * t) tmp = 0 if (t_1 <= -1e+298) or not (t_1 <= 1e+288): tmp = (x * (y / (a * 2.0))) - ((z * 9.0) * (t / (a * 2.0))) else: tmp = t_1 / (a * 2.0) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) tmp = 0.0 if ((t_1 <= -1e+298) || !(t_1 <= 1e+288)) tmp = Float64(Float64(x * Float64(y / Float64(a * 2.0))) - Float64(Float64(z * 9.0) * Float64(t / Float64(a * 2.0)))); else tmp = Float64(t_1 / Float64(a * 2.0)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - ((z * 9.0) * t);
tmp = 0.0;
if ((t_1 <= -1e+298) || ~((t_1 <= 1e+288)))
tmp = (x * (y / (a * 2.0))) - ((z * 9.0) * (t / (a * 2.0)));
else
tmp = t_1 / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+298], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(t / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+298} \lor \neg \left(t\_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a \cdot 2} - \left(z \cdot 9\right) \cdot \frac{t}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -9.9999999999999996e297 or 1e288 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 65.3%
div-sub61.0%
associate-/l*70.4%
associate-/l*94.2%
Applied egg-rr94.2%
if -9.9999999999999996e297 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 1e288Initial program 98.0%
Final simplification97.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 -4e+190)
(* -4.5 (* t (/ z a)))
(if (<= t_1 2e+238)
(/ (- (* x y) t_1) (* a 2.0))
(+ (* z (/ -4.5 (/ a t))) (* (* x y) (/ 0.5 a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -4e+190) {
tmp = -4.5 * (t * (z / a));
} else if (t_1 <= 2e+238) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = (z * (-4.5 / (a / t))) + ((x * y) * (0.5 / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 = (z * 9.0d0) * t
if (t_1 <= (-4d+190)) then
tmp = (-4.5d0) * (t * (z / a))
else if (t_1 <= 2d+238) then
tmp = ((x * y) - t_1) / (a * 2.0d0)
else
tmp = (z * ((-4.5d0) / (a / t))) + ((x * y) * (0.5d0 / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
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 <= -4e+190) {
tmp = -4.5 * (t * (z / a));
} else if (t_1 <= 2e+238) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = (z * (-4.5 / (a / t))) + ((x * y) * (0.5 / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -4e+190: tmp = -4.5 * (t * (z / a)) elif t_1 <= 2e+238: tmp = ((x * y) - t_1) / (a * 2.0) else: tmp = (z * (-4.5 / (a / t))) + ((x * y) * (0.5 / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * 9.0) * t) tmp = 0.0 if (t_1 <= -4e+190) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (t_1 <= 2e+238) tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); else tmp = Float64(Float64(z * Float64(-4.5 / Float64(a / t))) + Float64(Float64(x * y) * Float64(0.5 / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -4e+190)
tmp = -4.5 * (t * (z / a));
elseif (t_1 <= 2e+238)
tmp = ((x * y) - t_1) / (a * 2.0);
else
tmp = (z * (-4.5 / (a / t))) + ((x * y) * (0.5 / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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, -4e+190], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+238], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(-4.5 / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+190}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+238}:\\
\;\;\;\;\frac{x \cdot y - t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{-4.5}{\frac{a}{t}} + \left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -4.0000000000000003e190Initial program 70.3%
Taylor expanded in x around 0 72.7%
associate-/l*92.9%
Simplified92.9%
if -4.0000000000000003e190 < (*.f64 (*.f64 z 9) t) < 2.0000000000000001e238Initial program 95.7%
if 2.0000000000000001e238 < (*.f64 (*.f64 z 9) t) Initial program 64.3%
div-inv64.3%
fma-neg64.3%
*-commutative64.3%
distribute-rgt-neg-in64.3%
distribute-rgt-neg-in64.3%
metadata-eval64.3%
*-commutative64.3%
associate-/r*64.3%
metadata-eval64.3%
Applied egg-rr64.3%
*-commutative64.3%
fma-undefine64.3%
distribute-lft-in64.3%
Applied egg-rr64.3%
Taylor expanded in a around 0 64.5%
associate-*r/95.3%
*-commutative95.3%
associate-*r*95.4%
*-commutative95.4%
associate-*l/95.3%
associate-/r/95.2%
associate-/l*95.4%
Simplified95.4%
Final simplification95.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 -4e+190)
(* -4.5 (* t (/ z a)))
(if (<= t_1 1e+306)
(/ (- (* x y) t_1) (* a 2.0))
(* (/ t a) (* z -4.5))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * 9.0) * t;
double tmp;
if (t_1 <= -4e+190) {
tmp = -4.5 * (t * (z / a));
} else if (t_1 <= 1e+306) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = (t / a) * (z * -4.5);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 = (z * 9.0d0) * t
if (t_1 <= (-4d+190)) then
tmp = (-4.5d0) * (t * (z / a))
else if (t_1 <= 1d+306) then
tmp = ((x * y) - t_1) / (a * 2.0d0)
else
tmp = (t / a) * (z * (-4.5d0))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
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 <= -4e+190) {
tmp = -4.5 * (t * (z / a));
} else if (t_1 <= 1e+306) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = (t / a) * (z * -4.5);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (z * 9.0) * t tmp = 0 if t_1 <= -4e+190: tmp = -4.5 * (t * (z / a)) elif t_1 <= 1e+306: tmp = ((x * y) - t_1) / (a * 2.0) else: tmp = (t / a) * (z * -4.5) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(z * 9.0) * t) tmp = 0.0 if (t_1 <= -4e+190) tmp = Float64(-4.5 * Float64(t * Float64(z / a))); elseif (t_1 <= 1e+306) tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); else tmp = Float64(Float64(t / a) * Float64(z * -4.5)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (z * 9.0) * t;
tmp = 0.0;
if (t_1 <= -4e+190)
tmp = -4.5 * (t * (z / a));
elseif (t_1 <= 1e+306)
tmp = ((x * y) - t_1) / (a * 2.0);
else
tmp = (t / a) * (z * -4.5);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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, -4e+190], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+306], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(t / a), $MachinePrecision] * N[(z * -4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+190}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+306}:\\
\;\;\;\;\frac{x \cdot y - t\_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{a} \cdot \left(z \cdot -4.5\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -4.0000000000000003e190Initial program 70.3%
Taylor expanded in x around 0 72.7%
associate-/l*92.9%
Simplified92.9%
if -4.0000000000000003e190 < (*.f64 (*.f64 z 9) t) < 1.00000000000000002e306Initial program 95.4%
if 1.00000000000000002e306 < (*.f64 (*.f64 z 9) t) Initial program 53.4%
div-inv53.4%
fma-neg53.4%
*-commutative53.4%
distribute-rgt-neg-in53.4%
distribute-rgt-neg-in53.4%
metadata-eval53.4%
*-commutative53.4%
associate-/r*53.4%
metadata-eval53.4%
Applied egg-rr53.4%
Taylor expanded in x around 0 53.4%
*-commutative53.4%
associate-*r/99.4%
*-commutative99.4%
*-commutative99.4%
associate-*l*99.5%
Simplified99.5%
Final simplification95.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -9.8e-175)
(and (not (<= y 1.9e-36)) (or (<= y 1.65) (not (<= y 2.8e+57)))))
(* 0.5 (* y (/ x a)))
(* -4.5 (* t (/ z a)))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -9.8e-175) || (!(y <= 1.9e-36) && ((y <= 1.65) || !(y <= 2.8e+57)))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 <= (-9.8d-175)) .or. (.not. (y <= 1.9d-36)) .and. (y <= 1.65d0) .or. (.not. (y <= 2.8d+57))) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = (-4.5d0) * (t * (z / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -9.8e-175) || (!(y <= 1.9e-36) && ((y <= 1.65) || !(y <= 2.8e+57)))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (y <= -9.8e-175) or (not (y <= 1.9e-36) and ((y <= 1.65) or not (y <= 2.8e+57))): tmp = 0.5 * (y * (x / a)) else: tmp = -4.5 * (t * (z / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((y <= -9.8e-175) || (!(y <= 1.9e-36) && ((y <= 1.65) || !(y <= 2.8e+57)))) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(t * Float64(z / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y <= -9.8e-175) || (~((y <= 1.9e-36)) && ((y <= 1.65) || ~((y <= 2.8e+57)))))
tmp = 0.5 * (y * (x / a));
else
tmp = -4.5 * (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -9.8e-175], And[N[Not[LessEqual[y, 1.9e-36]], $MachinePrecision], Or[LessEqual[y, 1.65], N[Not[LessEqual[y, 2.8e+57]], $MachinePrecision]]]], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-175} \lor \neg \left(y \leq 1.9 \cdot 10^{-36}\right) \land \left(y \leq 1.65 \lor \neg \left(y \leq 2.8 \cdot 10^{+57}\right)\right):\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if y < -9.79999999999999996e-175 or 1.89999999999999985e-36 < y < 1.6499999999999999 or 2.8e57 < y Initial program 88.6%
div-inv88.5%
fma-neg89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
distribute-rgt-neg-in89.2%
metadata-eval89.2%
*-commutative89.2%
associate-/r*89.2%
metadata-eval89.2%
Applied egg-rr89.2%
*-commutative89.2%
fma-undefine88.5%
distribute-lft-in85.9%
Applied egg-rr85.9%
Taylor expanded in a around 0 86.0%
associate-*r/87.8%
*-commutative87.8%
associate-*r*87.8%
*-commutative87.8%
associate-*l/87.7%
associate-/r/88.4%
associate-/l*88.4%
Simplified88.4%
Taylor expanded in x around inf 66.4%
*-commutative66.4%
associate-/l*67.4%
Simplified67.4%
if -9.79999999999999996e-175 < y < 1.89999999999999985e-36 or 1.6499999999999999 < y < 2.8e57Initial program 89.5%
Taylor expanded in x around 0 70.7%
associate-/l*77.9%
Simplified77.9%
Final simplification71.6%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.05e+107)
(* t (* -4.5 (/ z a)))
(if (or (<= z -4.5e+23) (and (not (<= z -15.5)) (<= z 1.4e-57)))
(* 0.5 (* y (/ x a)))
(* -4.5 (* t (/ z a))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+107) {
tmp = t * (-4.5 * (z / a));
} else if ((z <= -4.5e+23) || (!(z <= -15.5) && (z <= 1.4e-57))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 <= (-1.05d+107)) then
tmp = t * ((-4.5d0) * (z / a))
else if ((z <= (-4.5d+23)) .or. (.not. (z <= (-15.5d0))) .and. (z <= 1.4d-57)) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = (-4.5d0) * (t * (z / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.05e+107) {
tmp = t * (-4.5 * (z / a));
} else if ((z <= -4.5e+23) || (!(z <= -15.5) && (z <= 1.4e-57))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -1.05e+107: tmp = t * (-4.5 * (z / a)) elif (z <= -4.5e+23) or (not (z <= -15.5) and (z <= 1.4e-57)): tmp = 0.5 * (y * (x / a)) else: tmp = -4.5 * (t * (z / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.05e+107) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); elseif ((z <= -4.5e+23) || (!(z <= -15.5) && (z <= 1.4e-57))) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(t * Float64(z / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -1.05e+107)
tmp = t * (-4.5 * (z / a));
elseif ((z <= -4.5e+23) || (~((z <= -15.5)) && (z <= 1.4e-57)))
tmp = 0.5 * (y * (x / a));
else
tmp = -4.5 * (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.05e+107], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -4.5e+23], And[N[Not[LessEqual[z, -15.5]], $MachinePrecision], LessEqual[z, 1.4e-57]]], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+107}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+23} \lor \neg \left(z \leq -15.5\right) \land z \leq 1.4 \cdot 10^{-57}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if z < -1.05e107Initial program 87.0%
Taylor expanded in x around 0 70.9%
*-commutative70.9%
associate-/l*77.2%
associate-*l*77.3%
Simplified77.3%
if -1.05e107 < z < -4.49999999999999979e23 or -15.5 < z < 1.4e-57Initial program 93.5%
div-inv93.5%
fma-neg93.5%
*-commutative93.5%
distribute-rgt-neg-in93.5%
distribute-rgt-neg-in93.5%
metadata-eval93.5%
*-commutative93.5%
associate-/r*93.5%
metadata-eval93.5%
Applied egg-rr93.5%
*-commutative93.5%
fma-undefine93.5%
distribute-lft-in91.9%
Applied egg-rr91.9%
Taylor expanded in a around 0 91.9%
associate-*r/92.6%
*-commutative92.6%
associate-*r*92.6%
*-commutative92.6%
associate-*l/92.6%
associate-/r/90.9%
associate-/l*90.2%
Simplified90.2%
Taylor expanded in x around inf 73.7%
*-commutative73.7%
associate-/l*73.2%
Simplified73.2%
if -4.49999999999999979e23 < z < -15.5 or 1.4e-57 < z Initial program 82.9%
Taylor expanded in x around 0 52.6%
associate-/l*66.7%
Simplified66.7%
Final simplification72.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -9.8e-175)
(* 0.5 (* y (/ x a)))
(if (<= y 2.35e-36)
(* t (* -4.5 (/ z a)))
(if (or (<= y 4.5) (not (<= y 2.8e+53)))
(* x (* 0.5 (/ y a)))
(* -4.5 (* t (/ z a)))))))assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.8e-175) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 2.35e-36) {
tmp = t * (-4.5 * (z / a));
} else if ((y <= 4.5) || !(y <= 2.8e+53)) {
tmp = x * (0.5 * (y / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 <= (-9.8d-175)) then
tmp = 0.5d0 * (y * (x / a))
else if (y <= 2.35d-36) then
tmp = t * ((-4.5d0) * (z / a))
else if ((y <= 4.5d0) .or. (.not. (y <= 2.8d+53))) then
tmp = x * (0.5d0 * (y / a))
else
tmp = (-4.5d0) * (t * (z / a))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.8e-175) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 2.35e-36) {
tmp = t * (-4.5 * (z / a));
} else if ((y <= 4.5) || !(y <= 2.8e+53)) {
tmp = x * (0.5 * (y / a));
} else {
tmp = -4.5 * (t * (z / a));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if y <= -9.8e-175: tmp = 0.5 * (y * (x / a)) elif y <= 2.35e-36: tmp = t * (-4.5 * (z / a)) elif (y <= 4.5) or not (y <= 2.8e+53): tmp = x * (0.5 * (y / a)) else: tmp = -4.5 * (t * (z / a)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -9.8e-175) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (y <= 2.35e-36) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); elseif ((y <= 4.5) || !(y <= 2.8e+53)) tmp = Float64(x * Float64(0.5 * Float64(y / a))); else tmp = Float64(-4.5 * Float64(t * Float64(z / a))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -9.8e-175)
tmp = 0.5 * (y * (x / a));
elseif (y <= 2.35e-36)
tmp = t * (-4.5 * (z / a));
elseif ((y <= 4.5) || ~((y <= 2.8e+53)))
tmp = x * (0.5 * (y / a));
else
tmp = -4.5 * (t * (z / a));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -9.8e-175], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.35e-36], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 4.5], N[Not[LessEqual[y, 2.8e+53]], $MachinePrecision]], N[(x * N[(0.5 * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-175}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{-36}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;y \leq 4.5 \lor \neg \left(y \leq 2.8 \cdot 10^{+53}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(t \cdot \frac{z}{a}\right)\\
\end{array}
\end{array}
if y < -9.79999999999999996e-175Initial program 85.9%
div-inv85.9%
fma-neg86.9%
*-commutative86.9%
distribute-rgt-neg-in86.9%
distribute-rgt-neg-in86.9%
metadata-eval86.9%
*-commutative86.9%
associate-/r*86.9%
metadata-eval86.9%
Applied egg-rr86.9%
*-commutative86.9%
fma-undefine85.9%
distribute-lft-in83.0%
Applied egg-rr83.0%
Taylor expanded in a around 0 83.1%
associate-*r/87.6%
*-commutative87.6%
associate-*r*87.6%
*-commutative87.6%
associate-*l/87.5%
associate-/r/87.6%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in x around inf 59.0%
*-commutative59.0%
associate-/l*60.1%
Simplified60.1%
if -9.79999999999999996e-175 < y < 2.3500000000000001e-36Initial program 89.4%
Taylor expanded in x around 0 72.7%
*-commutative72.7%
associate-/l*79.8%
associate-*l*79.8%
Simplified79.8%
if 2.3500000000000001e-36 < y < 4.5 or 2.8e53 < y Initial program 94.0%
Taylor expanded in x around inf 81.8%
*-commutative81.8%
associate-/l*79.1%
associate-*l*79.1%
Simplified79.1%
if 4.5 < y < 2.8e53Initial program 90.8%
Taylor expanded in x around 0 51.8%
associate-/l*60.7%
Simplified60.7%
Final simplification70.9%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e-11) (* 0.5 (* y (/ x a))) (if (<= (* x y) 5e-108) (* t (* -4.5 (/ z a))) (* (* x y) (/ 0.5 a)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) * (0.5 / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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) <= (-1d-11)) then
tmp = 0.5d0 * (y * (x / a))
else if ((x * y) <= 5d-108) then
tmp = t * ((-4.5d0) * (z / a))
else
tmp = (x * y) * (0.5d0 / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = t * (-4.5 * (z / a));
} else {
tmp = (x * y) * (0.5 / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e-11: tmp = 0.5 * (y * (x / a)) elif (x * y) <= 5e-108: tmp = t * (-4.5 * (z / a)) else: tmp = (x * y) * (0.5 / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e-11) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (Float64(x * y) <= 5e-108) tmp = Float64(t * Float64(-4.5 * Float64(z / a))); else tmp = Float64(Float64(x * y) * Float64(0.5 / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e-11)
tmp = 0.5 * (y * (x / a));
elseif ((x * y) <= 5e-108)
tmp = t * (-4.5 * (z / a));
else
tmp = (x * y) * (0.5 / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(t * N[(-4.5 * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\
\;\;\;\;t \cdot \left(-4.5 \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999939e-12Initial program 86.6%
div-inv86.6%
fma-neg87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
*-commutative87.8%
fma-undefine86.6%
distribute-lft-in81.6%
Applied egg-rr81.6%
Taylor expanded in a around 0 81.6%
associate-*r/86.2%
*-commutative86.2%
associate-*r*86.3%
*-commutative86.3%
associate-*l/86.3%
associate-/r/86.2%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 73.1%
*-commutative73.1%
associate-/l*76.2%
Simplified76.2%
if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108Initial program 90.2%
Taylor expanded in x around 0 80.8%
*-commutative80.8%
associate-/l*86.4%
associate-*l*86.5%
Simplified86.5%
if 5e-108 < (*.f64 x y) Initial program 89.7%
div-inv89.7%
fma-neg89.7%
*-commutative89.7%
distribute-rgt-neg-in89.7%
distribute-rgt-neg-in89.7%
metadata-eval89.7%
*-commutative89.7%
associate-/r*89.7%
metadata-eval89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 69.0%
Final simplification78.1%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e-11) (* 0.5 (* y (/ x a))) (if (<= (* x y) 5e-108) (/ (* t -4.5) (/ a z)) (* (* x y) (/ 0.5 a)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = (x * y) * (0.5 / a);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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) <= (-1d-11)) then
tmp = 0.5d0 * (y * (x / a))
else if ((x * y) <= 5d-108) then
tmp = (t * (-4.5d0)) / (a / z)
else
tmp = (x * y) * (0.5d0 / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = (x * y) * (0.5 / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e-11: tmp = 0.5 * (y * (x / a)) elif (x * y) <= 5e-108: tmp = (t * -4.5) / (a / z) else: tmp = (x * y) * (0.5 / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e-11) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (Float64(x * y) <= 5e-108) tmp = Float64(Float64(t * -4.5) / Float64(a / z)); else tmp = Float64(Float64(x * y) * Float64(0.5 / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e-11)
tmp = 0.5 * (y * (x / a));
elseif ((x * y) <= 5e-108)
tmp = (t * -4.5) / (a / z);
else
tmp = (x * y) * (0.5 / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(N[(t * -4.5), $MachinePrecision] / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{0.5}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999939e-12Initial program 86.6%
div-inv86.6%
fma-neg87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
*-commutative87.8%
fma-undefine86.6%
distribute-lft-in81.6%
Applied egg-rr81.6%
Taylor expanded in a around 0 81.6%
associate-*r/86.2%
*-commutative86.2%
associate-*r*86.3%
*-commutative86.3%
associate-*l/86.3%
associate-/r/86.2%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 73.1%
*-commutative73.1%
associate-/l*76.2%
Simplified76.2%
if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108Initial program 90.2%
Taylor expanded in x around 0 80.8%
associate-/l*86.4%
Simplified86.4%
associate-*r*86.4%
clear-num86.4%
un-div-inv86.5%
*-commutative86.5%
Applied egg-rr86.5%
if 5e-108 < (*.f64 x y) Initial program 89.7%
div-inv89.7%
fma-neg89.7%
*-commutative89.7%
distribute-rgt-neg-in89.7%
distribute-rgt-neg-in89.7%
metadata-eval89.7%
*-commutative89.7%
associate-/r*89.7%
metadata-eval89.7%
Applied egg-rr89.7%
Taylor expanded in x around inf 69.0%
Final simplification78.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e-11) (* 0.5 (* y (/ x a))) (if (<= (* x y) 5e-108) (/ (* t -4.5) (/ a z)) (/ (* x y) (* a 2.0)))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = (x * y) / (a * 2.0);
}
return tmp;
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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) <= (-1d-11)) then
tmp = 0.5d0 * (y * (x / a))
else if ((x * y) <= 5d-108) then
tmp = (t * (-4.5d0)) / (a / z)
else
tmp = (x * y) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e-11) {
tmp = 0.5 * (y * (x / a));
} else if ((x * y) <= 5e-108) {
tmp = (t * -4.5) / (a / z);
} else {
tmp = (x * y) / (a * 2.0);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e-11: tmp = 0.5 * (y * (x / a)) elif (x * y) <= 5e-108: tmp = (t * -4.5) / (a / z) else: tmp = (x * y) / (a * 2.0) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e-11) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (Float64(x * y) <= 5e-108) tmp = Float64(Float64(t * -4.5) / Float64(a / z)); else tmp = Float64(Float64(x * y) / Float64(a * 2.0)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e-11)
tmp = 0.5 * (y * (x / a));
elseif ((x * y) <= 5e-108)
tmp = (t * -4.5) / (a / z);
else
tmp = (x * y) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e-11], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-108], N[(N[(t * -4.5), $MachinePrecision] / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-108}:\\
\;\;\;\;\frac{t \cdot -4.5}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999939e-12Initial program 86.6%
div-inv86.6%
fma-neg87.8%
*-commutative87.8%
distribute-rgt-neg-in87.8%
distribute-rgt-neg-in87.8%
metadata-eval87.8%
*-commutative87.8%
associate-/r*87.8%
metadata-eval87.8%
Applied egg-rr87.8%
*-commutative87.8%
fma-undefine86.6%
distribute-lft-in81.6%
Applied egg-rr81.6%
Taylor expanded in a around 0 81.6%
associate-*r/86.2%
*-commutative86.2%
associate-*r*86.3%
*-commutative86.3%
associate-*l/86.3%
associate-/r/86.2%
associate-/l*86.2%
Simplified86.2%
Taylor expanded in x around inf 73.1%
*-commutative73.1%
associate-/l*76.2%
Simplified76.2%
if -9.99999999999999939e-12 < (*.f64 x y) < 5e-108Initial program 90.2%
Taylor expanded in x around 0 80.8%
associate-/l*86.4%
Simplified86.4%
associate-*r*86.4%
clear-num86.4%
un-div-inv86.5%
*-commutative86.5%
Applied egg-rr86.5%
if 5e-108 < (*.f64 x y) Initial program 89.7%
Taylor expanded in x around inf 69.0%
Final simplification78.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* t (/ z a))))
assert(x < y && y < z && z < t && t < a);
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, and a 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 * (z / a))
end function
assert x < y && y < z && z < t && t < a;
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (t * (z / a));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) [x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (t * (z / a))
x, y, z, t, a = sort([x, y, z, t, a]) x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(t * Float64(z / a))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (t * (z / a));
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(t * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\\\
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \left(t \cdot \frac{z}{a}\right)
\end{array}
Initial program 88.9%
Taylor expanded in x around 0 46.6%
associate-/l*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 2024043
(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)))