
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) - ((z * 9.0d0) * t)) / (a * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
def code(x, y, z, t, a): return ((x * y) - ((z * 9.0) * t)) / (a * 2.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - ((z * 9.0) * t)) / (a * 2.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+294) (* y (/ (* x 0.5) a)) (/ (- (* x y) (* z (* t 9.0))) (* a 2.0))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+294) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-2d+294)) then
tmp = y * ((x * 0.5d0) / a)
else
tmp = ((x * y) - (z * (t * 9.0d0))) / (a * 2.0d0)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+294) {
tmp = y * ((x * 0.5) / a);
} else {
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+294: tmp = y * ((x * 0.5) / a) else: tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+294) tmp = Float64(y * Float64(Float64(x * 0.5) / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * Float64(t * 9.0))) / Float64(a * 2.0)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -2e+294)
tmp = y * ((x * 0.5) / a);
else
tmp = ((x * y) - (z * (t * 9.0))) / (a * 2.0);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+294], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+294}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(t \cdot 9\right)}{a \cdot 2}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000013e294Initial program 69.6%
sub-neg69.6%
+-commutative69.6%
neg-sub069.6%
associate-+l-69.6%
sub0-neg69.6%
neg-mul-169.6%
associate-/l*69.5%
associate-/r/69.6%
*-commutative69.6%
sub-neg69.6%
+-commutative69.6%
neg-sub069.6%
associate-+l-69.6%
sub0-neg69.6%
distribute-lft-neg-out69.6%
distribute-rgt-neg-in69.6%
Simplified69.6%
associate-*r/69.6%
clear-num69.5%
*-commutative69.5%
Applied egg-rr69.5%
Taylor expanded in x around inf 78.7%
associate-*r/78.7%
*-commutative78.7%
associate-*l*78.7%
associate-*r/95.6%
Simplified95.6%
if -2.00000000000000013e294 < (*.f64 x y) Initial program 96.1%
associate-*l*96.1%
Simplified96.1%
Final simplification96.1%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (/ (fma z (* t -9.0) (* x y)) (* a 2.0)))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return fma(z, (t * -9.0), (x * y)) / (a * 2.0);
}
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(fma(z, Float64(t * -9.0), Float64(x * y)) / Float64(a * 2.0)) end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(N[(z * N[(t * -9.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\mathsf{fma}\left(z, t \cdot -9, x \cdot y\right)}{a \cdot 2}
\end{array}
Initial program 93.8%
sub-neg93.8%
+-commutative93.8%
associate-*l*93.9%
distribute-rgt-neg-in93.9%
fma-def94.6%
*-commutative94.6%
distribute-rgt-neg-in94.6%
metadata-eval94.6%
Simplified94.6%
Final simplification94.6%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= (* x y) -5e-114)
(* y (/ (* x 0.5) a))
(if (<= (* x y) 1e-152)
(* -4.5 (/ (* z t) a))
(if (<= (* x y) 5e-43)
(* 0.5 (/ (* x y) a))
(if (<= (* x y) 5000.0)
(/ (* t (* z -4.5)) a)
(* x (* 0.5 (/ y a))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-114) {
tmp = y * ((x * 0.5) / a);
} else if ((x * y) <= 1e-152) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e-43) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5000.0) {
tmp = (t * (z * -4.5)) / a;
} else {
tmp = x * (0.5 * (y / a));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((x * y) <= (-5d-114)) then
tmp = y * ((x * 0.5d0) / a)
else if ((x * y) <= 1d-152) then
tmp = (-4.5d0) * ((z * t) / a)
else if ((x * y) <= 5d-43) then
tmp = 0.5d0 * ((x * y) / a)
else if ((x * y) <= 5000.0d0) then
tmp = (t * (z * (-4.5d0))) / a
else
tmp = x * (0.5d0 * (y / a))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-114) {
tmp = y * ((x * 0.5) / a);
} else if ((x * y) <= 1e-152) {
tmp = -4.5 * ((z * t) / a);
} else if ((x * y) <= 5e-43) {
tmp = 0.5 * ((x * y) / a);
} else if ((x * y) <= 5000.0) {
tmp = (t * (z * -4.5)) / a;
} else {
tmp = x * (0.5 * (y / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-114: tmp = y * ((x * 0.5) / a) elif (x * y) <= 1e-152: tmp = -4.5 * ((z * t) / a) elif (x * y) <= 5e-43: tmp = 0.5 * ((x * y) / a) elif (x * y) <= 5000.0: tmp = (t * (z * -4.5)) / a else: tmp = x * (0.5 * (y / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-114) tmp = Float64(y * Float64(Float64(x * 0.5) / a)); elseif (Float64(x * y) <= 1e-152) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 5e-43) tmp = Float64(0.5 * Float64(Float64(x * y) / a)); elseif (Float64(x * y) <= 5000.0) tmp = Float64(Float64(t * Float64(z * -4.5)) / a); else tmp = Float64(x * Float64(0.5 * Float64(y / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e-114)
tmp = y * ((x * 0.5) / a);
elseif ((x * y) <= 1e-152)
tmp = -4.5 * ((z * t) / a);
elseif ((x * y) <= 5e-43)
tmp = 0.5 * ((x * y) / a);
elseif ((x * y) <= 5000.0)
tmp = (t * (z * -4.5)) / a;
else
tmp = x * (0.5 * (y / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-114], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-152], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-43], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5000.0], N[(N[(t * N[(z * -4.5), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(0.5 * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-114}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-152}:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-43}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5000:\\
\;\;\;\;\frac{t \cdot \left(z \cdot -4.5\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999989e-114Initial program 91.1%
sub-neg91.1%
+-commutative91.1%
neg-sub091.1%
associate-+l-91.1%
sub0-neg91.1%
neg-mul-191.1%
associate-/l*91.1%
associate-/r/91.0%
*-commutative91.0%
sub-neg91.0%
+-commutative91.0%
neg-sub091.0%
associate-+l-91.0%
sub0-neg91.0%
distribute-lft-neg-out91.0%
distribute-rgt-neg-in91.0%
Simplified91.0%
associate-*r/91.1%
clear-num91.1%
*-commutative91.1%
Applied egg-rr91.1%
Taylor expanded in x around inf 75.7%
associate-*r/75.7%
*-commutative75.7%
associate-*l*75.7%
associate-*r/76.9%
Simplified76.9%
if -4.99999999999999989e-114 < (*.f64 x y) < 1.00000000000000007e-152Initial program 97.4%
sub-neg97.4%
+-commutative97.4%
neg-sub097.4%
associate-+l-97.4%
sub0-neg97.4%
neg-mul-197.4%
associate-/l*97.4%
associate-/r/97.2%
*-commutative97.2%
sub-neg97.2%
+-commutative97.2%
neg-sub097.2%
associate-+l-97.2%
sub0-neg97.2%
distribute-lft-neg-out97.2%
distribute-rgt-neg-in97.2%
Simplified97.4%
Taylor expanded in x around 0 90.2%
if 1.00000000000000007e-152 < (*.f64 x y) < 5.00000000000000019e-43Initial program 99.3%
sub-neg99.3%
+-commutative99.3%
neg-sub099.3%
associate-+l-99.3%
sub0-neg99.3%
neg-mul-199.3%
associate-/l*99.3%
associate-/r/99.0%
*-commutative99.0%
sub-neg99.0%
+-commutative99.0%
neg-sub099.0%
associate-+l-99.0%
sub0-neg99.0%
distribute-lft-neg-out99.0%
distribute-rgt-neg-in99.0%
Simplified99.1%
Taylor expanded in x around inf 79.0%
if 5.00000000000000019e-43 < (*.f64 x y) < 5e3Initial program 99.6%
sub-neg99.6%
+-commutative99.6%
neg-sub099.6%
associate-+l-99.6%
sub0-neg99.6%
neg-mul-199.6%
associate-/l*99.6%
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.8%
associate-*r/99.9%
clear-num99.9%
*-commutative99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 70.9%
associate-*r/70.9%
Simplified70.9%
expm1-log1p-u23.1%
expm1-udef22.6%
*-commutative22.6%
Applied egg-rr22.6%
expm1-def23.1%
expm1-log1p70.9%
*-commutative70.9%
associate-*r*71.0%
*-commutative71.0%
associate-*l*70.7%
Simplified70.7%
if 5e3 < (*.f64 x y) Initial program 90.3%
sub-neg90.3%
+-commutative90.3%
neg-sub090.3%
associate-+l-90.3%
sub0-neg90.3%
neg-mul-190.3%
associate-/l*90.2%
associate-/r/90.1%
*-commutative90.1%
sub-neg90.1%
+-commutative90.1%
neg-sub090.1%
associate-+l-90.1%
sub0-neg90.1%
distribute-lft-neg-out90.1%
distribute-rgt-neg-in90.1%
Simplified90.1%
associate-*r/90.3%
clear-num90.2%
*-commutative90.2%
Applied egg-rr90.2%
*-commutative90.2%
metadata-eval90.2%
distribute-lft-neg-in90.2%
distribute-rgt-neg-in90.2%
fma-def90.2%
+-commutative90.2%
distribute-rgt-neg-in90.2%
distribute-lft-neg-in90.2%
metadata-eval90.2%
*-commutative90.2%
Applied egg-rr90.2%
Taylor expanded in z around 0 81.6%
*-commutative81.6%
*-commutative81.6%
associate-*r/84.5%
associate-*l*84.5%
Simplified84.5%
Final simplification82.8%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ (* z t) a))) (t_2 (* 0.5 (/ (* x y) a))))
(if (<= y -6.8e-153)
t_2
(if (<= y 1.8e-134)
t_1
(if (<= y 5.2e-120)
t_2
(if (<= y 0.0105)
t_1
(if (or (<= y 9.8e+73) (not (<= y 1.35e+102)))
t_2
(* -4.5 (* z (/ t a))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * ((x * y) / a);
double tmp;
if (y <= -6.8e-153) {
tmp = t_2;
} else if (y <= 1.8e-134) {
tmp = t_1;
} else if (y <= 5.2e-120) {
tmp = t_2;
} else if (y <= 0.0105) {
tmp = t_1;
} else if ((y <= 9.8e+73) || !(y <= 1.35e+102)) {
tmp = t_2;
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = 0.5d0 * ((x * y) / a)
if (y <= (-6.8d-153)) then
tmp = t_2
else if (y <= 1.8d-134) then
tmp = t_1
else if (y <= 5.2d-120) then
tmp = t_2
else if (y <= 0.0105d0) then
tmp = t_1
else if ((y <= 9.8d+73) .or. (.not. (y <= 1.35d+102))) then
tmp = t_2
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = 0.5 * ((x * y) / a);
double tmp;
if (y <= -6.8e-153) {
tmp = t_2;
} else if (y <= 1.8e-134) {
tmp = t_1;
} else if (y <= 5.2e-120) {
tmp = t_2;
} else if (y <= 0.0105) {
tmp = t_1;
} else if ((y <= 9.8e+73) || !(y <= 1.35e+102)) {
tmp = t_2;
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = 0.5 * ((x * y) / a) tmp = 0 if y <= -6.8e-153: tmp = t_2 elif y <= 1.8e-134: tmp = t_1 elif y <= 5.2e-120: tmp = t_2 elif y <= 0.0105: tmp = t_1 elif (y <= 9.8e+73) or not (y <= 1.35e+102): tmp = t_2 else: tmp = -4.5 * (z * (t / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(0.5 * Float64(Float64(x * y) / a)) tmp = 0.0 if (y <= -6.8e-153) tmp = t_2; elseif (y <= 1.8e-134) tmp = t_1; elseif (y <= 5.2e-120) tmp = t_2; elseif (y <= 0.0105) tmp = t_1; elseif ((y <= 9.8e+73) || !(y <= 1.35e+102)) tmp = t_2; else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = 0.5 * ((x * y) / a);
tmp = 0.0;
if (y <= -6.8e-153)
tmp = t_2;
elseif (y <= 1.8e-134)
tmp = t_1;
elseif (y <= 5.2e-120)
tmp = t_2;
elseif (y <= 0.0105)
tmp = t_1;
elseif ((y <= 9.8e+73) || ~((y <= 1.35e+102)))
tmp = t_2;
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.8e-153], t$95$2, If[LessEqual[y, 1.8e-134], t$95$1, If[LessEqual[y, 5.2e-120], t$95$2, If[LessEqual[y, 0.0105], t$95$1, If[Or[LessEqual[y, 9.8e+73], N[Not[LessEqual[y, 1.35e+102]], $MachinePrecision]], t$95$2, N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := 0.5 \cdot \frac{x \cdot y}{a}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{-153}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 0.0105:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+73} \lor \neg \left(y \leq 1.35 \cdot 10^{+102}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if y < -6.7999999999999997e-153 or 1.79999999999999995e-134 < y < 5.2000000000000002e-120 or 0.0105000000000000007 < y < 9.7999999999999998e73 or 1.3500000000000001e102 < y Initial program 92.6%
sub-neg92.6%
+-commutative92.6%
neg-sub092.6%
associate-+l-92.6%
sub0-neg92.6%
neg-mul-192.6%
associate-/l*92.6%
associate-/r/92.5%
*-commutative92.5%
sub-neg92.5%
+-commutative92.5%
neg-sub092.5%
associate-+l-92.5%
sub0-neg92.5%
distribute-lft-neg-out92.5%
distribute-rgt-neg-in92.5%
Simplified92.5%
Taylor expanded in x around inf 67.4%
if -6.7999999999999997e-153 < y < 1.79999999999999995e-134 or 5.2000000000000002e-120 < y < 0.0105000000000000007Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
neg-sub097.3%
associate-+l-97.3%
sub0-neg97.3%
neg-mul-197.3%
associate-/l*97.2%
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.1%
Taylor expanded in x around 0 73.1%
if 9.7999999999999998e73 < y < 1.3500000000000001e102Initial program 80.8%
sub-neg80.8%
+-commutative80.8%
neg-sub080.8%
associate-+l-80.8%
sub0-neg80.8%
neg-mul-180.8%
associate-/l*80.5%
associate-/r/80.5%
*-commutative80.5%
sub-neg80.5%
+-commutative80.5%
neg-sub080.5%
associate-+l-80.5%
sub0-neg80.5%
distribute-lft-neg-out80.5%
distribute-rgt-neg-in80.5%
Simplified81.1%
Taylor expanded in x around 0 61.4%
associate-/l*80.3%
associate-/r/80.3%
Simplified80.3%
Final simplification69.4%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ (* z t) a))) (t_2 (* x (* 0.5 (/ y a)))))
(if (<= y -7e-153)
t_2
(if (<= y 1.8e-134)
t_1
(if (<= y 5.2e-120)
t_2
(if (<= y 0.0006)
t_1
(if (<= y 9.8e+73)
t_2
(if (<= y 4.5e+101)
(* -4.5 (* z (/ t a)))
(* 0.5 (/ (* x y) a))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = x * (0.5 * (y / a));
double tmp;
if (y <= -7e-153) {
tmp = t_2;
} else if (y <= 1.8e-134) {
tmp = t_1;
} else if (y <= 5.2e-120) {
tmp = t_2;
} else if (y <= 0.0006) {
tmp = t_1;
} else if (y <= 9.8e+73) {
tmp = t_2;
} else if (y <= 4.5e+101) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = x * (0.5d0 * (y / a))
if (y <= (-7d-153)) then
tmp = t_2
else if (y <= 1.8d-134) then
tmp = t_1
else if (y <= 5.2d-120) then
tmp = t_2
else if (y <= 0.0006d0) then
tmp = t_1
else if (y <= 9.8d+73) then
tmp = t_2
else if (y <= 4.5d+101) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = x * (0.5 * (y / a));
double tmp;
if (y <= -7e-153) {
tmp = t_2;
} else if (y <= 1.8e-134) {
tmp = t_1;
} else if (y <= 5.2e-120) {
tmp = t_2;
} else if (y <= 0.0006) {
tmp = t_1;
} else if (y <= 9.8e+73) {
tmp = t_2;
} else if (y <= 4.5e+101) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = x * (0.5 * (y / a)) tmp = 0 if y <= -7e-153: tmp = t_2 elif y <= 1.8e-134: tmp = t_1 elif y <= 5.2e-120: tmp = t_2 elif y <= 0.0006: tmp = t_1 elif y <= 9.8e+73: tmp = t_2 elif y <= 4.5e+101: tmp = -4.5 * (z * (t / a)) else: tmp = 0.5 * ((x * y) / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(x * Float64(0.5 * Float64(y / a))) tmp = 0.0 if (y <= -7e-153) tmp = t_2; elseif (y <= 1.8e-134) tmp = t_1; elseif (y <= 5.2e-120) tmp = t_2; elseif (y <= 0.0006) tmp = t_1; elseif (y <= 9.8e+73) tmp = t_2; elseif (y <= 4.5e+101) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = x * (0.5 * (y / a));
tmp = 0.0;
if (y <= -7e-153)
tmp = t_2;
elseif (y <= 1.8e-134)
tmp = t_1;
elseif (y <= 5.2e-120)
tmp = t_2;
elseif (y <= 0.0006)
tmp = t_1;
elseif (y <= 9.8e+73)
tmp = t_2;
elseif (y <= 4.5e+101)
tmp = -4.5 * (z * (t / a));
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(0.5 * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e-153], t$95$2, If[LessEqual[y, 1.8e-134], t$95$1, If[LessEqual[y, 5.2e-120], t$95$2, If[LessEqual[y, 0.0006], t$95$1, If[LessEqual[y, 9.8e+73], t$95$2, If[LessEqual[y, 4.5e+101], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -7 \cdot 10^{-153}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 0.0006:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+73}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+101}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if y < -6.99999999999999961e-153 or 1.79999999999999995e-134 < y < 5.2000000000000002e-120 or 5.99999999999999947e-4 < y < 9.7999999999999998e73Initial program 93.8%
sub-neg93.8%
+-commutative93.8%
neg-sub093.8%
associate-+l-93.8%
sub0-neg93.8%
neg-mul-193.8%
associate-/l*93.8%
associate-/r/93.7%
*-commutative93.7%
sub-neg93.7%
+-commutative93.7%
neg-sub093.7%
associate-+l-93.7%
sub0-neg93.7%
distribute-lft-neg-out93.7%
distribute-rgt-neg-in93.7%
Simplified93.7%
associate-*r/93.8%
clear-num93.8%
*-commutative93.8%
Applied egg-rr93.8%
*-commutative93.8%
metadata-eval93.8%
distribute-lft-neg-in93.8%
distribute-rgt-neg-in93.8%
fma-def93.8%
+-commutative93.8%
distribute-rgt-neg-in93.8%
distribute-lft-neg-in93.8%
metadata-eval93.8%
*-commutative93.8%
Applied egg-rr93.8%
Taylor expanded in z around 0 67.1%
*-commutative67.1%
*-commutative67.1%
associate-*r/67.7%
associate-*l*67.7%
Simplified67.7%
if -6.99999999999999961e-153 < y < 1.79999999999999995e-134 or 5.2000000000000002e-120 < y < 5.99999999999999947e-4Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
neg-sub097.3%
associate-+l-97.3%
sub0-neg97.3%
neg-mul-197.3%
associate-/l*97.2%
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.1%
Taylor expanded in x around 0 72.7%
if 9.7999999999999998e73 < y < 4.5000000000000002e101Initial program 80.8%
sub-neg80.8%
+-commutative80.8%
neg-sub080.8%
associate-+l-80.8%
sub0-neg80.8%
neg-mul-180.8%
associate-/l*80.5%
associate-/r/80.5%
*-commutative80.5%
sub-neg80.5%
+-commutative80.5%
neg-sub080.5%
associate-+l-80.5%
sub0-neg80.5%
distribute-lft-neg-out80.5%
distribute-rgt-neg-in80.5%
Simplified81.1%
Taylor expanded in x around 0 61.4%
associate-/l*80.3%
associate-/r/80.3%
Simplified80.3%
if 4.5000000000000002e101 < y Initial program 89.3%
sub-neg89.3%
+-commutative89.3%
neg-sub089.3%
associate-+l-89.3%
sub0-neg89.3%
neg-mul-189.3%
associate-/l*89.3%
associate-/r/89.2%
*-commutative89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
distribute-lft-neg-out89.2%
distribute-rgt-neg-in89.2%
Simplified89.3%
Taylor expanded in x around inf 66.7%
Final simplification69.3%
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* -4.5 (/ (* z t) a))) (t_2 (* x (* 0.5 (/ y a)))))
(if (<= y -7e-153)
t_2
(if (<= y 1e-134)
t_1
(if (<= y 3.8e-120)
t_2
(if (<= y 6.2e-12)
t_1
(if (<= y 1.02e+74)
(* y (/ (* x 0.5) a))
(if (<= y 4.5e+101)
(* -4.5 (* z (/ t a)))
(* 0.5 (/ (* x y) a))))))))))assert(x < y);
double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = x * (0.5 * (y / a));
double tmp;
if (y <= -7e-153) {
tmp = t_2;
} else if (y <= 1e-134) {
tmp = t_1;
} else if (y <= 3.8e-120) {
tmp = t_2;
} else if (y <= 6.2e-12) {
tmp = t_1;
} else if (y <= 1.02e+74) {
tmp = y * ((x * 0.5) / a);
} else if (y <= 4.5e+101) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (-4.5d0) * ((z * t) / a)
t_2 = x * (0.5d0 * (y / a))
if (y <= (-7d-153)) then
tmp = t_2
else if (y <= 1d-134) then
tmp = t_1
else if (y <= 3.8d-120) then
tmp = t_2
else if (y <= 6.2d-12) then
tmp = t_1
else if (y <= 1.02d+74) then
tmp = y * ((x * 0.5d0) / a)
else if (y <= 4.5d+101) then
tmp = (-4.5d0) * (z * (t / a))
else
tmp = 0.5d0 * ((x * y) / a)
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -4.5 * ((z * t) / a);
double t_2 = x * (0.5 * (y / a));
double tmp;
if (y <= -7e-153) {
tmp = t_2;
} else if (y <= 1e-134) {
tmp = t_1;
} else if (y <= 3.8e-120) {
tmp = t_2;
} else if (y <= 6.2e-12) {
tmp = t_1;
} else if (y <= 1.02e+74) {
tmp = y * ((x * 0.5) / a);
} else if (y <= 4.5e+101) {
tmp = -4.5 * (z * (t / a));
} else {
tmp = 0.5 * ((x * y) / a);
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): t_1 = -4.5 * ((z * t) / a) t_2 = x * (0.5 * (y / a)) tmp = 0 if y <= -7e-153: tmp = t_2 elif y <= 1e-134: tmp = t_1 elif y <= 3.8e-120: tmp = t_2 elif y <= 6.2e-12: tmp = t_1 elif y <= 1.02e+74: tmp = y * ((x * 0.5) / a) elif y <= 4.5e+101: tmp = -4.5 * (z * (t / a)) else: tmp = 0.5 * ((x * y) / a) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) t_1 = Float64(-4.5 * Float64(Float64(z * t) / a)) t_2 = Float64(x * Float64(0.5 * Float64(y / a))) tmp = 0.0 if (y <= -7e-153) tmp = t_2; elseif (y <= 1e-134) tmp = t_1; elseif (y <= 3.8e-120) tmp = t_2; elseif (y <= 6.2e-12) tmp = t_1; elseif (y <= 1.02e+74) tmp = Float64(y * Float64(Float64(x * 0.5) / a)); elseif (y <= 4.5e+101) tmp = Float64(-4.5 * Float64(z * Float64(t / a))); else tmp = Float64(0.5 * Float64(Float64(x * y) / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = -4.5 * ((z * t) / a);
t_2 = x * (0.5 * (y / a));
tmp = 0.0;
if (y <= -7e-153)
tmp = t_2;
elseif (y <= 1e-134)
tmp = t_1;
elseif (y <= 3.8e-120)
tmp = t_2;
elseif (y <= 6.2e-12)
tmp = t_1;
elseif (y <= 1.02e+74)
tmp = y * ((x * 0.5) / a);
elseif (y <= 4.5e+101)
tmp = -4.5 * (z * (t / a));
else
tmp = 0.5 * ((x * y) / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(0.5 * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7e-153], t$95$2, If[LessEqual[y, 1e-134], t$95$1, If[LessEqual[y, 3.8e-120], t$95$2, If[LessEqual[y, 6.2e-12], t$95$1, If[LessEqual[y, 1.02e+74], N[(y * N[(N[(x * 0.5), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+101], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_1 := -4.5 \cdot \frac{z \cdot t}{a}\\
t_2 := x \cdot \left(0.5 \cdot \frac{y}{a}\right)\\
\mathbf{if}\;y \leq -7 \cdot 10^{-153}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 10^{-134}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-120}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq 6.2 \cdot 10^{-12}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{+74}:\\
\;\;\;\;y \cdot \frac{x \cdot 0.5}{a}\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+101}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a}\\
\end{array}
\end{array}
if y < -6.99999999999999961e-153 or 1.00000000000000004e-134 < y < 3.7999999999999997e-120Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
neg-sub093.4%
associate-+l-93.4%
sub0-neg93.4%
neg-mul-193.4%
associate-/l*93.4%
associate-/r/93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
neg-sub093.3%
associate-+l-93.3%
sub0-neg93.3%
distribute-lft-neg-out93.3%
distribute-rgt-neg-in93.3%
Simplified93.3%
associate-*r/93.4%
clear-num93.3%
*-commutative93.3%
Applied egg-rr93.3%
*-commutative93.3%
metadata-eval93.3%
distribute-lft-neg-in93.3%
distribute-rgt-neg-in93.3%
fma-def93.3%
+-commutative93.3%
distribute-rgt-neg-in93.3%
distribute-lft-neg-in93.3%
metadata-eval93.3%
*-commutative93.3%
Applied egg-rr93.3%
Taylor expanded in z around 0 63.9%
*-commutative63.9%
*-commutative63.9%
associate-*r/64.7%
associate-*l*64.7%
Simplified64.7%
if -6.99999999999999961e-153 < y < 1.00000000000000004e-134 or 3.7999999999999997e-120 < y < 6.2000000000000002e-12Initial program 97.3%
sub-neg97.3%
+-commutative97.3%
neg-sub097.3%
associate-+l-97.3%
sub0-neg97.3%
neg-mul-197.3%
associate-/l*97.2%
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.1%
Taylor expanded in x around 0 72.7%
if 6.2000000000000002e-12 < y < 1.02000000000000005e74Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
neg-sub095.6%
associate-+l-95.6%
sub0-neg95.6%
neg-mul-195.6%
associate-/l*95.7%
associate-/r/95.4%
*-commutative95.4%
sub-neg95.4%
+-commutative95.4%
neg-sub095.4%
associate-+l-95.4%
sub0-neg95.4%
distribute-lft-neg-out95.4%
distribute-rgt-neg-in95.4%
Simplified95.4%
associate-*r/95.6%
clear-num95.7%
*-commutative95.7%
Applied egg-rr95.7%
Taylor expanded in x around inf 80.8%
associate-*r/80.8%
*-commutative80.8%
associate-*l*80.8%
associate-*r/84.9%
Simplified84.9%
if 1.02000000000000005e74 < y < 4.5000000000000002e101Initial program 80.8%
sub-neg80.8%
+-commutative80.8%
neg-sub080.8%
associate-+l-80.8%
sub0-neg80.8%
neg-mul-180.8%
associate-/l*80.5%
associate-/r/80.5%
*-commutative80.5%
sub-neg80.5%
+-commutative80.5%
neg-sub080.5%
associate-+l-80.5%
sub0-neg80.5%
distribute-lft-neg-out80.5%
distribute-rgt-neg-in80.5%
Simplified81.1%
Taylor expanded in x around 0 61.4%
associate-/l*80.3%
associate-/r/80.3%
Simplified80.3%
if 4.5000000000000002e101 < y Initial program 89.3%
sub-neg89.3%
+-commutative89.3%
neg-sub089.3%
associate-+l-89.3%
sub0-neg89.3%
neg-mul-189.3%
associate-/l*89.3%
associate-/r/89.2%
*-commutative89.2%
sub-neg89.2%
+-commutative89.2%
neg-sub089.2%
associate-+l-89.2%
sub0-neg89.2%
distribute-lft-neg-out89.2%
distribute-rgt-neg-in89.2%
Simplified89.3%
Taylor expanded in x around inf 66.7%
Final simplification69.7%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= y 950.0) (* -4.5 (/ (* z t) a)) (* -4.5 (* z (/ t a)))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 950.0) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= 950.0d0) then
tmp = (-4.5d0) * ((z * t) / a)
else
tmp = (-4.5d0) * (z * (t / a))
end if
code = tmp
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 950.0) {
tmp = -4.5 * ((z * t) / a);
} else {
tmp = -4.5 * (z * (t / a));
}
return tmp;
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): tmp = 0 if y <= 950.0: tmp = -4.5 * ((z * t) / a) else: tmp = -4.5 * (z * (t / a)) return tmp
x, y = sort([x, y]) function code(x, y, z, t, a) tmp = 0.0 if (y <= 950.0) tmp = Float64(-4.5 * Float64(Float64(z * t) / a)); else tmp = Float64(-4.5 * Float64(z * Float64(t / a))); end return tmp end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= 950.0)
tmp = -4.5 * ((z * t) / a);
else
tmp = -4.5 * (z * (t / a));
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, 950.0], N[(-4.5 * N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 950:\\
\;\;\;\;-4.5 \cdot \frac{z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;-4.5 \cdot \left(z \cdot \frac{t}{a}\right)\\
\end{array}
\end{array}
if y < 950Initial program 95.1%
sub-neg95.1%
+-commutative95.1%
neg-sub095.1%
associate-+l-95.1%
sub0-neg95.1%
neg-mul-195.1%
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%
Simplified95.0%
Taylor expanded in x around 0 56.2%
if 950 < y Initial program 90.6%
sub-neg90.6%
+-commutative90.6%
neg-sub090.6%
associate-+l-90.6%
sub0-neg90.6%
neg-mul-190.6%
associate-/l*90.5%
associate-/r/90.4%
*-commutative90.4%
sub-neg90.4%
+-commutative90.4%
neg-sub090.4%
associate-+l-90.4%
sub0-neg90.4%
distribute-lft-neg-out90.4%
distribute-rgt-neg-in90.4%
Simplified90.5%
Taylor expanded in x around 0 30.7%
associate-/l*33.2%
associate-/r/32.1%
Simplified32.1%
Final simplification49.4%
NOTE: x and y should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* -4.5 (* z (/ t a))))
assert(x < y);
double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (-4.5d0) * (z * (t / a))
end function
assert x < y;
public static double code(double x, double y, double z, double t, double a) {
return -4.5 * (z * (t / a));
}
[x, y] = sort([x, y]) def code(x, y, z, t, a): return -4.5 * (z * (t / a))
x, y = sort([x, y]) function code(x, y, z, t, a) return Float64(-4.5 * Float64(z * Float64(t / a))) end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y, z, t, a)
tmp = -4.5 * (z * (t / a));
end
NOTE: x and y should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(-4.5 * N[(z * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-4.5 \cdot \left(z \cdot \frac{t}{a}\right)
\end{array}
Initial program 93.8%
sub-neg93.8%
+-commutative93.8%
neg-sub093.8%
associate-+l-93.8%
sub0-neg93.8%
neg-mul-193.8%
associate-/l*93.8%
associate-/r/93.6%
*-commutative93.6%
sub-neg93.6%
+-commutative93.6%
neg-sub093.6%
associate-+l-93.6%
sub0-neg93.6%
distribute-lft-neg-out93.6%
distribute-rgt-neg-in93.6%
Simplified93.7%
Taylor expanded in x around 0 49.1%
associate-/l*48.5%
associate-/r/48.5%
Simplified48.5%
Final simplification48.5%
(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 2023195
(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)))