
(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 10 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
(let* ((t_0 (hypot (hypot x y_m) z)))
(*
y_s
(if (<= (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)) -5e-53)
(/ z (/ (* y_m (- 2.0)) z))
(* 0.5 (* t_0 (/ t_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 = hypot(hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else {
tmp = 0.5 * (t_0 * (t_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 = Math.hypot(Math.hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else {
tmp = 0.5 * (t_0 * (t_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 = math.hypot(math.hypot(x, y_m), z) tmp = 0 if ((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53: tmp = z / ((y_m * -2.0) / z) else: tmp = 0.5 * (t_0 * (t_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 = hypot(hypot(x, y_m), z) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e-53) tmp = Float64(z / Float64(Float64(y_m * Float64(-2.0)) / z)); else tmp = Float64(0.5 * Float64(t_0 * Float64(t_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 = hypot(hypot(x, y_m), z); tmp = 0.0; if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) tmp = z / ((y_m * -2.0) / z); else tmp = 0.5 * (t_0 * (t_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[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e-53], N[(z / N[(N[(y$95$m * (-2.0)), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(t$95$0 * N[(t$95$0 / 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 := \mathsf{hypot}\left(\mathsf{hypot}\left(x, y\_m\right), z\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2} \leq -5 \cdot 10^{-53}:\\
\;\;\;\;\frac{z}{\frac{y\_m \cdot \left(-2\right)}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(t\_0 \cdot \frac{t\_0}{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))) < -5e-53Initial program 75.7%
clear-num75.6%
inv-pow75.6%
associate-/l*75.5%
add-sqr-sqrt75.5%
pow275.5%
hypot-define75.5%
pow275.5%
Applied egg-rr75.5%
Taylor expanded in z around inf 35.4%
associate-*r/35.4%
metadata-eval35.4%
div-inv35.4%
unpow235.4%
associate-/r*36.3%
div-inv36.3%
metadata-eval36.3%
Applied egg-rr36.3%
unpow-136.3%
clear-num36.3%
frac-2neg36.3%
distribute-neg-frac36.3%
distribute-rgt-neg-in36.3%
metadata-eval36.3%
Applied egg-rr36.3%
if -5e-53 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 63.0%
remove-double-neg63.0%
distribute-lft-neg-out63.0%
distribute-frac-neg263.0%
distribute-frac-neg63.0%
neg-mul-163.0%
distribute-lft-neg-out63.0%
*-commutative63.0%
distribute-lft-neg-in63.0%
times-frac63.0%
metadata-eval63.0%
metadata-eval63.0%
associate--l+63.0%
fma-define66.4%
Simplified66.4%
fma-undefine63.0%
associate--l+63.0%
add-cube-cbrt62.5%
pow362.5%
add-sqr-sqrt62.5%
pow262.5%
hypot-define62.5%
pow262.5%
Applied egg-rr62.5%
sqr-pow42.5%
associate-/l*42.6%
Applied egg-rr69.5%
Final simplification55.7%
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 (<= (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)) -5e-53)
(/ z (/ (* y_m (- 2.0)) z))
(* 0.5 (pow (/ (hypot (hypot x y_m) z) (sqrt y_m)) 2.0)))))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 (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else {
tmp = 0.5 * pow((hypot(hypot(x, y_m), z) / sqrt(y_m)), 2.0);
}
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 (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else {
tmp = 0.5 * Math.pow((Math.hypot(Math.hypot(x, y_m), z) / Math.sqrt(y_m)), 2.0);
}
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 ((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53: tmp = z / ((y_m * -2.0) / z) else: tmp = 0.5 * math.pow((math.hypot(math.hypot(x, y_m), z) / math.sqrt(y_m)), 2.0) 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(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e-53) tmp = Float64(z / Float64(Float64(y_m * Float64(-2.0)) / z)); else tmp = Float64(0.5 * (Float64(hypot(hypot(x, y_m), z) / sqrt(y_m)) ^ 2.0)); 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 (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e-53) tmp = z / ((y_m * -2.0) / z); else tmp = 0.5 * ((hypot(hypot(x, y_m), z) / sqrt(y_m)) ^ 2.0); 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[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e-53], N[(z / N[(N[(y$95$m * (-2.0)), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[N[(N[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision], 2.0], $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(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2} \leq -5 \cdot 10^{-53}:\\
\;\;\;\;\frac{z}{\frac{y\_m \cdot \left(-2\right)}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\frac{\mathsf{hypot}\left(\mathsf{hypot}\left(x, y\_m\right), z\right)}{\sqrt{y\_m}}\right)}^{2}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < -5e-53Initial program 75.7%
clear-num75.6%
inv-pow75.6%
associate-/l*75.5%
add-sqr-sqrt75.5%
pow275.5%
hypot-define75.5%
pow275.5%
Applied egg-rr75.5%
Taylor expanded in z around inf 35.4%
associate-*r/35.4%
metadata-eval35.4%
div-inv35.4%
unpow235.4%
associate-/r*36.3%
div-inv36.3%
metadata-eval36.3%
Applied egg-rr36.3%
unpow-136.3%
clear-num36.3%
frac-2neg36.3%
distribute-neg-frac36.3%
distribute-rgt-neg-in36.3%
metadata-eval36.3%
Applied egg-rr36.3%
if -5e-53 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 63.0%
remove-double-neg63.0%
distribute-lft-neg-out63.0%
distribute-frac-neg263.0%
distribute-frac-neg63.0%
neg-mul-163.0%
distribute-lft-neg-out63.0%
*-commutative63.0%
distribute-lft-neg-in63.0%
times-frac63.0%
metadata-eval63.0%
metadata-eval63.0%
associate--l+63.0%
fma-define66.4%
Simplified66.4%
fma-undefine63.0%
associate--l+63.0%
add-cube-cbrt62.5%
pow362.5%
add-sqr-sqrt62.5%
pow262.5%
hypot-define62.5%
pow262.5%
Applied egg-rr62.5%
rem-cube-cbrt63.0%
add-sqr-sqrt61.5%
Applied egg-rr62.0%
unpow262.0%
Simplified62.0%
Final simplification51.3%
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.32e+154)
(* 0.5 (/ (fma x x (- (* y_m y_m) (* z z))) 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.32e+154) {
tmp = 0.5 * (fma(x, x, ((y_m * y_m) - (z * z))) / 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.32e+154) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m * y_m) - Float64(z * z))) / y_m)); else tmp = Float64(y_m * 0.5); 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.32e+154], 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[(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.32 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m - z \cdot z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.31999999999999998e154Initial program 75.2%
remove-double-neg75.2%
distribute-lft-neg-out75.2%
distribute-frac-neg275.2%
distribute-frac-neg75.2%
neg-mul-175.2%
distribute-lft-neg-out75.2%
*-commutative75.2%
distribute-lft-neg-in75.2%
times-frac75.2%
metadata-eval75.2%
metadata-eval75.2%
associate--l+75.2%
fma-define77.4%
Simplified77.4%
if 1.31999999999999998e154 < y Initial program 9.1%
Taylor expanded in y around inf 79.1%
*-commutative79.1%
Simplified79.1%
Final simplification77.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 (<= x 3.6e-149)
(* y_m 0.5)
(if (<= x 1.02e-53)
(* z (* (/ z y_m) -0.5))
(if (<= x 3.1e+82) (* y_m 0.5) (* 0.5 (* x (/ 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 (x <= 3.6e-149) {
tmp = y_m * 0.5;
} else if (x <= 1.02e-53) {
tmp = z * ((z / y_m) * -0.5);
} else if (x <= 3.1e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (x / 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 (x <= 3.6d-149) then
tmp = y_m * 0.5d0
else if (x <= 1.02d-53) then
tmp = z * ((z / y_m) * (-0.5d0))
else if (x <= 3.1d+82) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 * (x * (x / 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 (x <= 3.6e-149) {
tmp = y_m * 0.5;
} else if (x <= 1.02e-53) {
tmp = z * ((z / y_m) * -0.5);
} else if (x <= 3.1e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (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 x <= 3.6e-149: tmp = y_m * 0.5 elif x <= 1.02e-53: tmp = z * ((z / y_m) * -0.5) elif x <= 3.1e+82: tmp = y_m * 0.5 else: tmp = 0.5 * (x * (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 (x <= 3.6e-149) tmp = Float64(y_m * 0.5); elseif (x <= 1.02e-53) tmp = Float64(z * Float64(Float64(z / y_m) * -0.5)); elseif (x <= 3.1e+82) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 * Float64(x * Float64(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 (x <= 3.6e-149) tmp = y_m * 0.5; elseif (x <= 1.02e-53) tmp = z * ((z / y_m) * -0.5); elseif (x <= 3.1e+82) tmp = y_m * 0.5; else tmp = 0.5 * (x * (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[x, 3.6e-149], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.02e-53], N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+82], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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}\;x \leq 3.6 \cdot 10^{-149}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-53}:\\
\;\;\;\;z \cdot \left(\frac{z}{y\_m} \cdot -0.5\right)\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if x < 3.6000000000000002e-149 or 1.02000000000000002e-53 < x < 3.10000000000000032e82Initial program 67.5%
Taylor expanded in y around inf 42.2%
*-commutative42.2%
Simplified42.2%
if 3.6000000000000002e-149 < x < 1.02000000000000002e-53Initial program 77.8%
clear-num77.7%
inv-pow77.7%
associate-/l*77.5%
add-sqr-sqrt77.5%
pow277.5%
hypot-define77.5%
pow277.5%
Applied egg-rr77.5%
Taylor expanded in z around inf 67.5%
associate-*r/67.6%
metadata-eval67.6%
div-inv67.6%
unpow267.6%
associate-/r*71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
unpow-171.7%
associate-/r/71.9%
clear-num71.8%
*-un-lft-identity71.8%
*-commutative71.8%
times-frac71.8%
metadata-eval71.8%
Applied egg-rr71.8%
if 3.10000000000000032e82 < x Initial program 67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-frac-neg267.2%
distribute-frac-neg67.2%
neg-mul-167.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
distribute-lft-neg-in67.2%
times-frac67.2%
metadata-eval67.2%
metadata-eval67.2%
associate--l+67.2%
fma-define72.4%
Simplified72.4%
fma-undefine67.2%
associate--l+67.2%
*-un-lft-identity67.2%
add-sqr-sqrt35.4%
times-frac35.4%
add-sqr-sqrt35.4%
pow235.4%
hypot-define35.4%
pow235.4%
Applied egg-rr35.4%
associate-*l/35.4%
*-lft-identity35.4%
div-sub33.7%
+-rgt-identity33.7%
div-sub35.4%
+-rgt-identity35.4%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define35.4%
Simplified35.4%
Taylor expanded in x around inf 33.6%
associate-/l/33.6%
unpow233.6%
add-sqr-sqrt60.5%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification51.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 (<= x 3.3e-152)
(* y_m 0.5)
(if (<= x 4.5e-55)
(/ z (* y_m (/ -2.0 z)))
(if (<= x 3.6e+82) (* y_m 0.5) (* 0.5 (* x (/ 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 (x <= 3.3e-152) {
tmp = y_m * 0.5;
} else if (x <= 4.5e-55) {
tmp = z / (y_m * (-2.0 / z));
} else if (x <= 3.6e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (x / 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 (x <= 3.3d-152) then
tmp = y_m * 0.5d0
else if (x <= 4.5d-55) then
tmp = z / (y_m * ((-2.0d0) / z))
else if (x <= 3.6d+82) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 * (x * (x / 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 (x <= 3.3e-152) {
tmp = y_m * 0.5;
} else if (x <= 4.5e-55) {
tmp = z / (y_m * (-2.0 / z));
} else if (x <= 3.6e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (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 x <= 3.3e-152: tmp = y_m * 0.5 elif x <= 4.5e-55: tmp = z / (y_m * (-2.0 / z)) elif x <= 3.6e+82: tmp = y_m * 0.5 else: tmp = 0.5 * (x * (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 (x <= 3.3e-152) tmp = Float64(y_m * 0.5); elseif (x <= 4.5e-55) tmp = Float64(z / Float64(y_m * Float64(-2.0 / z))); elseif (x <= 3.6e+82) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 * Float64(x * Float64(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 (x <= 3.3e-152) tmp = y_m * 0.5; elseif (x <= 4.5e-55) tmp = z / (y_m * (-2.0 / z)); elseif (x <= 3.6e+82) tmp = y_m * 0.5; else tmp = 0.5 * (x * (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[x, 3.3e-152], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 4.5e-55], N[(z / N[(y$95$m * N[(-2.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e+82], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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}\;x \leq 3.3 \cdot 10^{-152}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{z}{y\_m \cdot \frac{-2}{z}}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if x < 3.29999999999999998e-152 or 4.4999999999999997e-55 < x < 3.60000000000000014e82Initial program 67.5%
Taylor expanded in y around inf 42.2%
*-commutative42.2%
Simplified42.2%
if 3.29999999999999998e-152 < x < 4.4999999999999997e-55Initial program 77.8%
clear-num77.7%
inv-pow77.7%
associate-/l*77.5%
add-sqr-sqrt77.5%
pow277.5%
hypot-define77.5%
pow277.5%
Applied egg-rr77.5%
Taylor expanded in z around inf 67.5%
associate-*r/67.6%
metadata-eval67.6%
div-inv67.6%
unpow267.6%
associate-/r*71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
unpow-171.7%
clear-num71.9%
associate-/l*71.8%
Applied egg-rr71.8%
if 3.60000000000000014e82 < x Initial program 67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-frac-neg267.2%
distribute-frac-neg67.2%
neg-mul-167.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
distribute-lft-neg-in67.2%
times-frac67.2%
metadata-eval67.2%
metadata-eval67.2%
associate--l+67.2%
fma-define72.4%
Simplified72.4%
fma-undefine67.2%
associate--l+67.2%
*-un-lft-identity67.2%
add-sqr-sqrt35.4%
times-frac35.4%
add-sqr-sqrt35.4%
pow235.4%
hypot-define35.4%
pow235.4%
Applied egg-rr35.4%
associate-*l/35.4%
*-lft-identity35.4%
div-sub33.7%
+-rgt-identity33.7%
div-sub35.4%
+-rgt-identity35.4%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define35.4%
Simplified35.4%
Taylor expanded in x around inf 33.6%
associate-/l/33.6%
unpow233.6%
add-sqr-sqrt60.5%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification51.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 (<= x 3.3e-148)
(* y_m 0.5)
(if (<= x 3.05e-52)
(/ (/ z y_m) (/ -2.0 z))
(if (<= x 3.1e+82) (* y_m 0.5) (* 0.5 (* x (/ 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 (x <= 3.3e-148) {
tmp = y_m * 0.5;
} else if (x <= 3.05e-52) {
tmp = (z / y_m) / (-2.0 / z);
} else if (x <= 3.1e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (x / 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 (x <= 3.3d-148) then
tmp = y_m * 0.5d0
else if (x <= 3.05d-52) then
tmp = (z / y_m) / ((-2.0d0) / z)
else if (x <= 3.1d+82) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 * (x * (x / 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 (x <= 3.3e-148) {
tmp = y_m * 0.5;
} else if (x <= 3.05e-52) {
tmp = (z / y_m) / (-2.0 / z);
} else if (x <= 3.1e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (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 x <= 3.3e-148: tmp = y_m * 0.5 elif x <= 3.05e-52: tmp = (z / y_m) / (-2.0 / z) elif x <= 3.1e+82: tmp = y_m * 0.5 else: tmp = 0.5 * (x * (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 (x <= 3.3e-148) tmp = Float64(y_m * 0.5); elseif (x <= 3.05e-52) tmp = Float64(Float64(z / y_m) / Float64(-2.0 / z)); elseif (x <= 3.1e+82) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 * Float64(x * Float64(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 (x <= 3.3e-148) tmp = y_m * 0.5; elseif (x <= 3.05e-52) tmp = (z / y_m) / (-2.0 / z); elseif (x <= 3.1e+82) tmp = y_m * 0.5; else tmp = 0.5 * (x * (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[x, 3.3e-148], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 3.05e-52], N[(N[(z / y$95$m), $MachinePrecision] / N[(-2.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.1e+82], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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}\;x \leq 3.3 \cdot 10^{-148}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{-52}:\\
\;\;\;\;\frac{\frac{z}{y\_m}}{\frac{-2}{z}}\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if x < 3.29999999999999974e-148 or 3.04999999999999995e-52 < x < 3.10000000000000032e82Initial program 67.5%
Taylor expanded in y around inf 42.2%
*-commutative42.2%
Simplified42.2%
if 3.29999999999999974e-148 < x < 3.04999999999999995e-52Initial program 77.8%
clear-num77.7%
inv-pow77.7%
associate-/l*77.5%
add-sqr-sqrt77.5%
pow277.5%
hypot-define77.5%
pow277.5%
Applied egg-rr77.5%
Taylor expanded in z around inf 67.5%
associate-*r/67.6%
metadata-eval67.6%
div-inv67.6%
unpow267.6%
associate-/r*71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
unpow-171.7%
clear-num71.9%
associate-/l*71.8%
associate-/r*71.8%
Applied egg-rr71.8%
if 3.10000000000000032e82 < x Initial program 67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-frac-neg267.2%
distribute-frac-neg67.2%
neg-mul-167.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
distribute-lft-neg-in67.2%
times-frac67.2%
metadata-eval67.2%
metadata-eval67.2%
associate--l+67.2%
fma-define72.4%
Simplified72.4%
fma-undefine67.2%
associate--l+67.2%
*-un-lft-identity67.2%
add-sqr-sqrt35.4%
times-frac35.4%
add-sqr-sqrt35.4%
pow235.4%
hypot-define35.4%
pow235.4%
Applied egg-rr35.4%
associate-*l/35.4%
*-lft-identity35.4%
div-sub33.7%
+-rgt-identity33.7%
div-sub35.4%
+-rgt-identity35.4%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define35.4%
Simplified35.4%
Taylor expanded in x around inf 33.6%
associate-/l/33.6%
unpow233.6%
add-sqr-sqrt60.5%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification51.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 (<= x 4.2e-152)
(* y_m 0.5)
(if (<= x 3.5e-53)
(/ z (/ (* y_m (- 2.0)) z))
(if (<= x 3.9e+82) (* y_m 0.5) (* 0.5 (* x (/ 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 (x <= 4.2e-152) {
tmp = y_m * 0.5;
} else if (x <= 3.5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else if (x <= 3.9e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (x / 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 (x <= 4.2d-152) then
tmp = y_m * 0.5d0
else if (x <= 3.5d-53) then
tmp = z / ((y_m * -2.0d0) / z)
else if (x <= 3.9d+82) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 * (x * (x / 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 (x <= 4.2e-152) {
tmp = y_m * 0.5;
} else if (x <= 3.5e-53) {
tmp = z / ((y_m * -2.0) / z);
} else if (x <= 3.9e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (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 x <= 4.2e-152: tmp = y_m * 0.5 elif x <= 3.5e-53: tmp = z / ((y_m * -2.0) / z) elif x <= 3.9e+82: tmp = y_m * 0.5 else: tmp = 0.5 * (x * (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 (x <= 4.2e-152) tmp = Float64(y_m * 0.5); elseif (x <= 3.5e-53) tmp = Float64(z / Float64(Float64(y_m * Float64(-2.0)) / z)); elseif (x <= 3.9e+82) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 * Float64(x * Float64(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 (x <= 4.2e-152) tmp = y_m * 0.5; elseif (x <= 3.5e-53) tmp = z / ((y_m * -2.0) / z); elseif (x <= 3.9e+82) tmp = y_m * 0.5; else tmp = 0.5 * (x * (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[x, 4.2e-152], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 3.5e-53], N[(z / N[(N[(y$95$m * (-2.0)), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.9e+82], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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}\;x \leq 4.2 \cdot 10^{-152}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-53}:\\
\;\;\;\;\frac{z}{\frac{y\_m \cdot \left(-2\right)}{z}}\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if x < 4.19999999999999998e-152 or 3.49999999999999993e-53 < x < 3.89999999999999976e82Initial program 67.5%
Taylor expanded in y around inf 42.2%
*-commutative42.2%
Simplified42.2%
if 4.19999999999999998e-152 < x < 3.49999999999999993e-53Initial program 77.8%
clear-num77.7%
inv-pow77.7%
associate-/l*77.5%
add-sqr-sqrt77.5%
pow277.5%
hypot-define77.5%
pow277.5%
Applied egg-rr77.5%
Taylor expanded in z around inf 67.5%
associate-*r/67.6%
metadata-eval67.6%
div-inv67.6%
unpow267.6%
associate-/r*71.7%
div-inv71.7%
metadata-eval71.7%
Applied egg-rr71.7%
unpow-171.7%
clear-num71.9%
frac-2neg71.9%
distribute-neg-frac71.9%
distribute-rgt-neg-in71.9%
metadata-eval71.9%
Applied egg-rr71.9%
if 3.89999999999999976e82 < x Initial program 67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-frac-neg267.2%
distribute-frac-neg67.2%
neg-mul-167.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
distribute-lft-neg-in67.2%
times-frac67.2%
metadata-eval67.2%
metadata-eval67.2%
associate--l+67.2%
fma-define72.4%
Simplified72.4%
fma-undefine67.2%
associate--l+67.2%
*-un-lft-identity67.2%
add-sqr-sqrt35.4%
times-frac35.4%
add-sqr-sqrt35.4%
pow235.4%
hypot-define35.4%
pow235.4%
Applied egg-rr35.4%
associate-*l/35.4%
*-lft-identity35.4%
div-sub33.7%
+-rgt-identity33.7%
div-sub35.4%
+-rgt-identity35.4%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define35.4%
Simplified35.4%
Taylor expanded in x around inf 33.6%
associate-/l/33.6%
unpow233.6%
add-sqr-sqrt60.5%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification51.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 1.32e+154)
(/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))
(* 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.32e+154) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} 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.32d+154) then
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
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.32e+154) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} 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.32e+154: tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) 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.32e+154) tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)); 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.32e+154) tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); 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.32e+154], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $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.32 \cdot 10^{+154}:\\
\;\;\;\;\frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.31999999999999998e154Initial program 75.2%
if 1.31999999999999998e154 < y Initial program 9.1%
Taylor expanded in y around inf 79.1%
*-commutative79.1%
Simplified79.1%
Final simplification75.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 (<= x 3.2e+82) (* y_m 0.5) (* 0.5 (* x (/ 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 (x <= 3.2e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (x / 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 (x <= 3.2d+82) then
tmp = y_m * 0.5d0
else
tmp = 0.5d0 * (x * (x / 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 (x <= 3.2e+82) {
tmp = y_m * 0.5;
} else {
tmp = 0.5 * (x * (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 x <= 3.2e+82: tmp = y_m * 0.5 else: tmp = 0.5 * (x * (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 (x <= 3.2e+82) tmp = Float64(y_m * 0.5); else tmp = Float64(0.5 * Float64(x * Float64(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 (x <= 3.2e+82) tmp = y_m * 0.5; else tmp = 0.5 * (x * (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[x, 3.2e+82], N[(y$95$m * 0.5), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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}\;x \leq 3.2 \cdot 10^{+82}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if x < 3.19999999999999975e82Initial program 68.6%
Taylor expanded in y around inf 39.9%
*-commutative39.9%
Simplified39.9%
if 3.19999999999999975e82 < x Initial program 67.2%
remove-double-neg67.2%
distribute-lft-neg-out67.2%
distribute-frac-neg267.2%
distribute-frac-neg67.2%
neg-mul-167.2%
distribute-lft-neg-out67.2%
*-commutative67.2%
distribute-lft-neg-in67.2%
times-frac67.2%
metadata-eval67.2%
metadata-eval67.2%
associate--l+67.2%
fma-define72.4%
Simplified72.4%
fma-undefine67.2%
associate--l+67.2%
*-un-lft-identity67.2%
add-sqr-sqrt35.4%
times-frac35.4%
add-sqr-sqrt35.4%
pow235.4%
hypot-define35.4%
pow235.4%
Applied egg-rr35.4%
associate-*l/35.4%
*-lft-identity35.4%
div-sub33.7%
+-rgt-identity33.7%
div-sub35.4%
+-rgt-identity35.4%
hypot-undefine35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-define35.4%
Simplified35.4%
Taylor expanded in x around inf 33.6%
associate-/l/33.6%
unpow233.6%
add-sqr-sqrt60.5%
associate-/l*73.0%
Applied egg-rr73.0%
Final simplification47.4%
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 68.3%
Taylor expanded in y around inf 34.2%
*-commutative34.2%
Simplified34.2%
Final simplification34.2%
(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 2024084
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))