
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.4e+19)
(* 0.5 (/ (fma x x (- (* y_m y_m) (* z z))) y_m))
(if (<= y_m 9.5e+153)
(*
y_m
(+
(+ 0.5 (/ (pow x 2.0) (* 2.0 (pow y_m 2.0))))
(* (pow (/ z y_m) 2.0) -0.5)))
(* 0.5 (* (hypot y_m x) (/ (hypot y_m x) y_m)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.4e+19) {
tmp = 0.5 * (fma(x, x, ((y_m * y_m) - (z * z))) / y_m);
} else if (y_m <= 9.5e+153) {
tmp = y_m * ((0.5 + (pow(x, 2.0) / (2.0 * pow(y_m, 2.0)))) + (pow((z / y_m), 2.0) * -0.5));
} else {
tmp = 0.5 * (hypot(y_m, x) * (hypot(y_m, x) / y_m));
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.4e+19) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m * y_m) - Float64(z * z))) / y_m)); elseif (y_m <= 9.5e+153) tmp = Float64(y_m * Float64(Float64(0.5 + Float64((x ^ 2.0) / Float64(2.0 * (y_m ^ 2.0)))) + Float64((Float64(z / y_m) ^ 2.0) * -0.5))); else tmp = Float64(0.5 * Float64(hypot(y_m, x) * Float64(hypot(y_m, x) / y_m))); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.4e+19], N[(0.5 * N[(N[(x * x + N[(N[(y$95$m * y$95$m), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 9.5e+153], N[(y$95$m * N[(N[(0.5 + N[(N[Power[x, 2.0], $MachinePrecision] / N[(2.0 * N[Power[y$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(z / y$95$m), $MachinePrecision], 2.0], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[y$95$m ^ 2 + x ^ 2], $MachinePrecision] * N[(N[Sqrt[y$95$m ^ 2 + x ^ 2], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.4 \cdot 10^{+19}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m - z \cdot z\right)}{y\_m}\\
\mathbf{elif}\;y\_m \leq 9.5 \cdot 10^{+153}:\\
\;\;\;\;y\_m \cdot \left(\left(0.5 + \frac{{x}^{2}}{2 \cdot {y\_m}^{2}}\right) + {\left(\frac{z}{y\_m}\right)}^{2} \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\mathsf{hypot}\left(y\_m, x\right) \cdot \frac{\mathsf{hypot}\left(y\_m, x\right)}{y\_m}\right)\\
\end{array}
\end{array}
if y < 1.4e19Initial program 77.8%
remove-double-neg77.8%
distribute-lft-neg-out77.8%
distribute-frac-neg277.8%
distribute-frac-neg77.8%
neg-mul-177.8%
distribute-lft-neg-out77.8%
*-commutative77.8%
distribute-lft-neg-in77.8%
times-frac77.8%
metadata-eval77.8%
metadata-eval77.8%
associate--l+77.8%
fma-define79.9%
Simplified79.9%
if 1.4e19 < y < 9.4999999999999995e153Initial program 85.9%
add-sqr-sqrt85.5%
pow285.5%
Applied egg-rr85.5%
Taylor expanded in y around inf 84.8%
sub-neg84.8%
+-commutative84.8%
*-commutative84.8%
unpow284.8%
rem-square-sqrt84.8%
unpow284.8%
rem-square-sqrt86.0%
metadata-eval86.0%
associate-/r*86.0%
unpow286.0%
rem-square-sqrt86.1%
distribute-neg-frac286.1%
metadata-eval86.1%
rem-square-sqrt0.0%
Simplified99.8%
if 9.4999999999999995e153 < y Initial program 14.0%
remove-double-neg14.0%
distribute-lft-neg-out14.0%
distribute-frac-neg214.0%
distribute-frac-neg14.0%
neg-mul-114.0%
distribute-lft-neg-out14.0%
*-commutative14.0%
distribute-lft-neg-in14.0%
times-frac14.0%
metadata-eval14.0%
metadata-eval14.0%
associate--l+14.0%
fma-define14.0%
Simplified14.0%
Taylor expanded in z around 0 14.9%
rem-square-sqrt14.9%
unpow214.9%
unpow214.9%
hypot-undefine14.9%
unpow214.9%
unpow214.9%
hypot-undefine14.9%
unpow214.9%
hypot-undefine14.9%
unpow214.9%
unpow214.9%
+-commutative14.9%
unpow214.9%
unpow214.9%
hypot-define14.9%
Simplified14.9%
hypot-undefine14.9%
+-commutative14.9%
hypot-undefine14.9%
unpow214.9%
*-un-lft-identity14.9%
times-frac88.1%
hypot-undefine14.9%
+-commutative14.9%
hypot-undefine88.1%
hypot-undefine14.9%
+-commutative14.9%
hypot-undefine88.1%
Applied egg-rr88.1%
Final simplification83.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0)) -5e-74)
(/ 0.5 (* (/ y_m z) (/ -1.0 z)))
(* 0.5 (* (hypot y_m x) (/ (hypot y_m x) y_m))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0)) <= -5e-74) {
tmp = 0.5 / ((y_m / z) * (-1.0 / z));
} else {
tmp = 0.5 * (hypot(y_m, x) * (hypot(y_m, x) / y_m));
}
return y_s * tmp;
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0)) <= -5e-74) {
tmp = 0.5 / ((y_m / z) * (-1.0 / z));
} else {
tmp = 0.5 * (Math.hypot(y_m, x) * (Math.hypot(y_m, x) / y_m));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if ((((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0)) <= -5e-74: tmp = 0.5 / ((y_m / z) * (-1.0 / z)) else: tmp = 0.5 * (math.hypot(y_m, x) * (math.hypot(y_m, x) / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e-74) tmp = Float64(0.5 / Float64(Float64(y_m / z) * Float64(-1.0 / z))); else tmp = Float64(0.5 * Float64(hypot(y_m, x) * Float64(hypot(y_m, x) / y_m))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (((((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0)) <= -5e-74) tmp = 0.5 / ((y_m / z) * (-1.0 / z)); else tmp = 0.5 * (hypot(y_m, x) * (hypot(y_m, x) / y_m)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e-74], N[(0.5 / N[(N[(y$95$m / z), $MachinePrecision] * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sqrt[y$95$m ^ 2 + x ^ 2], $MachinePrecision] * N[(N[Sqrt[y$95$m ^ 2 + x ^ 2], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2} \leq -5 \cdot 10^{-74}:\\
\;\;\;\;\frac{0.5}{\frac{y\_m}{z} \cdot \frac{-1}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\mathsf{hypot}\left(y\_m, x\right) \cdot \frac{\mathsf{hypot}\left(y\_m, x\right)}{y\_m}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < -4.99999999999999998e-74Initial program 75.7%
remove-double-neg75.7%
distribute-lft-neg-out75.7%
distribute-frac-neg275.7%
distribute-frac-neg75.7%
neg-mul-175.7%
distribute-lft-neg-out75.7%
*-commutative75.7%
distribute-lft-neg-in75.7%
times-frac75.7%
metadata-eval75.7%
metadata-eval75.7%
associate--l+75.7%
fma-define75.7%
Simplified75.7%
clear-num75.5%
un-div-inv75.5%
fma-undefine75.5%
associate--l+75.5%
add-sqr-sqrt75.6%
pow275.6%
hypot-define75.6%
pow275.6%
Applied egg-rr75.6%
Applied egg-rr73.1%
Taylor expanded in z around -inf 17.4%
associate-*r/17.4%
neg-mul-117.4%
Simplified17.4%
Taylor expanded in z around inf 27.7%
if -4.99999999999999998e-74 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 65.7%
remove-double-neg65.7%
distribute-lft-neg-out65.7%
distribute-frac-neg265.7%
distribute-frac-neg65.7%
neg-mul-165.7%
distribute-lft-neg-out65.7%
*-commutative65.7%
distribute-lft-neg-in65.7%
times-frac65.7%
metadata-eval65.7%
metadata-eval65.7%
associate--l+65.7%
fma-define68.6%
Simplified68.6%
Taylor expanded in z around 0 43.7%
rem-square-sqrt43.8%
unpow243.8%
unpow243.8%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
hypot-undefine43.8%
unpow243.8%
hypot-undefine43.8%
unpow243.8%
unpow243.8%
+-commutative43.8%
unpow243.8%
unpow243.8%
hypot-define43.8%
Simplified43.8%
hypot-undefine43.8%
+-commutative43.8%
hypot-undefine43.8%
unpow243.8%
*-un-lft-identity43.8%
times-frac64.8%
hypot-undefine43.8%
+-commutative43.8%
hypot-undefine64.8%
hypot-undefine43.8%
+-commutative43.8%
hypot-undefine64.8%
Applied egg-rr64.8%
Final simplification48.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (or (<= t_0 -5e-74) (not (<= t_0 INFINITY)))
(/ 0.5 (* (/ y_m z) (/ -1.0 z)))
(* 0.5 (+ y_m (/ (pow x 2.0) y_m)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
double tmp;
if ((t_0 <= -5e-74) || !(t_0 <= ((double) INFINITY))) {
tmp = 0.5 / ((y_m / z) * (-1.0 / z));
} else {
tmp = 0.5 * (y_m + (pow(x, 2.0) / y_m));
}
return y_s * tmp;
}
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
double tmp;
if ((t_0 <= -5e-74) || !(t_0 <= Double.POSITIVE_INFINITY)) {
tmp = 0.5 / ((y_m / z) * (-1.0 / z));
} else {
tmp = 0.5 * (y_m + (Math.pow(x, 2.0) / y_m));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0) tmp = 0 if (t_0 <= -5e-74) or not (t_0 <= math.inf): tmp = 0.5 / ((y_m / z) * (-1.0 / z)) else: tmp = 0.5 * (y_m + (math.pow(x, 2.0) / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if ((t_0 <= -5e-74) || !(t_0 <= Inf)) tmp = Float64(0.5 / Float64(Float64(y_m / z) * Float64(-1.0 / z))); else tmp = Float64(0.5 * Float64(y_m + Float64((x ^ 2.0) / y_m))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if ((t_0 <= -5e-74) || ~((t_0 <= Inf))) tmp = 0.5 / ((y_m / z) * (-1.0 / z)); else tmp = 0.5 * (y_m + ((x ^ 2.0) / y_m)); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[Or[LessEqual[t$95$0, -5e-74], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(0.5 / N[(N[(y$95$m / z), $MachinePrecision] * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(y$95$m + N[(N[Power[x, 2.0], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-74} \lor \neg \left(t\_0 \leq \infty\right):\\
\;\;\;\;\frac{0.5}{\frac{y\_m}{z} \cdot \frac{-1}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(y\_m + \frac{{x}^{2}}{y\_m}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < -4.99999999999999998e-74 or +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 63.2%
remove-double-neg63.2%
distribute-lft-neg-out63.2%
distribute-frac-neg263.2%
distribute-frac-neg63.2%
neg-mul-163.2%
distribute-lft-neg-out63.2%
*-commutative63.2%
distribute-lft-neg-in63.2%
times-frac63.2%
metadata-eval63.2%
metadata-eval63.2%
associate--l+63.2%
fma-define66.1%
Simplified66.1%
clear-num66.0%
un-div-inv66.0%
fma-undefine63.0%
associate--l+63.0%
add-sqr-sqrt63.0%
pow263.0%
hypot-define63.0%
pow263.0%
Applied egg-rr63.0%
Applied egg-rr68.2%
Taylor expanded in z around -inf 18.5%
associate-*r/18.5%
neg-mul-118.5%
Simplified18.5%
Taylor expanded in z around inf 32.1%
if -4.99999999999999998e-74 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0Initial program 78.6%
remove-double-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg278.6%
distribute-frac-neg78.6%
neg-mul-178.6%
distribute-lft-neg-out78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
associate--l+78.6%
fma-define78.6%
Simplified78.6%
Taylor expanded in z around 0 50.8%
rem-square-sqrt50.9%
unpow250.9%
unpow250.9%
hypot-undefine50.9%
unpow250.9%
unpow250.9%
hypot-undefine50.9%
unpow250.9%
hypot-undefine50.9%
unpow250.9%
unpow250.9%
+-commutative50.9%
unpow250.9%
unpow250.9%
hypot-define50.9%
Simplified50.9%
Taylor expanded in x around 0 63.5%
Final simplification46.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.3e+157)
(* 0.5 (/ (fma x x (- (* y_m y_m) (* z z))) y_m))
(/ 0.5 (/ (+ 1.0 (* (/ z y_m) -2.0)) y_m)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.3e+157) {
tmp = 0.5 * (fma(x, x, ((y_m * y_m) - (z * z))) / y_m);
} else {
tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m);
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.3e+157) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m * y_m) - Float64(z * z))) / y_m)); else tmp = Float64(0.5 / Float64(Float64(1.0 + Float64(Float64(z / y_m) * -2.0)) / y_m)); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.3e+157], N[(0.5 * N[(N[(x * x + N[(N[(y$95$m * y$95$m), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(1.0 + N[(N[(z / y$95$m), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.3 \cdot 10^{+157}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m - z \cdot z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{1 + \frac{z}{y\_m} \cdot -2}{y\_m}}\\
\end{array}
\end{array}
if y < 1.30000000000000005e157Initial program 78.9%
remove-double-neg78.9%
distribute-lft-neg-out78.9%
distribute-frac-neg278.9%
distribute-frac-neg78.9%
neg-mul-178.9%
distribute-lft-neg-out78.9%
*-commutative78.9%
distribute-lft-neg-in78.9%
times-frac78.9%
metadata-eval78.9%
metadata-eval78.9%
associate--l+78.9%
fma-define80.8%
Simplified80.8%
if 1.30000000000000005e157 < y Initial program 11.4%
remove-double-neg11.4%
distribute-lft-neg-out11.4%
distribute-frac-neg211.4%
distribute-frac-neg11.4%
neg-mul-111.4%
distribute-lft-neg-out11.4%
*-commutative11.4%
distribute-lft-neg-in11.4%
times-frac11.4%
metadata-eval11.4%
metadata-eval11.4%
associate--l+11.4%
fma-define11.4%
Simplified11.4%
clear-num11.4%
un-div-inv11.4%
fma-undefine11.4%
associate--l+11.4%
add-sqr-sqrt11.4%
pow211.4%
hypot-define11.4%
pow211.4%
Applied egg-rr11.4%
Applied egg-rr87.6%
Taylor expanded in y around inf 71.3%
Final simplification79.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 5.5e-261)
(* -0.5 (/ (* z (+ y_m z)) y_m))
(if (<= y_m 1.9e-204)
(* x (* x (/ 0.5 y_m)))
(if (<= y_m 5.3e-130)
(/ 0.5 (/ y_m (* z (- z))))
(if (<= y_m 1.65e+14)
(* x (/ (* 0.5 x) y_m))
(/ 0.5 (/ (+ 1.0 (* (/ z y_m) -2.0)) y_m))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 5.5e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 1.9e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 5.3e-130) {
tmp = 0.5 / (y_m / (z * -z));
} else if (y_m <= 1.65e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 5.5d-261) then
tmp = (-0.5d0) * ((z * (y_m + z)) / y_m)
else if (y_m <= 1.9d-204) then
tmp = x * (x * (0.5d0 / y_m))
else if (y_m <= 5.3d-130) then
tmp = 0.5d0 / (y_m / (z * -z))
else if (y_m <= 1.65d+14) then
tmp = x * ((0.5d0 * x) / y_m)
else
tmp = 0.5d0 / ((1.0d0 + ((z / y_m) * (-2.0d0))) / y_m)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 5.5e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 1.9e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 5.3e-130) {
tmp = 0.5 / (y_m / (z * -z));
} else if (y_m <= 1.65e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 5.5e-261: tmp = -0.5 * ((z * (y_m + z)) / y_m) elif y_m <= 1.9e-204: tmp = x * (x * (0.5 / y_m)) elif y_m <= 5.3e-130: tmp = 0.5 / (y_m / (z * -z)) elif y_m <= 1.65e+14: tmp = x * ((0.5 * x) / y_m) else: tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 5.5e-261) tmp = Float64(-0.5 * Float64(Float64(z * Float64(y_m + z)) / y_m)); elseif (y_m <= 1.9e-204) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); elseif (y_m <= 5.3e-130) tmp = Float64(0.5 / Float64(y_m / Float64(z * Float64(-z)))); elseif (y_m <= 1.65e+14) tmp = Float64(x * Float64(Float64(0.5 * x) / y_m)); else tmp = Float64(0.5 / Float64(Float64(1.0 + Float64(Float64(z / y_m) * -2.0)) / y_m)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 5.5e-261) tmp = -0.5 * ((z * (y_m + z)) / y_m); elseif (y_m <= 1.9e-204) tmp = x * (x * (0.5 / y_m)); elseif (y_m <= 5.3e-130) tmp = 0.5 / (y_m / (z * -z)); elseif (y_m <= 1.65e+14) tmp = x * ((0.5 * x) / y_m); else tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 5.5e-261], N[(-0.5 * N[(N[(z * N[(y$95$m + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.9e-204], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 5.3e-130], N[(0.5 / N[(y$95$m / N[(z * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.65e+14], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(1.0 + N[(N[(z / y$95$m), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 5.5 \cdot 10^{-261}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot \left(y\_m + z\right)}{y\_m}\\
\mathbf{elif}\;y\_m \leq 1.9 \cdot 10^{-204}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 5.3 \cdot 10^{-130}:\\
\;\;\;\;\frac{0.5}{\frac{y\_m}{z \cdot \left(-z\right)}}\\
\mathbf{elif}\;y\_m \leq 1.65 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{1 + \frac{z}{y\_m} \cdot -2}{y\_m}}\\
\end{array}
\end{array}
if y < 5.50000000000000042e-261Initial program 69.4%
remove-double-neg69.4%
distribute-lft-neg-out69.4%
distribute-frac-neg269.4%
distribute-frac-neg69.4%
neg-mul-169.4%
distribute-lft-neg-out69.4%
*-commutative69.4%
distribute-lft-neg-in69.4%
times-frac69.4%
metadata-eval69.4%
metadata-eval69.4%
associate--l+69.4%
fma-define72.3%
Simplified72.3%
clear-num72.1%
un-div-inv72.1%
fma-undefine69.2%
associate--l+69.2%
add-sqr-sqrt69.2%
pow269.2%
hypot-define69.2%
pow269.2%
Applied egg-rr69.2%
Applied egg-rr65.4%
Taylor expanded in z around -inf 21.5%
associate-*r/21.5%
neg-mul-121.5%
Simplified21.5%
Taylor expanded in x around 0 29.9%
if 5.50000000000000042e-261 < y < 1.89999999999999991e-204Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-frac-neg298.1%
distribute-frac-neg98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
*-commutative98.1%
distribute-lft-neg-in98.1%
times-frac98.1%
metadata-eval98.1%
metadata-eval98.1%
associate--l+98.1%
fma-define98.2%
Simplified98.2%
clear-num98.1%
un-div-inv98.1%
fma-undefine98.0%
associate--l+98.0%
add-sqr-sqrt98.0%
pow298.0%
hypot-define98.0%
pow298.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.7%
pow273.7%
associate-/r/73.7%
associate-*r*73.9%
Applied egg-rr73.9%
if 1.89999999999999991e-204 < y < 5.3000000000000004e-130Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 47.8%
pow247.8%
Applied egg-rr47.8%
if 5.3000000000000004e-130 < y < 1.65e14Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.7%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 38.8%
pow238.8%
associate-/r/38.7%
associate-*r*38.6%
Applied egg-rr38.6%
associate-*l/38.8%
Applied egg-rr38.8%
if 1.65e14 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
clear-num45.8%
un-div-inv45.8%
fma-undefine45.7%
associate--l+45.7%
add-sqr-sqrt45.8%
pow245.8%
hypot-define45.8%
pow245.8%
Applied egg-rr45.8%
Applied egg-rr81.7%
Taylor expanded in y around inf 63.5%
Final simplification42.6%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 3e-261)
(* -0.5 (/ (* z (+ y_m z)) y_m))
(if (<= y_m 5.6e-204)
(* x (* x (/ 0.5 y_m)))
(if (<= y_m 4.1e-131)
(/ 0.5 (/ y_m (* z (- z))))
(if (<= y_m 51000000000000.0) (* x (/ (* 0.5 x) y_m)) (* y_m 0.5)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 3e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 5.6e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 4.1e-131) {
tmp = 0.5 / (y_m / (z * -z));
} else if (y_m <= 51000000000000.0) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 3d-261) then
tmp = (-0.5d0) * ((z * (y_m + z)) / y_m)
else if (y_m <= 5.6d-204) then
tmp = x * (x * (0.5d0 / y_m))
else if (y_m <= 4.1d-131) then
tmp = 0.5d0 / (y_m / (z * -z))
else if (y_m <= 51000000000000.0d0) then
tmp = x * ((0.5d0 * x) / y_m)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 3e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 5.6e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 4.1e-131) {
tmp = 0.5 / (y_m / (z * -z));
} else if (y_m <= 51000000000000.0) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 3e-261: tmp = -0.5 * ((z * (y_m + z)) / y_m) elif y_m <= 5.6e-204: tmp = x * (x * (0.5 / y_m)) elif y_m <= 4.1e-131: tmp = 0.5 / (y_m / (z * -z)) elif y_m <= 51000000000000.0: tmp = x * ((0.5 * x) / y_m) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 3e-261) tmp = Float64(-0.5 * Float64(Float64(z * Float64(y_m + z)) / y_m)); elseif (y_m <= 5.6e-204) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); elseif (y_m <= 4.1e-131) tmp = Float64(0.5 / Float64(y_m / Float64(z * Float64(-z)))); elseif (y_m <= 51000000000000.0) tmp = Float64(x * Float64(Float64(0.5 * x) / y_m)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 3e-261) tmp = -0.5 * ((z * (y_m + z)) / y_m); elseif (y_m <= 5.6e-204) tmp = x * (x * (0.5 / y_m)); elseif (y_m <= 4.1e-131) tmp = 0.5 / (y_m / (z * -z)); elseif (y_m <= 51000000000000.0) tmp = x * ((0.5 * x) / y_m); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 3e-261], N[(-0.5 * N[(N[(z * N[(y$95$m + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 5.6e-204], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 4.1e-131], N[(0.5 / N[(y$95$m / N[(z * (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 51000000000000.0], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 3 \cdot 10^{-261}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot \left(y\_m + z\right)}{y\_m}\\
\mathbf{elif}\;y\_m \leq 5.6 \cdot 10^{-204}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 4.1 \cdot 10^{-131}:\\
\;\;\;\;\frac{0.5}{\frac{y\_m}{z \cdot \left(-z\right)}}\\
\mathbf{elif}\;y\_m \leq 51000000000000:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 3.0000000000000001e-261Initial program 69.4%
remove-double-neg69.4%
distribute-lft-neg-out69.4%
distribute-frac-neg269.4%
distribute-frac-neg69.4%
neg-mul-169.4%
distribute-lft-neg-out69.4%
*-commutative69.4%
distribute-lft-neg-in69.4%
times-frac69.4%
metadata-eval69.4%
metadata-eval69.4%
associate--l+69.4%
fma-define72.3%
Simplified72.3%
clear-num72.1%
un-div-inv72.1%
fma-undefine69.2%
associate--l+69.2%
add-sqr-sqrt69.2%
pow269.2%
hypot-define69.2%
pow269.2%
Applied egg-rr69.2%
Applied egg-rr65.4%
Taylor expanded in z around -inf 21.5%
associate-*r/21.5%
neg-mul-121.5%
Simplified21.5%
Taylor expanded in x around 0 29.9%
if 3.0000000000000001e-261 < y < 5.60000000000000001e-204Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-frac-neg298.1%
distribute-frac-neg98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
*-commutative98.1%
distribute-lft-neg-in98.1%
times-frac98.1%
metadata-eval98.1%
metadata-eval98.1%
associate--l+98.1%
fma-define98.2%
Simplified98.2%
clear-num98.1%
un-div-inv98.1%
fma-undefine98.0%
associate--l+98.0%
add-sqr-sqrt98.0%
pow298.0%
hypot-define98.0%
pow298.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.7%
pow273.7%
associate-/r/73.7%
associate-*r*73.9%
Applied egg-rr73.9%
if 5.60000000000000001e-204 < y < 4.1000000000000002e-131Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 47.8%
pow247.8%
Applied egg-rr47.8%
if 4.1000000000000002e-131 < y < 5.1e13Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.7%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 38.8%
pow238.8%
associate-/r/38.7%
associate-*r*38.6%
Applied egg-rr38.6%
associate-*l/38.8%
Applied egg-rr38.8%
if 5.1e13 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in y around inf 63.4%
Final simplification42.6%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 4.6e-261)
(* -0.5 (/ (* z (+ y_m z)) y_m))
(if (<= y_m 2.1e-204)
(* x (* x (/ 0.5 y_m)))
(if (<= y_m 1.26e-131)
(* -0.5 (* z (/ (+ y_m z) y_m)))
(if (<= y_m 2.05e+14) (* x (/ (* 0.5 x) y_m)) (* y_m 0.5)))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.6e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 2.1e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 1.26e-131) {
tmp = -0.5 * (z * ((y_m + z) / y_m));
} else if (y_m <= 2.05e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 4.6d-261) then
tmp = (-0.5d0) * ((z * (y_m + z)) / y_m)
else if (y_m <= 2.1d-204) then
tmp = x * (x * (0.5d0 / y_m))
else if (y_m <= 1.26d-131) then
tmp = (-0.5d0) * (z * ((y_m + z) / y_m))
else if (y_m <= 2.05d+14) then
tmp = x * ((0.5d0 * x) / y_m)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 4.6e-261) {
tmp = -0.5 * ((z * (y_m + z)) / y_m);
} else if (y_m <= 2.1e-204) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 1.26e-131) {
tmp = -0.5 * (z * ((y_m + z) / y_m));
} else if (y_m <= 2.05e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 4.6e-261: tmp = -0.5 * ((z * (y_m + z)) / y_m) elif y_m <= 2.1e-204: tmp = x * (x * (0.5 / y_m)) elif y_m <= 1.26e-131: tmp = -0.5 * (z * ((y_m + z) / y_m)) elif y_m <= 2.05e+14: tmp = x * ((0.5 * x) / y_m) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 4.6e-261) tmp = Float64(-0.5 * Float64(Float64(z * Float64(y_m + z)) / y_m)); elseif (y_m <= 2.1e-204) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); elseif (y_m <= 1.26e-131) tmp = Float64(-0.5 * Float64(z * Float64(Float64(y_m + z) / y_m))); elseif (y_m <= 2.05e+14) tmp = Float64(x * Float64(Float64(0.5 * x) / y_m)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 4.6e-261) tmp = -0.5 * ((z * (y_m + z)) / y_m); elseif (y_m <= 2.1e-204) tmp = x * (x * (0.5 / y_m)); elseif (y_m <= 1.26e-131) tmp = -0.5 * (z * ((y_m + z) / y_m)); elseif (y_m <= 2.05e+14) tmp = x * ((0.5 * x) / y_m); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 4.6e-261], N[(-0.5 * N[(N[(z * N[(y$95$m + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.1e-204], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.26e-131], N[(-0.5 * N[(z * N[(N[(y$95$m + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.05e+14], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 4.6 \cdot 10^{-261}:\\
\;\;\;\;-0.5 \cdot \frac{z \cdot \left(y\_m + z\right)}{y\_m}\\
\mathbf{elif}\;y\_m \leq 2.1 \cdot 10^{-204}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 1.26 \cdot 10^{-131}:\\
\;\;\;\;-0.5 \cdot \left(z \cdot \frac{y\_m + z}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 2.05 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 4.6e-261Initial program 69.4%
remove-double-neg69.4%
distribute-lft-neg-out69.4%
distribute-frac-neg269.4%
distribute-frac-neg69.4%
neg-mul-169.4%
distribute-lft-neg-out69.4%
*-commutative69.4%
distribute-lft-neg-in69.4%
times-frac69.4%
metadata-eval69.4%
metadata-eval69.4%
associate--l+69.4%
fma-define72.3%
Simplified72.3%
clear-num72.1%
un-div-inv72.1%
fma-undefine69.2%
associate--l+69.2%
add-sqr-sqrt69.2%
pow269.2%
hypot-define69.2%
pow269.2%
Applied egg-rr69.2%
Applied egg-rr65.4%
Taylor expanded in z around -inf 21.5%
associate-*r/21.5%
neg-mul-121.5%
Simplified21.5%
Taylor expanded in x around 0 29.9%
if 4.6e-261 < y < 2.10000000000000009e-204Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-frac-neg298.1%
distribute-frac-neg98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
*-commutative98.1%
distribute-lft-neg-in98.1%
times-frac98.1%
metadata-eval98.1%
metadata-eval98.1%
associate--l+98.1%
fma-define98.2%
Simplified98.2%
clear-num98.1%
un-div-inv98.1%
fma-undefine98.0%
associate--l+98.0%
add-sqr-sqrt98.0%
pow298.0%
hypot-define98.0%
pow298.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.7%
pow273.7%
associate-/r/73.7%
associate-*r*73.9%
Applied egg-rr73.9%
if 2.10000000000000009e-204 < y < 1.26e-131Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.8%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Applied egg-rr53.0%
Taylor expanded in z around -inf 30.4%
associate-*r/30.4%
neg-mul-130.4%
Simplified30.4%
Taylor expanded in x around 0 47.8%
associate-/l*47.9%
Simplified47.9%
if 1.26e-131 < y < 2.05e14Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.7%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 38.8%
pow238.8%
associate-/r/38.7%
associate-*r*38.6%
Applied egg-rr38.6%
associate-*l/38.8%
Applied egg-rr38.8%
if 2.05e14 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in y around inf 63.4%
Final simplification42.6%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* -0.5 (* z (/ (+ y_m z) y_m)))))
(*
y_s
(if (<= y_m 1.75e-261)
t_0
(if (<= y_m 8e-205)
(* x (* x (/ 0.5 y_m)))
(if (<= y_m 3.15e-130)
t_0
(if (<= y_m 2.4e+14) (* x (/ (* 0.5 x) y_m)) (* y_m 0.5))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = -0.5 * (z * ((y_m + z) / y_m));
double tmp;
if (y_m <= 1.75e-261) {
tmp = t_0;
} else if (y_m <= 8e-205) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 3.15e-130) {
tmp = t_0;
} else if (y_m <= 2.4e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (-0.5d0) * (z * ((y_m + z) / y_m))
if (y_m <= 1.75d-261) then
tmp = t_0
else if (y_m <= 8d-205) then
tmp = x * (x * (0.5d0 / y_m))
else if (y_m <= 3.15d-130) then
tmp = t_0
else if (y_m <= 2.4d+14) then
tmp = x * ((0.5d0 * x) / y_m)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = -0.5 * (z * ((y_m + z) / y_m));
double tmp;
if (y_m <= 1.75e-261) {
tmp = t_0;
} else if (y_m <= 8e-205) {
tmp = x * (x * (0.5 / y_m));
} else if (y_m <= 3.15e-130) {
tmp = t_0;
} else if (y_m <= 2.4e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = -0.5 * (z * ((y_m + z) / y_m)) tmp = 0 if y_m <= 1.75e-261: tmp = t_0 elif y_m <= 8e-205: tmp = x * (x * (0.5 / y_m)) elif y_m <= 3.15e-130: tmp = t_0 elif y_m <= 2.4e+14: tmp = x * ((0.5 * x) / y_m) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(-0.5 * Float64(z * Float64(Float64(y_m + z) / y_m))) tmp = 0.0 if (y_m <= 1.75e-261) tmp = t_0; elseif (y_m <= 8e-205) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); elseif (y_m <= 3.15e-130) tmp = t_0; elseif (y_m <= 2.4e+14) tmp = Float64(x * Float64(Float64(0.5 * x) / y_m)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = -0.5 * (z * ((y_m + z) / y_m)); tmp = 0.0; if (y_m <= 1.75e-261) tmp = t_0; elseif (y_m <= 8e-205) tmp = x * (x * (0.5 / y_m)); elseif (y_m <= 3.15e-130) tmp = t_0; elseif (y_m <= 2.4e+14) tmp = x * ((0.5 * x) / y_m); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(-0.5 * N[(z * N[(N[(y$95$m + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.75e-261], t$95$0, If[LessEqual[y$95$m, 8e-205], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 3.15e-130], t$95$0, If[LessEqual[y$95$m, 2.4e+14], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(z \cdot \frac{y\_m + z}{y\_m}\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.75 \cdot 10^{-261}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y\_m \leq 8 \cdot 10^{-205}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 3.15 \cdot 10^{-130}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y\_m \leq 2.4 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if y < 1.7499999999999999e-261 or 8e-205 < y < 3.1499999999999998e-130Initial program 72.7%
remove-double-neg72.7%
distribute-lft-neg-out72.7%
distribute-frac-neg272.7%
distribute-frac-neg72.7%
neg-mul-172.7%
distribute-lft-neg-out72.7%
*-commutative72.7%
distribute-lft-neg-in72.7%
times-frac72.7%
metadata-eval72.7%
metadata-eval72.7%
associate--l+72.7%
fma-define75.3%
Simplified75.3%
clear-num75.1%
un-div-inv75.1%
fma-undefine72.5%
associate--l+72.5%
add-sqr-sqrt72.5%
pow272.5%
hypot-define72.5%
pow272.5%
Applied egg-rr72.5%
Applied egg-rr64.1%
Taylor expanded in z around -inf 22.5%
associate-*r/22.5%
neg-mul-122.5%
Simplified22.5%
Taylor expanded in x around 0 31.8%
associate-/l*36.1%
Simplified36.1%
if 1.7499999999999999e-261 < y < 8e-205Initial program 98.1%
remove-double-neg98.1%
distribute-lft-neg-out98.1%
distribute-frac-neg298.1%
distribute-frac-neg98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
*-commutative98.1%
distribute-lft-neg-in98.1%
times-frac98.1%
metadata-eval98.1%
metadata-eval98.1%
associate--l+98.1%
fma-define98.2%
Simplified98.2%
clear-num98.1%
un-div-inv98.1%
fma-undefine98.0%
associate--l+98.0%
add-sqr-sqrt98.0%
pow298.0%
hypot-define98.0%
pow298.0%
Applied egg-rr98.0%
Taylor expanded in x around inf 73.7%
pow273.7%
associate-/r/73.7%
associate-*r*73.9%
Applied egg-rr73.9%
if 3.1499999999999998e-130 < y < 2.4e14Initial program 99.8%
remove-double-neg99.8%
distribute-lft-neg-out99.8%
distribute-frac-neg299.8%
distribute-frac-neg99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
times-frac99.8%
metadata-eval99.8%
metadata-eval99.8%
associate--l+99.8%
fma-define99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.7%
fma-undefine99.8%
associate--l+99.8%
add-sqr-sqrt99.8%
pow299.8%
hypot-define99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 38.8%
pow238.8%
associate-/r/38.7%
associate-*r*38.6%
Applied egg-rr38.6%
associate-*l/38.8%
Applied egg-rr38.8%
if 2.4e14 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in y around inf 63.4%
Final simplification45.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 1.3e+157)
(/ (- (+ (* y_m y_m) (* x x)) (* z z)) (* y_m 2.0))
(/ 0.5 (/ (+ 1.0 (* (/ z y_m) -2.0)) y_m)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.3e+157) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m);
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.3d+157) then
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0d0)
else
tmp = 0.5d0 / ((1.0d0 + ((z / y_m) * (-2.0d0))) / y_m)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.3e+157) {
tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0);
} else {
tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.3e+157: tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0) else: tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.3e+157) tmp = Float64(Float64(Float64(Float64(y_m * y_m) + Float64(x * x)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(0.5 / Float64(Float64(1.0 + Float64(Float64(z / y_m) * -2.0)) / y_m)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.3e+157) tmp = (((y_m * y_m) + (x * x)) - (z * z)) / (y_m * 2.0); else tmp = 0.5 / ((1.0 + ((z / y_m) * -2.0)) / y_m); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.3e+157], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 / N[(N[(1.0 + N[(N[(z / y$95$m), $MachinePrecision] * -2.0), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.3 \cdot 10^{+157}:\\
\;\;\;\;\frac{\left(y\_m \cdot y\_m + x \cdot x\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5}{\frac{1 + \frac{z}{y\_m} \cdot -2}{y\_m}}\\
\end{array}
\end{array}
if y < 1.30000000000000005e157Initial program 78.9%
if 1.30000000000000005e157 < y Initial program 11.4%
remove-double-neg11.4%
distribute-lft-neg-out11.4%
distribute-frac-neg211.4%
distribute-frac-neg11.4%
neg-mul-111.4%
distribute-lft-neg-out11.4%
*-commutative11.4%
distribute-lft-neg-in11.4%
times-frac11.4%
metadata-eval11.4%
metadata-eval11.4%
associate--l+11.4%
fma-define11.4%
Simplified11.4%
clear-num11.4%
un-div-inv11.4%
fma-undefine11.4%
associate--l+11.4%
add-sqr-sqrt11.4%
pow211.4%
hypot-define11.4%
pow211.4%
Applied egg-rr11.4%
Applied egg-rr87.6%
Taylor expanded in y around inf 71.3%
Final simplification77.9%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 1.26e+14) (* x (/ (* 0.5 x) y_m)) (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.26e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 1.26d+14) then
tmp = x * ((0.5d0 * x) / y_m)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 1.26e+14) {
tmp = x * ((0.5 * x) / y_m);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 1.26e+14: tmp = x * ((0.5 * x) / y_m) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 1.26e+14) tmp = Float64(x * Float64(Float64(0.5 * x) / y_m)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 1.26e+14) tmp = x * ((0.5 * x) / y_m); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 1.26e+14], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.26 \cdot 10^{+14}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.26e14Initial program 77.8%
remove-double-neg77.8%
distribute-lft-neg-out77.8%
distribute-frac-neg277.8%
distribute-frac-neg77.8%
neg-mul-177.8%
distribute-lft-neg-out77.8%
*-commutative77.8%
distribute-lft-neg-in77.8%
times-frac77.8%
metadata-eval77.8%
metadata-eval77.8%
associate--l+77.8%
fma-define79.9%
Simplified79.9%
clear-num79.8%
un-div-inv79.8%
fma-undefine77.7%
associate--l+77.7%
add-sqr-sqrt77.7%
pow277.7%
hypot-define77.7%
pow277.7%
Applied egg-rr77.7%
Taylor expanded in x around inf 34.2%
pow234.2%
associate-/r/34.2%
associate-*r*34.6%
Applied egg-rr34.6%
associate-*l/34.6%
Applied egg-rr34.6%
if 1.26e14 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in y around inf 63.4%
Final simplification41.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 27000000000000.0) (* x (* x (/ 0.5 y_m))) (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 27000000000000.0) {
tmp = x * (x * (0.5 / y_m));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 27000000000000.0d0) then
tmp = x * (x * (0.5d0 / y_m))
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 27000000000000.0) {
tmp = x * (x * (0.5 / y_m));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 27000000000000.0: tmp = x * (x * (0.5 / y_m)) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 27000000000000.0) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 27000000000000.0) tmp = x * (x * (0.5 / y_m)); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 27000000000000.0], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 27000000000000:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 2.7e13Initial program 77.8%
remove-double-neg77.8%
distribute-lft-neg-out77.8%
distribute-frac-neg277.8%
distribute-frac-neg77.8%
neg-mul-177.8%
distribute-lft-neg-out77.8%
*-commutative77.8%
distribute-lft-neg-in77.8%
times-frac77.8%
metadata-eval77.8%
metadata-eval77.8%
associate--l+77.8%
fma-define79.9%
Simplified79.9%
clear-num79.8%
un-div-inv79.8%
fma-undefine77.7%
associate--l+77.7%
add-sqr-sqrt77.7%
pow277.7%
hypot-define77.7%
pow277.7%
Applied egg-rr77.7%
Taylor expanded in x around inf 34.2%
pow234.2%
associate-/r/34.2%
associate-*r*34.6%
Applied egg-rr34.6%
if 2.7e13 < y Initial program 45.8%
remove-double-neg45.8%
distribute-lft-neg-out45.8%
distribute-frac-neg245.8%
distribute-frac-neg45.8%
neg-mul-145.8%
distribute-lft-neg-out45.8%
*-commutative45.8%
distribute-lft-neg-in45.8%
times-frac45.8%
metadata-eval45.8%
metadata-eval45.8%
associate--l+45.8%
fma-define45.9%
Simplified45.9%
Taylor expanded in y around inf 63.4%
Final simplification41.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* y_m 0.5)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m * 0.5);
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (y_m * 0.5d0)
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m * 0.5);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m * 0.5)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m * 0.5)) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m * 0.5); end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(y\_m \cdot 0.5\right)
\end{array}
Initial program 70.2%
remove-double-neg70.2%
distribute-lft-neg-out70.2%
distribute-frac-neg270.2%
distribute-frac-neg70.2%
neg-mul-170.2%
distribute-lft-neg-out70.2%
*-commutative70.2%
distribute-lft-neg-in70.2%
times-frac70.2%
metadata-eval70.2%
metadata-eval70.2%
associate--l+70.2%
fma-define71.8%
Simplified71.8%
Taylor expanded in y around inf 39.6%
Final simplification39.6%
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2024130
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))