
(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: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* (fma x y (* z (* t -9.0))) (/ 0.5 a)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return fma(x, y, (z * (t * -9.0))) * (0.5 / a);
}
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(fma(x, y, Float64(z * Float64(t * -9.0))) * Float64(0.5 / a)) end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(x * y + N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\mathsf{fma}\left(x, y, z \cdot \left(t \cdot -9\right)\right) \cdot \frac{0.5}{a}
\end{array}
Initial program 97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
neg-mul-197.5%
associate-/l*97.3%
associate-/r/97.4%
*-commutative97.4%
sub-neg97.4%
+-commutative97.4%
neg-sub097.4%
associate-+l-97.4%
sub0-neg97.4%
distribute-lft-neg-out97.4%
distribute-rgt-neg-in97.4%
Simplified98.2%
Final simplification98.2%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (or (<= y -5e-102)
(and (not (<= y 1.52e+44))
(or (<= y 3.9e+86) (not (<= y 1.02e+101)))))
(* 0.5 (* y (/ x a)))
(* -4.5 (/ (* z t) a))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5e-102) || (!(y <= 1.52e+44) && ((y <= 3.9e+86) || !(y <= 1.02e+101)))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-5d-102)) .or. (.not. (y <= 1.52d+44)) .and. (y <= 3.9d+86) .or. (.not. (y <= 1.02d+101))) then
tmp = 0.5d0 * (y * (x / a))
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5e-102) || (!(y <= 1.52e+44) && ((y <= 3.9e+86) || !(y <= 1.02e+101)))) {
tmp = 0.5 * (y * (x / a));
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (y <= -5e-102) or (not (y <= 1.52e+44) and ((y <= 3.9e+86) or not (y <= 1.02e+101))): tmp = 0.5 * (y * (x / a)) else: tmp = -4.5 * ((z * t) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5e-102) || (!(y <= 1.52e+44) && ((y <= 3.9e+86) || !(y <= 1.02e+101)))) tmp = Float64(0.5 * Float64(y * Float64(x / a))); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((y <= -5e-102) || (~((y <= 1.52e+44)) && ((y <= 3.9e+86) || ~((y <= 1.02e+101)))))
tmp = 0.5 * (y * (x / a));
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5e-102], And[N[Not[LessEqual[y, 1.52e+44]], $MachinePrecision], Or[LessEqual[y, 3.9e+86], N[Not[LessEqual[y, 1.02e+101]], $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}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-102} \lor \neg \left(y \leq 1.52 \cdot 10^{+44}\right) \land \left(y \leq 3.9 \cdot 10^{+86} \lor \neg \left(y \leq 1.02 \cdot 10^{+101}\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 < -5.00000000000000026e-102 or 1.52000000000000003e44 < y < 3.9000000000000002e86 or 1.02000000000000002e101 < y Initial program 97.8%
sub-neg97.8%
+-commutative97.8%
neg-sub097.8%
associate-+l-97.8%
sub0-neg97.8%
neg-mul-197.8%
associate-/l*97.7%
associate-/r/97.7%
*-commutative97.7%
sub-neg97.7%
+-commutative97.7%
neg-sub097.7%
associate-+l-97.7%
sub0-neg97.7%
distribute-lft-neg-out97.7%
distribute-rgt-neg-in97.7%
Simplified99.1%
associate-*r/99.2%
clear-num99.1%
*-commutative99.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 76.7%
associate-*r/76.0%
Simplified76.0%
if -5.00000000000000026e-102 < y < 1.52000000000000003e44 or 3.9000000000000002e86 < y < 1.02000000000000002e101Initial program 97.1%
sub-neg97.1%
+-commutative97.1%
neg-sub097.1%
associate-+l-97.1%
sub0-neg97.1%
neg-mul-197.1%
associate-/l*96.9%
associate-/r/97.0%
*-commutative97.0%
sub-neg97.0%
+-commutative97.0%
neg-sub097.0%
associate-+l-97.0%
sub0-neg97.0%
distribute-lft-neg-out97.0%
distribute-rgt-neg-in97.0%
Simplified97.0%
Taylor expanded in x around 0 73.0%
Final simplification74.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.4e-101)
(* 0.5 (* y (/ x a)))
(if (or (<= y 1.32e+44) (and (not (<= y 1.7e+87)) (<= y 1.02e+102)))
(* -4.5 (/ (* z t) a))
(* 0.5 (/ (* x y) a)))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.4e-101) {
tmp = 0.5 * (y * (x / a));
} else if ((y <= 1.32e+44) || (!(y <= 1.7e+87) && (y <= 1.02e+102))) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.4d-101)) then
tmp = 0.5d0 * (y * (x / a))
else if ((y <= 1.32d+44) .or. (.not. (y <= 1.7d+87)) .and. (y <= 1.02d+102)) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.4e-101) {
tmp = 0.5 * (y * (x / a));
} else if ((y <= 1.32e+44) || (!(y <= 1.7e+87) && (y <= 1.02e+102))) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.4e-101: tmp = 0.5 * (y * (x / a)) elif (y <= 1.32e+44) or (not (y <= 1.7e+87) and (y <= 1.02e+102)): tmp = -4.5 * ((z * t) / a) else: tmp = 0.5 * ((x * y) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.4e-101) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif ((y <= 1.32e+44) || (!(y <= 1.7e+87) && (y <= 1.02e+102))) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.4e-101)
tmp = 0.5 * (y * (x / a));
elseif ((y <= 1.32e+44) || (~((y <= 1.7e+87)) && (y <= 1.02e+102)))
tmp = -4.5 * ((z * t) / a);
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.4e-101], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.32e+44], And[N[Not[LessEqual[y, 1.7e+87]], $MachinePrecision], LessEqual[y, 1.02e+102]]], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-101}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+44} \lor \neg \left(y \leq 1.7 \cdot 10^{+87}\right) \land y \leq 1.02 \cdot 10^{+102}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if y < -1.39999999999999995e-101Initial program 97.6%
sub-neg97.6%
+-commutative97.6%
neg-sub097.6%
associate-+l-97.6%
sub0-neg97.6%
neg-mul-197.6%
associate-/l*97.5%
associate-/r/97.5%
*-commutative97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
distribute-lft-neg-out97.5%
distribute-rgt-neg-in97.5%
Simplified98.6%
associate-*r/98.7%
clear-num98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 73.3%
associate-*r/72.1%
Simplified72.1%
if -1.39999999999999995e-101 < y < 1.3200000000000001e44 or 1.7000000000000001e87 < y < 1.01999999999999999e102Initial program 97.1%
sub-neg97.1%
+-commutative97.1%
neg-sub097.1%
associate-+l-97.1%
sub0-neg97.1%
neg-mul-197.1%
associate-/l*96.9%
associate-/r/97.0%
*-commutative97.0%
sub-neg97.0%
+-commutative97.0%
neg-sub097.0%
associate-+l-97.0%
sub0-neg97.0%
distribute-lft-neg-out97.0%
distribute-rgt-neg-in97.0%
Simplified97.0%
Taylor expanded in x around 0 73.0%
if 1.3200000000000001e44 < y < 1.7000000000000001e87 or 1.01999999999999999e102 < y Initial program 98.1%
sub-neg98.1%
+-commutative98.1%
neg-sub098.1%
associate-+l-98.1%
sub0-neg98.1%
neg-mul-198.1%
associate-/l*98.0%
associate-/r/98.0%
*-commutative98.0%
sub-neg98.0%
+-commutative98.0%
neg-sub098.0%
associate-+l-98.0%
sub0-neg98.0%
distribute-lft-neg-out98.0%
distribute-rgt-neg-in98.0%
Simplified99.9%
Taylor expanded in x around inf 82.2%
Final simplification74.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.35e-101)
(* 0.5 (* y (/ x a)))
(if (<= y 1.25e+44)
(* (* z t) (/ -4.5 a))
(if (or (<= y 8.2e+86) (not (<= y 1.3e+101)))
(* 0.5 (/ (* x y) a))
(* -4.5 (/ (* z t) a))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.35e-101) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.25e+44) {
tmp = (z * t) * (-4.5 / a);
} else if ((y <= 8.2e+86) || !(y <= 1.3e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.35d-101)) then
tmp = 0.5d0 * (y * (x / a))
else if (y <= 1.25d+44) then
tmp = (z * t) * ((-4.5d0) / a)
else if ((y <= 8.2d+86) .or. (.not. (y <= 1.3d+101))) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.35e-101) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.25e+44) {
tmp = (z * t) * (-4.5 / a);
} else if ((y <= 8.2e+86) || !(y <= 1.3e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.35e-101: tmp = 0.5 * (y * (x / a)) elif y <= 1.25e+44: tmp = (z * t) * (-4.5 / a) elif (y <= 8.2e+86) or not (y <= 1.3e+101): tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 * ((z * t) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.35e-101) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (y <= 1.25e+44) tmp = Float64(Float64(z * t) * Float64(-4.5 / a)); elseif ((y <= 8.2e+86) || !(y <= 1.3e+101)) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.35e-101)
tmp = 0.5 * (y * (x / a));
elseif (y <= 1.25e+44)
tmp = (z * t) * (-4.5 / a);
elseif ((y <= 8.2e+86) || ~((y <= 1.3e+101)))
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.35e-101], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.25e+44], N[(N[(z * t), $MachinePrecision] * N[(-4.5 / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 8.2e+86], N[Not[LessEqual[y, 1.3e+101]], $MachinePrecision]], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-101}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 1.25 \cdot 10^{+44}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \frac{-4.5}{a}\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+86} \lor \neg \left(y \leq 1.3 \cdot 10^{+101}\right):\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if y < -1.3500000000000001e-101Initial program 97.6%
sub-neg97.6%
+-commutative97.6%
neg-sub097.6%
associate-+l-97.6%
sub0-neg97.6%
neg-mul-197.6%
associate-/l*97.5%
associate-/r/97.5%
*-commutative97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
distribute-lft-neg-out97.5%
distribute-rgt-neg-in97.5%
Simplified98.6%
associate-*r/98.7%
clear-num98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 73.3%
associate-*r/72.1%
Simplified72.1%
if -1.3500000000000001e-101 < y < 1.2499999999999999e44Initial program 97.0%
sub-neg97.0%
+-commutative97.0%
neg-sub097.0%
associate-+l-97.0%
sub0-neg97.0%
neg-mul-197.0%
associate-/l*96.7%
associate-/r/96.9%
*-commutative96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
distribute-lft-neg-out96.9%
distribute-rgt-neg-in96.9%
Simplified96.9%
associate-*r/97.0%
clear-num96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
*-commutative72.9%
associate-*l/72.9%
metadata-eval72.9%
associate-*l*72.9%
*-commutative72.9%
associate-*r/72.9%
*-commutative72.9%
associate-*r*72.9%
associate-*l/72.9%
metadata-eval72.9%
*-commutative72.9%
Simplified72.9%
if 1.2499999999999999e44 < y < 8.1999999999999998e86 or 1.3e101 < y Initial program 98.1%
sub-neg98.1%
+-commutative98.1%
neg-sub098.1%
associate-+l-98.1%
sub0-neg98.1%
neg-mul-198.1%
associate-/l*98.0%
associate-/r/98.0%
*-commutative98.0%
sub-neg98.0%
+-commutative98.0%
neg-sub098.0%
associate-+l-98.0%
sub0-neg98.0%
distribute-lft-neg-out98.0%
distribute-rgt-neg-in98.0%
Simplified99.9%
Taylor expanded in x around inf 82.2%
if 8.1999999999999998e86 < y < 1.3e101Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-/l*100.0%
associate-/r/99.6%
*-commutative99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around 0 75.5%
Final simplification74.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.9e-79)
(* 0.5 (* y (/ x a)))
(if (<= y 1.2e+44)
(* (/ 0.5 a) (* z (* t -9.0)))
(if (or (<= y 1.7e+87) (not (<= y 1.02e+101)))
(* 0.5 (/ (* x y) a))
(* -4.5 (/ (* z t) a))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.9e-79) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.2e+44) {
tmp = (0.5 / a) * (z * (t * -9.0));
} else if ((y <= 1.7e+87) || !(y <= 1.02e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.9d-79)) then
tmp = 0.5d0 * (y * (x / a))
else if (y <= 1.2d+44) then
tmp = (0.5d0 / a) * (z * (t * (-9.0d0)))
else if ((y <= 1.7d+87) .or. (.not. (y <= 1.02d+101))) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.9e-79) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.2e+44) {
tmp = (0.5 / a) * (z * (t * -9.0));
} else if ((y <= 1.7e+87) || !(y <= 1.02e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.9e-79: tmp = 0.5 * (y * (x / a)) elif y <= 1.2e+44: tmp = (0.5 / a) * (z * (t * -9.0)) elif (y <= 1.7e+87) or not (y <= 1.02e+101): tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 * ((z * t) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.9e-79) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (y <= 1.2e+44) tmp = Float64(Float64(0.5 / a) * Float64(z * Float64(t * -9.0))); elseif ((y <= 1.7e+87) || !(y <= 1.02e+101)) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.9e-79)
tmp = 0.5 * (y * (x / a));
elseif (y <= 1.2e+44)
tmp = (0.5 / a) * (z * (t * -9.0));
elseif ((y <= 1.7e+87) || ~((y <= 1.02e+101)))
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.9e-79], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+44], N[(N[(0.5 / a), $MachinePrecision] * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.7e+87], N[Not[LessEqual[y, 1.02e+101]], $MachinePrecision]], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-79}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+44}:\\
\;\;\;\;\frac{0.5}{a} \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+87} \lor \neg \left(y \leq 1.02 \cdot 10^{+101}\right):\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if y < -1.9000000000000001e-79Initial program 97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
neg-mul-197.5%
associate-/l*97.4%
associate-/r/97.4%
*-commutative97.4%
sub-neg97.4%
+-commutative97.4%
neg-sub097.4%
associate-+l-97.4%
sub0-neg97.4%
distribute-lft-neg-out97.4%
distribute-rgt-neg-in97.4%
Simplified98.6%
associate-*r/98.7%
clear-num98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 74.3%
associate-*r/73.1%
Simplified73.1%
if -1.9000000000000001e-79 < y < 1.20000000000000007e44Initial program 97.1%
sub-neg97.1%
+-commutative97.1%
neg-sub097.1%
associate-+l-97.1%
sub0-neg97.1%
neg-mul-197.1%
associate-/l*96.9%
associate-/r/97.0%
*-commutative97.0%
sub-neg97.0%
+-commutative97.0%
neg-sub097.0%
associate-+l-97.0%
sub0-neg97.0%
distribute-lft-neg-out97.0%
distribute-rgt-neg-in97.0%
Simplified97.0%
Taylor expanded in x around 0 72.2%
*-commutative72.2%
associate-*l*72.3%
Simplified72.3%
Taylor expanded in t around 0 72.2%
associate-*r*72.2%
Simplified72.2%
if 1.20000000000000007e44 < y < 1.7000000000000001e87 or 1.02000000000000002e101 < y Initial program 98.1%
sub-neg98.1%
+-commutative98.1%
neg-sub098.1%
associate-+l-98.1%
sub0-neg98.1%
neg-mul-198.1%
associate-/l*98.0%
associate-/r/98.0%
*-commutative98.0%
sub-neg98.0%
+-commutative98.0%
neg-sub098.0%
associate-+l-98.0%
sub0-neg98.0%
distribute-lft-neg-out98.0%
distribute-rgt-neg-in98.0%
Simplified99.9%
Taylor expanded in x around inf 82.2%
if 1.7000000000000001e87 < y < 1.02000000000000002e101Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-/l*100.0%
associate-/r/99.6%
*-commutative99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around 0 75.5%
Final simplification74.7%
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -5e-102)
(* 0.5 (* y (/ x a)))
(if (<= y 1.2e+44)
(/ 1.0 (/ a (* 0.5 (* t (* z -9.0)))))
(if (or (<= y 1.7e+87) (not (<= y 1.02e+101)))
(* 0.5 (/ (* x y) a))
(* -4.5 (/ (* z t) a))))))assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5e-102) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.2e+44) {
tmp = 1.0 / (a / (0.5 * (t * (z * -9.0))));
} else if ((y <= 1.7e+87) || !(y <= 1.02e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-5d-102)) then
tmp = 0.5d0 * (y * (x / a))
else if (y <= 1.2d+44) then
tmp = 1.0d0 / (a / (0.5d0 * (t * (z * (-9.0d0)))))
else if ((y <= 1.7d+87) .or. (.not. (y <= 1.02d+101))) then
tmp = 0.5d0 * ((x * y) / a)
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -5e-102) {
tmp = 0.5 * (y * (x / a));
} else if (y <= 1.2e+44) {
tmp = 1.0 / (a / (0.5 * (t * (z * -9.0))));
} else if ((y <= 1.7e+87) || !(y <= 1.02e+101)) {
tmp = 0.5 * ((x * y) / a);
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -5e-102: tmp = 0.5 * (y * (x / a)) elif y <= 1.2e+44: tmp = 1.0 / (a / (0.5 * (t * (z * -9.0)))) elif (y <= 1.7e+87) or not (y <= 1.02e+101): tmp = 0.5 * ((x * y) / a) else: tmp = -4.5 * ((z * t) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -5e-102) tmp = Float64(0.5 * Float64(y * Float64(x / a))); elseif (y <= 1.2e+44) tmp = Float64(1.0 / Float64(a / Float64(0.5 * Float64(t * Float64(z * -9.0))))); elseif ((y <= 1.7e+87) || !(y <= 1.02e+101)) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -5e-102)
tmp = 0.5 * (y * (x / a));
elseif (y <= 1.2e+44)
tmp = 1.0 / (a / (0.5 * (t * (z * -9.0))));
elseif ((y <= 1.7e+87) || ~((y <= 1.02e+101)))
tmp = 0.5 * ((x * y) / a);
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -5e-102], N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+44], N[(1.0 / N[(a / N[(0.5 * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.7e+87], N[Not[LessEqual[y, 1.02e+101]], $MachinePrecision]], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-102}:\\
\;\;\;\;0.5 \cdot \left(y \cdot \frac{x}{a}\right)\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+44}:\\
\;\;\;\;\frac{1}{\frac{a}{0.5 \cdot \left(t \cdot \left(z \cdot -9\right)\right)}}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{+87} \lor \neg \left(y \leq 1.02 \cdot 10^{+101}\right):\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if y < -5.00000000000000026e-102Initial program 97.6%
sub-neg97.6%
+-commutative97.6%
neg-sub097.6%
associate-+l-97.6%
sub0-neg97.6%
neg-mul-197.6%
associate-/l*97.5%
associate-/r/97.5%
*-commutative97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
distribute-lft-neg-out97.5%
distribute-rgt-neg-in97.5%
Simplified98.6%
associate-*r/98.7%
clear-num98.6%
*-commutative98.6%
Applied egg-rr98.6%
Taylor expanded in x around inf 73.3%
associate-*r/72.1%
Simplified72.1%
if -5.00000000000000026e-102 < y < 1.20000000000000007e44Initial program 97.0%
sub-neg97.0%
+-commutative97.0%
neg-sub097.0%
associate-+l-97.0%
sub0-neg97.0%
neg-mul-197.0%
associate-/l*96.7%
associate-/r/96.9%
*-commutative96.9%
sub-neg96.9%
+-commutative96.9%
neg-sub096.9%
associate-+l-96.9%
sub0-neg96.9%
distribute-lft-neg-out96.9%
distribute-rgt-neg-in96.9%
Simplified96.9%
associate-*r/97.0%
clear-num96.8%
*-commutative96.8%
Applied egg-rr96.8%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
associate-*l*72.9%
Simplified73.0%
if 1.20000000000000007e44 < y < 1.7000000000000001e87 or 1.02000000000000002e101 < y Initial program 98.1%
sub-neg98.1%
+-commutative98.1%
neg-sub098.1%
associate-+l-98.1%
sub0-neg98.1%
neg-mul-198.1%
associate-/l*98.0%
associate-/r/98.0%
*-commutative98.0%
sub-neg98.0%
+-commutative98.0%
neg-sub098.0%
associate-+l-98.0%
sub0-neg98.0%
distribute-lft-neg-out98.0%
distribute-rgt-neg-in98.0%
Simplified99.9%
Taylor expanded in x around inf 82.2%
if 1.7000000000000001e87 < y < 1.02000000000000002e101Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-/l*100.0%
associate-/r/99.6%
*-commutative99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
Simplified99.6%
Taylor expanded in x around 0 75.5%
Final simplification74.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z (* t 9.0))) (* a 2.0)))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * (t * 9.0))) / (a * 2.0);
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - (z * (t * 9.0d0))) / (a * 2.0d0)
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * (t * 9.0))) / (a * 2.0);
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return ((x * y) - (z * (t * 9.0))) / (a * 2.0)
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
end
NOTE: z and t 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[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}
\end{array}
Initial program 97.5%
associate-*l*97.5%
Simplified97.5%
Final simplification97.5%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 5.2e+194) (* -4.5 (* z (/ t a))) (* -4.5 (/ t (/ a z)))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.2e+194) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 5.2d+194) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (-4.5d0) * (t / (a / z))
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 5.2e+194) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * (t / (a / z));
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if t <= 5.2e+194: tmp = -4.5 * (z * (t / a)) else: tmp = -4.5 * (t / (a / z)) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 5.2e+194) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(-4.5 * Float64(t / Float64(a / z))); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 5.2e+194)
tmp = -4.5 * (z * (t / a));
else
tmp = -4.5 * (t / (a / z));
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 5.2e+194], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 5.2 \cdot 10^{+194}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < 5.1999999999999998e194Initial program 97.7%
sub-neg97.7%
+-commutative97.7%
neg-sub097.7%
associate-+l-97.7%
sub0-neg97.7%
neg-mul-197.7%
associate-/l*97.5%
associate-/r/97.6%
*-commutative97.6%
sub-neg97.6%
+-commutative97.6%
neg-sub097.6%
associate-+l-97.6%
sub0-neg97.6%
distribute-lft-neg-out97.6%
distribute-rgt-neg-in97.6%
Simplified98.0%
Taylor expanded in x around 0 47.3%
associate-/l*43.9%
associate-/r/48.2%
Simplified48.2%
if 5.1999999999999998e194 < t Initial program 95.2%
sub-neg95.2%
+-commutative95.2%
neg-sub095.2%
associate-+l-95.2%
sub0-neg95.2%
neg-mul-195.2%
associate-/l*95.0%
associate-/r/94.9%
*-commutative94.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
distribute-lft-neg-out94.9%
distribute-rgt-neg-in94.9%
Simplified99.8%
associate-*r/99.9%
clear-num99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 91.0%
associate-/l*91.0%
Simplified91.0%
Final simplification51.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= t 8e+193) (* -4.5 (* z (/ t a))) (* -4.5 (/ (* z t) a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8e+193) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= 8d+193) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = (-4.5d0) * ((z * t) / a)
end if
code = tmp
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= 8e+193) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = -4.5 * ((z * t) / a);
}
return tmp;
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if t <= 8e+193: tmp = -4.5 * (z * (t / a)) else: tmp = -4.5 * ((z * t) / a) return tmp
z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (t <= 8e+193) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); end return tmp end
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (t <= 8e+193)
tmp = -4.5 * (z * (t / a));
else
tmp = -4.5 * ((z * t) / a);
end
tmp_2 = tmp;
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[t, 8e+193], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+193}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\end{array}
\end{array}
if t < 8.00000000000000053e193Initial program 97.7%
sub-neg97.7%
+-commutative97.7%
neg-sub097.7%
associate-+l-97.7%
sub0-neg97.7%
neg-mul-197.7%
associate-/l*97.5%
associate-/r/97.6%
*-commutative97.6%
sub-neg97.6%
+-commutative97.6%
neg-sub097.6%
associate-+l-97.6%
sub0-neg97.6%
distribute-lft-neg-out97.6%
distribute-rgt-neg-in97.6%
Simplified98.0%
Taylor expanded in x around 0 47.3%
associate-/l*43.9%
associate-/r/48.2%
Simplified48.2%
if 8.00000000000000053e193 < t Initial program 95.2%
sub-neg95.2%
+-commutative95.2%
neg-sub095.2%
associate-+l-95.2%
sub0-neg95.2%
neg-mul-195.2%
associate-/l*95.0%
associate-/r/94.9%
*-commutative94.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
distribute-lft-neg-out94.9%
distribute-rgt-neg-in94.9%
Simplified99.8%
Taylor expanded in x around 0 91.0%
Final simplification51.7%
NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (-4.5d0) * (z * (t / a))
end function
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
[z, t] = sort([z, t]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[z, t] = \mathsf{sort}([z, t])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 97.5%
sub-neg97.5%
+-commutative97.5%
neg-sub097.5%
associate-+l-97.5%
sub0-neg97.5%
neg-mul-197.5%
associate-/l*97.3%
associate-/r/97.4%
*-commutative97.4%
sub-neg97.4%
+-commutative97.4%
neg-sub097.4%
associate-+l-97.4%
sub0-neg97.4%
distribute-lft-neg-out97.4%
distribute-rgt-neg-in97.4%
Simplified98.2%
Taylor expanded in x around 0 50.9%
associate-/l*47.7%
associate-/r/50.6%
Simplified50.6%
Final simplification50.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 2023278
(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)))