
(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.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* (* z 9.0) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+264)))
(+ (* z (/ -4.5 (/ a t))) (* x (* 0.5 (/ y a))))
(/ t_1 (* a 2.0)))))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 <= -((double) INFINITY)) || !(t_1 <= 2e+264)) {
tmp = (z * (-4.5 / (a / t))) + (x * (0.5 * (y / a)));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+264)) {
tmp = (z * (-4.5 / (a / t))) + (x * (0.5 * (y / a)));
} else {
tmp = t_1 / (a * 2.0);
}
return tmp;
}
[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 <= -math.inf) or not (t_1 <= 2e+264): tmp = (z * (-4.5 / (a / t))) + (x * (0.5 * (y / a))) else: tmp = t_1 / (a * 2.0) return tmp
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 <= Float64(-Inf)) || !(t_1 <= 2e+264)) tmp = Float64(Float64(z * Float64(-4.5 / Float64(a / t))) + Float64(x * Float64(0.5 * Float64(y / a)))); 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])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - ((z * 9.0) * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e+264)))
tmp = (z * (-4.5 / (a / t))) + (x * (0.5 * (y / a)));
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.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+264]], $MachinePrecision]], N[(N[(z * N[(-4.5 / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(0.5 * N[(y / a), $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])\\
\\
\begin{array}{l}
t_1 := x \cdot y - \left(z \cdot 9\right) \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+264}\right):\\
\;\;\;\;z \cdot \frac{-4.5}{\frac{a}{t}} + x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a \cdot 2}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < -inf.0 or 2.00000000000000009e264 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) Initial program 74.5%
associate-*l*74.5%
Simplified74.5%
div-sub73.1%
sub-neg73.1%
*-commutative73.1%
times-frac79.5%
div-inv79.5%
*-commutative79.5%
associate-*l*79.5%
*-commutative79.5%
associate-/r*79.5%
metadata-eval79.5%
Applied egg-rr79.5%
+-commutative79.5%
distribute-rgt-neg-in79.5%
*-commutative79.5%
associate-*l*79.5%
fma-def79.5%
distribute-neg-frac79.5%
metadata-eval79.5%
metadata-eval79.5%
associate-*r/79.5%
metadata-eval79.5%
metadata-eval79.5%
Simplified79.5%
fma-udef79.5%
associate-*r/79.5%
associate-*l/79.5%
associate-*l/95.5%
*-commutative95.5%
associate-*l*95.6%
*-commutative95.6%
clear-num95.5%
un-div-inv95.6%
div-inv95.6%
metadata-eval95.6%
associate-*l*95.6%
Applied egg-rr95.6%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 (*.f64 z 9) t)) < 2.00000000000000009e264Initial program 99.2%
Final simplification98.2%
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 -5e+275)
(* (* z -4.5) (/ t a))
(if (<= t_1 2e+198)
(/ (- (* x y) t_1) (* a 2.0))
(/ -4.5 (/ (/ a t) z))))))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 <= -5e+275) {
tmp = (z * -4.5) * (t / a);
} else if (t_1 <= 2e+198) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = -4.5 / ((a / t) / z);
}
return tmp;
}
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 <= (-5d+275)) then
tmp = (z * (-4.5d0)) * (t / a)
else if (t_1 <= 2d+198) then
tmp = ((x * y) - t_1) / (a * 2.0d0)
else
tmp = (-4.5d0) / ((a / t) / z)
end if
code = tmp
end function
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 <= -5e+275) {
tmp = (z * -4.5) * (t / a);
} else if (t_1 <= 2e+198) {
tmp = ((x * y) - t_1) / (a * 2.0);
} else {
tmp = -4.5 / ((a / t) / z);
}
return tmp;
}
[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 <= -5e+275: tmp = (z * -4.5) * (t / a) elif t_1 <= 2e+198: tmp = ((x * y) - t_1) / (a * 2.0) else: tmp = -4.5 / ((a / t) / z) return tmp
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 <= -5e+275) tmp = Float64(Float64(z * -4.5) * Float64(t / a)); elseif (t_1 <= 2e+198) tmp = Float64(Float64(Float64(x * y) - t_1) / Float64(a * 2.0)); else tmp = Float64(-4.5 / Float64(Float64(a / t) / z)); end return tmp end
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 <= -5e+275)
tmp = (z * -4.5) * (t / a);
elseif (t_1 <= 2e+198)
tmp = ((x * y) - t_1) / (a * 2.0);
else
tmp = -4.5 / ((a / t) / z);
end
tmp_2 = tmp;
end
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, -5e+275], N[(N[(z * -4.5), $MachinePrecision] * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+198], N[(N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision], N[(-4.5 / N[(N[(a / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[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 -5 \cdot 10^{+275}:\\
\;\;\;\;\left(z \cdot -4.5\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+198}:\\
\;\;\;\;\frac{x \cdot y - t_1}{a \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-4.5}{\frac{\frac{a}{t}}{z}}\\
\end{array}
\end{array}
if (*.f64 (*.f64 z 9) t) < -5.0000000000000003e275Initial program 63.4%
associate-*l*63.4%
Simplified63.4%
Taylor expanded in x around 0 63.4%
associate-*l/94.5%
Simplified94.5%
*-commutative94.5%
associate-/r/94.3%
associate-*l/94.5%
Applied egg-rr94.5%
associate-/r/94.7%
*-commutative94.7%
*-un-lft-identity94.7%
times-frac94.7%
metadata-eval94.7%
clear-num94.3%
div-inv94.6%
*-commutative94.6%
associate-*r/94.7%
div-inv94.4%
clear-num94.6%
Applied egg-rr94.6%
if -5.0000000000000003e275 < (*.f64 (*.f64 z 9) t) < 2.00000000000000004e198Initial program 96.0%
if 2.00000000000000004e198 < (*.f64 (*.f64 z 9) t) Initial program 87.6%
associate-*l*87.6%
Simplified87.6%
Taylor expanded in x around 0 87.5%
associate-*l/99.8%
Simplified99.8%
*-commutative99.8%
clear-num97.4%
un-div-inv97.3%
Applied egg-rr97.3%
clear-num97.4%
un-div-inv97.4%
Applied egg-rr97.4%
Final simplification96.1%
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 (<= z -3.8e+56) (not (<= z 2.3e-123))) (* -4.5 (/ z (/ a t))) (* 0.5 (/ x (/ a y)))))
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 <= -3.8e+56) || !(z <= 2.3e-123)) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
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 <= (-3.8d+56)) .or. (.not. (z <= 2.3d-123))) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = 0.5d0 * (x / (a / y))
end if
code = tmp
end function
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 <= -3.8e+56) || !(z <= 2.3e-123)) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * (x / (a / y));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z <= -3.8e+56) or not (z <= 2.3e-123): tmp = -4.5 * (z / (a / t)) else: tmp = 0.5 * (x / (a / y)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.8e+56) || !(z <= 2.3e-123)) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = Float64(0.5 * Float64(x / Float64(a / y))); end return tmp end
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 <= -3.8e+56) || ~((z <= 2.3e-123)))
tmp = -4.5 * (z / (a / t));
else
tmp = 0.5 * (x / (a / y));
end
tmp_2 = tmp;
end
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[z, -3.8e+56], N[Not[LessEqual[z, 2.3e-123]], $MachinePrecision]], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+56} \lor \neg \left(z \leq 2.3 \cdot 10^{-123}\right):\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -3.79999999999999996e56 or 2.29999999999999987e-123 < z Initial program 88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in x around 0 63.5%
associate-*l/68.2%
Simplified68.2%
*-commutative68.2%
clear-num67.4%
un-div-inv67.7%
Applied egg-rr67.7%
if -3.79999999999999996e56 < z < 2.29999999999999987e-123Initial program 97.3%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in x around inf 73.7%
associate-/l*68.0%
Simplified68.0%
Final simplification67.9%
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 (<= z -9.5e+50) (not (<= z 9.2e-124))) (* -4.5 (/ z (/ a t))) (* 0.5 (/ (* x y) 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 <= -9.5e+50) || !(z <= 9.2e-124)) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
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 <= (-9.5d+50)) .or. (.not. (z <= 9.2d-124))) then
tmp = (-4.5d0) * (z / (a / t))
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
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 <= -9.5e+50) || !(z <= 9.2e-124)) {
tmp = -4.5 * (z / (a / t));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z <= -9.5e+50) or not (z <= 9.2e-124): tmp = -4.5 * (z / (a / t)) else: tmp = 0.5 * ((x * y) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+50) || !(z <= 9.2e-124)) tmp = Float64(-4.5 * Float64(z / Float64(a / t))); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
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 <= -9.5e+50) || ~((z <= 9.2e-124)))
tmp = -4.5 * (z / (a / t));
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
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[z, -9.5e+50], N[Not[LessEqual[z, 9.2e-124]], $MachinePrecision]], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+50} \lor \neg \left(z \leq 9.2 \cdot 10^{-124}\right):\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -9.4999999999999993e50 or 9.20000000000000048e-124 < z Initial program 88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in x around 0 63.5%
associate-*l/68.2%
Simplified68.2%
*-commutative68.2%
clear-num67.4%
un-div-inv67.7%
Applied egg-rr67.7%
if -9.4999999999999993e50 < z < 9.20000000000000048e-124Initial program 97.3%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in x around inf 73.7%
Final simplification70.5%
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 (<= z -6e+51) (not (<= z 2.3e-123))) (/ -4.5 (/ (/ a t) z)) (* 0.5 (/ (* x y) 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 <= -6e+51) || !(z <= 2.3e-123)) {
tmp = -4.5 / ((a / t) / z);
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
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 <= (-6d+51)) .or. (.not. (z <= 2.3d-123))) then
tmp = (-4.5d0) / ((a / t) / z)
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
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 <= -6e+51) || !(z <= 2.3e-123)) {
tmp = -4.5 / ((a / t) / z);
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z <= -6e+51) or not (z <= 2.3e-123): tmp = -4.5 / ((a / t) / z) else: tmp = 0.5 * ((x * y) / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6e+51) || !(z <= 2.3e-123)) tmp = Float64(-4.5 / Float64(Float64(a / t) / z)); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
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 <= -6e+51) || ~((z <= 2.3e-123)))
tmp = -4.5 / ((a / t) / z);
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
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[z, -6e+51], N[Not[LessEqual[z, 2.3e-123]], $MachinePrecision]], N[(-4.5 / N[(N[(a / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+51} \lor \neg \left(z \leq 2.3 \cdot 10^{-123}\right):\\
\;\;\;\;\frac{-4.5}{\frac{\frac{a}{t}}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -6e51 or 2.29999999999999987e-123 < z Initial program 88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in x around 0 63.5%
associate-*l/68.2%
Simplified68.2%
*-commutative68.2%
clear-num67.4%
un-div-inv67.7%
Applied egg-rr67.7%
clear-num67.7%
un-div-inv67.8%
Applied egg-rr67.8%
if -6e51 < z < 2.29999999999999987e-123Initial program 97.3%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in x around inf 73.7%
Final simplification70.5%
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 -7.5e+50) (* (* z -4.5) (/ t a)) (if (<= z 2.3e-123) (* 0.5 (/ (* x y) a)) (* -4.5 (/ z (/ a t))))))
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 <= -7.5e+50) {
tmp = (z * -4.5) * (t / a);
} else if (z <= 2.3e-123) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
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 <= (-7.5d+50)) then
tmp = (z * (-4.5d0)) * (t / a)
else if (z <= 2.3d-123) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) * (z / (a / t))
end if
code = tmp
end function
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 <= -7.5e+50) {
tmp = (z * -4.5) * (t / a);
} else if (z <= 2.3e-123) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * (z / (a / t));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -7.5e+50: tmp = (z * -4.5) * (t / a) elif z <= 2.3e-123: tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 * (z / (a / t)) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -7.5e+50) tmp = Float64(Float64(z * -4.5) * Float64(t / a)); elseif (z <= 2.3e-123) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 * Float64(z / Float64(a / t))); end return tmp end
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 <= -7.5e+50)
tmp = (z * -4.5) * (t / a);
elseif (z <= 2.3e-123)
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 * (z / (a / t));
end
tmp_2 = tmp;
end
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, -7.5e+50], N[(N[(z * -4.5), $MachinePrecision] * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e-123], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+50}:\\
\;\;\;\;\left(z \cdot -4.5\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-123}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -7.4999999999999999e50Initial program 93.1%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in x around 0 83.7%
associate-*l/90.4%
Simplified90.4%
*-commutative90.4%
associate-/r/84.6%
associate-*l/84.9%
Applied egg-rr84.9%
associate-/r/90.5%
*-commutative90.5%
*-un-lft-identity90.5%
times-frac90.4%
metadata-eval90.4%
clear-num90.3%
div-inv90.5%
*-commutative90.5%
associate-*r/90.6%
div-inv90.4%
clear-num90.4%
Applied egg-rr90.4%
if -7.4999999999999999e50 < z < 2.29999999999999987e-123Initial program 97.3%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in x around inf 73.7%
if 2.29999999999999987e-123 < z Initial program 86.4%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in x around 0 55.1%
associate-*l/59.0%
Simplified59.0%
*-commutative59.0%
clear-num58.0%
un-div-inv58.4%
Applied egg-rr58.4%
Final simplification70.5%
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 -6.5e+52) (/ (* z -4.5) (/ a t)) (if (<= z 3.6e-124) (* 0.5 (/ (* x y) a)) (/ -4.5 (/ (/ a t) z)))))
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 <= -6.5e+52) {
tmp = (z * -4.5) / (a / t);
} else if (z <= 3.6e-124) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 / ((a / t) / z);
}
return tmp;
}
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 <= (-6.5d+52)) then
tmp = (z * (-4.5d0)) / (a / t)
else if (z <= 3.6d-124) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) / ((a / t) / z)
end if
code = tmp
end function
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 <= -6.5e+52) {
tmp = (z * -4.5) / (a / t);
} else if (z <= 3.6e-124) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 / ((a / t) / z);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -6.5e+52: tmp = (z * -4.5) / (a / t) elif z <= 3.6e-124: tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 / ((a / t) / z) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.5e+52) tmp = Float64(Float64(z * -4.5) / Float64(a / t)); elseif (z <= 3.6e-124) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 / Float64(Float64(a / t) / z)); end return tmp end
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 <= -6.5e+52)
tmp = (z * -4.5) / (a / t);
elseif (z <= 3.6e-124)
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 / ((a / t) / z);
end
tmp_2 = tmp;
end
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, -6.5e+52], N[(N[(z * -4.5), $MachinePrecision] / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e-124], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 / N[(N[(a / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+52}:\\
\;\;\;\;\frac{z \cdot -4.5}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-124}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-4.5}{\frac{\frac{a}{t}}{z}}\\
\end{array}
\end{array}
if z < -6.49999999999999996e52Initial program 93.1%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in x around 0 83.7%
associate-*l/90.4%
Simplified90.4%
*-commutative90.4%
clear-num90.2%
un-div-inv90.4%
Applied egg-rr90.4%
associate-*r/90.6%
Applied egg-rr90.6%
if -6.49999999999999996e52 < z < 3.6000000000000001e-124Initial program 97.3%
associate-*l*97.3%
Simplified97.3%
Taylor expanded in x around inf 73.7%
if 3.6000000000000001e-124 < z Initial program 86.4%
associate-*l*86.5%
Simplified86.5%
Taylor expanded in x around 0 55.1%
associate-*l/59.0%
Simplified59.0%
*-commutative59.0%
clear-num58.0%
un-div-inv58.4%
Applied egg-rr58.4%
clear-num58.4%
un-div-inv58.4%
Applied egg-rr58.4%
Final simplification70.5%
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 (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
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 = ((x * y) - (z * (9.0d0 * t))) / (a * 2.0d0)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * (9.0 * t))) / (a * 2.0);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return ((x * y) - (z * (9.0 * t))) / (a * 2.0)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * Float64(9.0 * t))) / Float64(a * 2.0)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = ((x * y) - (z * (9.0 * t))) / (a * 2.0);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}
\end{array}
Initial program 92.4%
associate-*l*92.4%
Simplified92.4%
Final simplification92.4%
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 (* z (/ 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 * (z * (t / a));
}
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) * (z * (t / a))
end function
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 * (z * (t / a));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (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(z * Float64(t / a))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
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[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 92.4%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in x around 0 49.9%
associate-*l/51.4%
Simplified51.4%
Final simplification51.4%
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 (/ z (/ a t))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z / (a / t));
}
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) * (z / (a / t))
end function
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 * (z / (a / t));
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return -4.5 * (z / (a / t))
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z / Float64(a / t))) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z / (a / t));
end
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[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
-4.5 \cdot \frac{z}{\frac{a}{t}}
\end{array}
Initial program 92.4%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in x around 0 49.9%
associate-*l/51.4%
Simplified51.4%
*-commutative51.4%
clear-num51.0%
un-div-inv51.2%
Applied egg-rr51.2%
Final simplification51.2%
(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 2024021
(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)))