
(FPCore (x y) :precision binary64 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
double t_0 = (y * 4.0) * y;
return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = (y * 4.0d0) * y
code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
double t_0 = (y * 4.0) * y;
return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y): t_0 = (y * 4.0) * y return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y) t_0 = Float64(Float64(y * 4.0) * y) return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0)) end
function tmp = code(x, y) t_0 = (y * 4.0) * y; tmp = ((x * x) - t_0) / ((x * x) + t_0); end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t\_0}{x \cdot x + t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
double t_0 = (y * 4.0) * y;
return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = (y * 4.0d0) * y
code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
double t_0 = (y * 4.0) * y;
return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y): t_0 = (y * 4.0) * y return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y) t_0 = Float64(Float64(y * 4.0) * y) return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0)) end
function tmp = code(x, y) t_0 = (y * 4.0) * y; tmp = ((x * x) - t_0) / ((x * x) + t_0); end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t\_0}{x \cdot x + t\_0}
\end{array}
\end{array}
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (let* ((t_0 (hypot x_m (* y_m 2.0)))) (/ (fma y_m -2.0 x_m) (* t_0 (/ t_0 (fma y_m 2.0 x_m))))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = hypot(x_m, (y_m * 2.0));
return fma(y_m, -2.0, x_m) / (t_0 * (t_0 / fma(y_m, 2.0, x_m)));
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = hypot(x_m, Float64(y_m * 2.0)) return Float64(fma(y_m, -2.0, x_m) / Float64(t_0 * Float64(t_0 / fma(y_m, 2.0, x_m)))) end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[Sqrt[x$95$m ^ 2 + N[(y$95$m * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(y$95$m * -2.0 + x$95$m), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 / N[(y$95$m * 2.0 + x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x\_m, y\_m \cdot 2\right)\\
\frac{\mathsf{fma}\left(y\_m, -2, x\_m\right)}{t\_0 \cdot \frac{t\_0}{\mathsf{fma}\left(y\_m, 2, x\_m\right)}}
\end{array}
\end{array}
Initial program 52.3%
add-sqr-sqrt52.3%
difference-of-squares52.3%
*-commutative52.3%
associate-*r*52.3%
sqrt-prod52.3%
sqrt-unprod26.5%
add-sqr-sqrt39.7%
metadata-eval39.7%
*-commutative39.7%
associate-*r*39.4%
sqrt-prod39.4%
sqrt-unprod26.5%
add-sqr-sqrt52.3%
metadata-eval52.3%
Applied egg-rr52.3%
add-sqr-sqrt52.3%
times-frac53.4%
+-commutative53.4%
fma-define53.4%
add-sqr-sqrt53.4%
hypot-define53.4%
*-commutative53.4%
sqrt-prod26.7%
sqrt-prod26.7%
metadata-eval26.7%
associate-*l*26.7%
add-sqr-sqrt53.4%
Applied egg-rr99.5%
*-commutative99.5%
clear-num99.6%
frac-times99.6%
*-commutative99.6%
*-un-lft-identity99.6%
Applied egg-rr99.6%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (let* ((t_0 (hypot x_m (* y_m 2.0)))) (* (/ (fma y_m 2.0 x_m) t_0) (/ (fma y_m -2.0 x_m) t_0))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = hypot(x_m, (y_m * 2.0));
return (fma(y_m, 2.0, x_m) / t_0) * (fma(y_m, -2.0, x_m) / t_0);
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = hypot(x_m, Float64(y_m * 2.0)) return Float64(Float64(fma(y_m, 2.0, x_m) / t_0) * Float64(fma(y_m, -2.0, x_m) / t_0)) end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[Sqrt[x$95$m ^ 2 + N[(y$95$m * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y$95$m * 2.0 + x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(y$95$m * -2.0 + x$95$m), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x\_m, y\_m \cdot 2\right)\\
\frac{\mathsf{fma}\left(y\_m, 2, x\_m\right)}{t\_0} \cdot \frac{\mathsf{fma}\left(y\_m, -2, x\_m\right)}{t\_0}
\end{array}
\end{array}
Initial program 52.3%
add-sqr-sqrt52.3%
difference-of-squares52.3%
*-commutative52.3%
associate-*r*52.3%
sqrt-prod52.3%
sqrt-unprod26.5%
add-sqr-sqrt39.7%
metadata-eval39.7%
*-commutative39.7%
associate-*r*39.4%
sqrt-prod39.4%
sqrt-unprod26.5%
add-sqr-sqrt52.3%
metadata-eval52.3%
Applied egg-rr52.3%
add-sqr-sqrt52.3%
times-frac53.4%
+-commutative53.4%
fma-define53.4%
add-sqr-sqrt53.4%
hypot-define53.4%
*-commutative53.4%
sqrt-prod26.7%
sqrt-prod26.7%
metadata-eval26.7%
associate-*l*26.7%
add-sqr-sqrt53.4%
Applied egg-rr99.5%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (pow (* 0.5 (/ x_m y_m)) 2.0)))
(if (<= t_0 0.0)
(*
(/ (fma y_m 2.0 x_m) (hypot x_m (* y_m 2.0)))
(+ 1.0 (/ (* y_m -2.0) x_m)))
(if (<= t_0 5e+182)
(/ (* (+ x_m (* y_m 2.0)) (- x_m (* y_m 2.0))) (+ t_0 (* x_m x_m)))
(+ t_1 (+ (+ (/ 0.0 y_m) t_1) -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = pow((0.5 * (x_m / y_m)), 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (fma(y_m, 2.0, x_m) / hypot(x_m, (y_m * 2.0))) * (1.0 + ((y_m * -2.0) / x_m));
} else if (t_0 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_0 + (x_m * x_m));
} else {
tmp = t_1 + (((0.0 / y_m) + t_1) + -1.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(y_m * Float64(y_m * 4.0)) t_1 = Float64(0.5 * Float64(x_m / y_m)) ^ 2.0 tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(fma(y_m, 2.0, x_m) / hypot(x_m, Float64(y_m * 2.0))) * Float64(1.0 + Float64(Float64(y_m * -2.0) / x_m))); elseif (t_0 <= 5e+182) tmp = Float64(Float64(Float64(x_m + Float64(y_m * 2.0)) * Float64(x_m - Float64(y_m * 2.0))) / Float64(t_0 + Float64(x_m * x_m))); else tmp = Float64(t_1 + Float64(Float64(Float64(0.0 / y_m) + t_1) + -1.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(N[(y$95$m * 2.0 + x$95$m), $MachinePrecision] / N[Sqrt[x$95$m ^ 2 + N[(y$95$m * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(y$95$m * -2.0), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+182], N[(N[(N[(x$95$m + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(N[(0.0 / y$95$m), $MachinePrecision] + t$95$1), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := {\left(0.5 \cdot \frac{x\_m}{y\_m}\right)}^{2}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m, 2, x\_m\right)}{\mathsf{hypot}\left(x\_m, y\_m \cdot 2\right)} \cdot \left(1 + \frac{y\_m \cdot -2}{x\_m}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(x\_m + y\_m \cdot 2\right) \cdot \left(x\_m - y\_m \cdot 2\right)}{t\_0 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(\left(\frac{0}{y\_m} + t\_1\right) + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
Taylor expanded in y around 0 38.4%
associate-*r/38.4%
Simplified38.4%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
add-sqr-sqrt81.6%
difference-of-squares81.6%
*-commutative81.6%
associate-*r*81.6%
sqrt-prod81.6%
sqrt-unprod40.7%
add-sqr-sqrt57.7%
metadata-eval57.7%
*-commutative57.7%
associate-*r*57.0%
sqrt-prod57.0%
sqrt-unprod40.7%
add-sqr-sqrt81.6%
metadata-eval81.6%
Applied egg-rr81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
*-commutative98.8%
clear-num98.9%
frac-times98.9%
*-commutative98.9%
*-un-lft-identity98.9%
Applied egg-rr98.9%
Taylor expanded in y around inf 74.9%
associate--r+74.9%
cancel-sign-sub-inv74.9%
Simplified82.5%
Final simplification71.5%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ x_m y_m))) (t_1 (* y_m (* y_m 4.0))))
(if (<= t_1 0.0)
(*
(/ (fma y_m 2.0 x_m) (hypot x_m (* y_m 2.0)))
(+ 1.0 (/ (* y_m -2.0) x_m)))
(if (<= t_1 5e+182)
(/ (* (+ x_m (* y_m 2.0)) (- x_m (* y_m 2.0))) (+ t_1 (* x_m x_m)))
(* (+ 1.0 t_0) (+ t_0 -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double t_1 = y_m * (y_m * 4.0);
double tmp;
if (t_1 <= 0.0) {
tmp = (fma(y_m, 2.0, x_m) / hypot(x_m, (y_m * 2.0))) * (1.0 + ((y_m * -2.0) / x_m));
} else if (t_1 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m));
} else {
tmp = (1.0 + t_0) * (t_0 + -1.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(0.5 * Float64(x_m / y_m)) t_1 = Float64(y_m * Float64(y_m * 4.0)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(fma(y_m, 2.0, x_m) / hypot(x_m, Float64(y_m * 2.0))) * Float64(1.0 + Float64(Float64(y_m * -2.0) / x_m))); elseif (t_1 <= 5e+182) tmp = Float64(Float64(Float64(x_m + Float64(y_m * 2.0)) * Float64(x_m - Float64(y_m * 2.0))) / Float64(t_1 + Float64(x_m * x_m))); else tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(N[(y$95$m * 2.0 + x$95$m), $MachinePrecision] / N[Sqrt[x$95$m ^ 2 + N[(y$95$m * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(y$95$m * -2.0), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+182], N[(N[(N[(x$95$m + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x\_m}{y\_m}\\
t_1 := y\_m \cdot \left(y\_m \cdot 4\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m, 2, x\_m\right)}{\mathsf{hypot}\left(x\_m, y\_m \cdot 2\right)} \cdot \left(1 + \frac{y\_m \cdot -2}{x\_m}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(x\_m + y\_m \cdot 2\right) \cdot \left(x\_m - y\_m \cdot 2\right)}{t\_1 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
Taylor expanded in y around 0 38.4%
associate-*r/38.4%
Simplified38.4%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
add-sqr-sqrt81.6%
difference-of-squares81.6%
*-commutative81.6%
associate-*r*81.6%
sqrt-prod81.6%
sqrt-unprod40.7%
add-sqr-sqrt57.7%
metadata-eval57.7%
*-commutative57.7%
associate-*r*57.0%
sqrt-prod57.0%
sqrt-unprod40.7%
add-sqr-sqrt81.6%
metadata-eval81.6%
Applied egg-rr81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
Taylor expanded in y around inf 35.9%
Taylor expanded in y around inf 82.2%
Final simplification71.4%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ x_m y_m))) (t_1 (* y_m (* y_m 4.0))))
(if (<= t_1 0.0)
(/ (fma y_m -2.0 x_m) (+ x_m (* y_m (- (* 8.0 (/ y_m x_m)) 2.0))))
(if (<= t_1 5e+182)
(/ (* (+ x_m (* y_m 2.0)) (- x_m (* y_m 2.0))) (+ t_1 (* x_m x_m)))
(* (+ 1.0 t_0) (+ t_0 -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double t_1 = y_m * (y_m * 4.0);
double tmp;
if (t_1 <= 0.0) {
tmp = fma(y_m, -2.0, x_m) / (x_m + (y_m * ((8.0 * (y_m / x_m)) - 2.0)));
} else if (t_1 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m));
} else {
tmp = (1.0 + t_0) * (t_0 + -1.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(0.5 * Float64(x_m / y_m)) t_1 = Float64(y_m * Float64(y_m * 4.0)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(fma(y_m, -2.0, x_m) / Float64(x_m + Float64(y_m * Float64(Float64(8.0 * Float64(y_m / x_m)) - 2.0)))); elseif (t_1 <= 5e+182) tmp = Float64(Float64(Float64(x_m + Float64(y_m * 2.0)) * Float64(x_m - Float64(y_m * 2.0))) / Float64(t_1 + Float64(x_m * x_m))); else tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(y$95$m * -2.0 + x$95$m), $MachinePrecision] / N[(x$95$m + N[(y$95$m * N[(N[(8.0 * N[(y$95$m / x$95$m), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+182], N[(N[(N[(x$95$m + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x\_m}{y\_m}\\
t_1 := y\_m \cdot \left(y\_m \cdot 4\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m, -2, x\_m\right)}{x\_m + y\_m \cdot \left(8 \cdot \frac{y\_m}{x\_m} - 2\right)}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(x\_m + y\_m \cdot 2\right) \cdot \left(x\_m - y\_m \cdot 2\right)}{t\_1 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
*-commutative100.0%
clear-num100.0%
frac-times99.9%
*-commutative99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 87.6%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
add-sqr-sqrt81.6%
difference-of-squares81.6%
*-commutative81.6%
associate-*r*81.6%
sqrt-prod81.6%
sqrt-unprod40.7%
add-sqr-sqrt57.7%
metadata-eval57.7%
*-commutative57.7%
associate-*r*57.0%
sqrt-prod57.0%
sqrt-unprod40.7%
add-sqr-sqrt81.6%
metadata-eval81.6%
Applied egg-rr81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
Taylor expanded in y around inf 35.9%
Taylor expanded in y around inf 82.2%
Final simplification83.3%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (* 0.5 (/ x_m y_m))))
(if (<= t_0 0.0)
(/ (fma y_m -2.0 x_m) x_m)
(if (<= t_0 5e+182)
(/ (* (+ x_m (* y_m 2.0)) (- x_m (* y_m 2.0))) (+ t_0 (* x_m x_m)))
(* (+ 1.0 t_1) (+ t_1 -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = 0.5 * (x_m / y_m);
double tmp;
if (t_0 <= 0.0) {
tmp = fma(y_m, -2.0, x_m) / x_m;
} else if (t_0 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_0 + (x_m * x_m));
} else {
tmp = (1.0 + t_1) * (t_1 + -1.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(y_m * Float64(y_m * 4.0)) t_1 = Float64(0.5 * Float64(x_m / y_m)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(fma(y_m, -2.0, x_m) / x_m); elseif (t_0 <= 5e+182) tmp = Float64(Float64(Float64(x_m + Float64(y_m * 2.0)) * Float64(x_m - Float64(y_m * 2.0))) / Float64(t_0 + Float64(x_m * x_m))); else tmp = Float64(Float64(1.0 + t_1) * Float64(t_1 + -1.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(y$95$m * -2.0 + x$95$m), $MachinePrecision] / x$95$m), $MachinePrecision], If[LessEqual[t$95$0, 5e+182], N[(N[(N[(x$95$m + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$1), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x\_m}{y\_m}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(y\_m, -2, x\_m\right)}{x\_m}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(x\_m + y\_m \cdot 2\right) \cdot \left(x\_m - y\_m \cdot 2\right)}{t\_0 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_1\right) \cdot \left(t\_1 + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
*-commutative100.0%
clear-num100.0%
frac-times99.9%
*-commutative99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 87.5%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
add-sqr-sqrt81.6%
difference-of-squares81.6%
*-commutative81.6%
associate-*r*81.6%
sqrt-prod81.6%
sqrt-unprod40.7%
add-sqr-sqrt57.7%
metadata-eval57.7%
*-commutative57.7%
associate-*r*57.0%
sqrt-prod57.0%
sqrt-unprod40.7%
add-sqr-sqrt81.6%
metadata-eval81.6%
Applied egg-rr81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
Taylor expanded in y around inf 35.9%
Taylor expanded in y around inf 82.2%
Final simplification83.3%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ x_m y_m))) (t_1 (* y_m (* y_m 4.0))))
(if (<= t_1 0.0)
(* (+ 1.0 (/ (* y_m -2.0) x_m)) (+ 1.0 (* 2.0 (/ y_m x_m))))
(if (<= t_1 5e+182)
(/ (* (+ x_m (* y_m 2.0)) (- x_m (* y_m 2.0))) (+ t_1 (* x_m x_m)))
(* (+ 1.0 t_0) (+ t_0 -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double t_1 = y_m * (y_m * 4.0);
double tmp;
if (t_1 <= 0.0) {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
} else if (t_1 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m));
} else {
tmp = (1.0 + t_0) * (t_0 + -1.0);
}
return tmp;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.5d0 * (x_m / y_m)
t_1 = y_m * (y_m * 4.0d0)
if (t_1 <= 0.0d0) then
tmp = (1.0d0 + ((y_m * (-2.0d0)) / x_m)) * (1.0d0 + (2.0d0 * (y_m / x_m)))
else if (t_1 <= 5d+182) then
tmp = ((x_m + (y_m * 2.0d0)) * (x_m - (y_m * 2.0d0))) / (t_1 + (x_m * x_m))
else
tmp = (1.0d0 + t_0) * (t_0 + (-1.0d0))
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double t_1 = y_m * (y_m * 4.0);
double tmp;
if (t_1 <= 0.0) {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
} else if (t_1 <= 5e+182) {
tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m));
} else {
tmp = (1.0 + t_0) * (t_0 + -1.0);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): t_0 = 0.5 * (x_m / y_m) t_1 = y_m * (y_m * 4.0) tmp = 0 if t_1 <= 0.0: tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))) elif t_1 <= 5e+182: tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m)) else: tmp = (1.0 + t_0) * (t_0 + -1.0) return tmp
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(0.5 * Float64(x_m / y_m)) t_1 = Float64(y_m * Float64(y_m * 4.0)) tmp = 0.0 if (t_1 <= 0.0) tmp = Float64(Float64(1.0 + Float64(Float64(y_m * -2.0) / x_m)) * Float64(1.0 + Float64(2.0 * Float64(y_m / x_m)))); elseif (t_1 <= 5e+182) tmp = Float64(Float64(Float64(x_m + Float64(y_m * 2.0)) * Float64(x_m - Float64(y_m * 2.0))) / Float64(t_1 + Float64(x_m * x_m))); else tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)); end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) t_0 = 0.5 * (x_m / y_m); t_1 = y_m * (y_m * 4.0); tmp = 0.0; if (t_1 <= 0.0) tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))); elseif (t_1 <= 5e+182) tmp = ((x_m + (y_m * 2.0)) * (x_m - (y_m * 2.0))) / (t_1 + (x_m * x_m)); else tmp = (1.0 + t_0) * (t_0 + -1.0); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(N[(1.0 + N[(N[(y$95$m * -2.0), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+182], N[(N[(N[(x$95$m + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x\_m}{y\_m}\\
t_1 := y\_m \cdot \left(y\_m \cdot 4\right)\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;\left(1 + \frac{y\_m \cdot -2}{x\_m}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x\_m}\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{\left(x\_m + y\_m \cdot 2\right) \cdot \left(x\_m - y\_m \cdot 2\right)}{t\_1 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
Taylor expanded in y around 0 38.4%
associate-*r/38.4%
Simplified38.4%
Taylor expanded in y around 0 87.9%
*-commutative87.9%
Simplified87.9%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
add-sqr-sqrt81.6%
difference-of-squares81.6%
*-commutative81.6%
associate-*r*81.6%
sqrt-prod81.6%
sqrt-unprod40.7%
add-sqr-sqrt57.7%
metadata-eval57.7%
*-commutative57.7%
associate-*r*57.0%
sqrt-prod57.0%
sqrt-unprod40.7%
add-sqr-sqrt81.6%
metadata-eval81.6%
Applied egg-rr81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
Taylor expanded in y around inf 35.9%
Taylor expanded in y around inf 82.2%
Final simplification83.4%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (* 0.5 (/ x_m y_m))))
(if (<= t_0 0.0)
(* (+ 1.0 (/ (* y_m -2.0) x_m)) (+ 1.0 (* 2.0 (/ y_m x_m))))
(if (<= t_0 5e+182)
(/ (- (* x_m x_m) t_0) (+ t_0 (* x_m x_m)))
(* (+ 1.0 t_1) (+ t_1 -1.0))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = 0.5 * (x_m / y_m);
double tmp;
if (t_0 <= 0.0) {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
} else if (t_0 <= 5e+182) {
tmp = ((x_m * x_m) - t_0) / (t_0 + (x_m * x_m));
} else {
tmp = (1.0 + t_1) * (t_1 + -1.0);
}
return tmp;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = y_m * (y_m * 4.0d0)
t_1 = 0.5d0 * (x_m / y_m)
if (t_0 <= 0.0d0) then
tmp = (1.0d0 + ((y_m * (-2.0d0)) / x_m)) * (1.0d0 + (2.0d0 * (y_m / x_m)))
else if (t_0 <= 5d+182) then
tmp = ((x_m * x_m) - t_0) / (t_0 + (x_m * x_m))
else
tmp = (1.0d0 + t_1) * (t_1 + (-1.0d0))
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = 0.5 * (x_m / y_m);
double tmp;
if (t_0 <= 0.0) {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
} else if (t_0 <= 5e+182) {
tmp = ((x_m * x_m) - t_0) / (t_0 + (x_m * x_m));
} else {
tmp = (1.0 + t_1) * (t_1 + -1.0);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): t_0 = y_m * (y_m * 4.0) t_1 = 0.5 * (x_m / y_m) tmp = 0 if t_0 <= 0.0: tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))) elif t_0 <= 5e+182: tmp = ((x_m * x_m) - t_0) / (t_0 + (x_m * x_m)) else: tmp = (1.0 + t_1) * (t_1 + -1.0) return tmp
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(y_m * Float64(y_m * 4.0)) t_1 = Float64(0.5 * Float64(x_m / y_m)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(1.0 + Float64(Float64(y_m * -2.0) / x_m)) * Float64(1.0 + Float64(2.0 * Float64(y_m / x_m)))); elseif (t_0 <= 5e+182) tmp = Float64(Float64(Float64(x_m * x_m) - t_0) / Float64(t_0 + Float64(x_m * x_m))); else tmp = Float64(Float64(1.0 + t_1) * Float64(t_1 + -1.0)); end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) t_0 = y_m * (y_m * 4.0); t_1 = 0.5 * (x_m / y_m); tmp = 0.0; if (t_0 <= 0.0) tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))); elseif (t_0 <= 5e+182) tmp = ((x_m * x_m) - t_0) / (t_0 + (x_m * x_m)); else tmp = (1.0 + t_1) * (t_1 + -1.0); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(1.0 + N[(N[(y$95$m * -2.0), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+182], N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(t$95$0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$1), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x\_m}{y\_m}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(1 + \frac{y\_m \cdot -2}{x\_m}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x\_m}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+182}:\\
\;\;\;\;\frac{x\_m \cdot x\_m - t\_0}{t\_0 + x\_m \cdot x\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t\_1\right) \cdot \left(t\_1 + -1\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 0.0Initial program 58.1%
add-sqr-sqrt58.1%
difference-of-squares58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
*-commutative58.1%
associate-*r*58.1%
sqrt-prod58.1%
sqrt-unprod30.6%
add-sqr-sqrt58.1%
metadata-eval58.1%
Applied egg-rr58.1%
add-sqr-sqrt58.1%
times-frac58.8%
+-commutative58.8%
fma-define58.8%
add-sqr-sqrt58.8%
hypot-define58.8%
*-commutative58.8%
sqrt-prod30.6%
sqrt-prod30.6%
metadata-eval30.6%
associate-*l*30.6%
add-sqr-sqrt58.8%
Applied egg-rr100.0%
Taylor expanded in y around 0 38.4%
associate-*r/38.4%
Simplified38.4%
Taylor expanded in y around 0 87.9%
*-commutative87.9%
Simplified87.9%
if 0.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 4.99999999999999973e182Initial program 81.6%
if 4.99999999999999973e182 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) Initial program 18.8%
add-sqr-sqrt18.8%
difference-of-squares18.8%
*-commutative18.8%
associate-*r*18.8%
sqrt-prod18.8%
sqrt-unprod9.3%
add-sqr-sqrt9.5%
metadata-eval9.5%
*-commutative9.5%
associate-*r*9.5%
sqrt-prod9.5%
sqrt-unprod9.3%
add-sqr-sqrt18.8%
metadata-eval18.8%
Applied egg-rr18.8%
add-sqr-sqrt18.8%
times-frac21.3%
+-commutative21.3%
fma-define21.3%
add-sqr-sqrt21.3%
hypot-define21.3%
*-commutative21.3%
sqrt-prod10.4%
sqrt-prod10.4%
metadata-eval10.4%
associate-*l*10.4%
add-sqr-sqrt21.3%
Applied egg-rr98.8%
Taylor expanded in y around inf 35.9%
Taylor expanded in y around inf 82.2%
Final simplification83.4%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ x_m y_m))))
(if (or (<= x_m 9.2e-28) (and (not (<= x_m 1.45e+34)) (<= x_m 3.35e+47)))
(* (+ 1.0 t_0) (+ t_0 -1.0))
(* (+ 1.0 (/ (* y_m -2.0) x_m)) (+ 1.0 (* 2.0 (/ y_m x_m)))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double tmp;
if ((x_m <= 9.2e-28) || (!(x_m <= 1.45e+34) && (x_m <= 3.35e+47))) {
tmp = (1.0 + t_0) * (t_0 + -1.0);
} else {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
}
return tmp;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x_m / y_m)
if ((x_m <= 9.2d-28) .or. (.not. (x_m <= 1.45d+34)) .and. (x_m <= 3.35d+47)) then
tmp = (1.0d0 + t_0) * (t_0 + (-1.0d0))
else
tmp = (1.0d0 + ((y_m * (-2.0d0)) / x_m)) * (1.0d0 + (2.0d0 * (y_m / x_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double tmp;
if ((x_m <= 9.2e-28) || (!(x_m <= 1.45e+34) && (x_m <= 3.35e+47))) {
tmp = (1.0 + t_0) * (t_0 + -1.0);
} else {
tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m)));
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): t_0 = 0.5 * (x_m / y_m) tmp = 0 if (x_m <= 9.2e-28) or (not (x_m <= 1.45e+34) and (x_m <= 3.35e+47)): tmp = (1.0 + t_0) * (t_0 + -1.0) else: tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))) return tmp
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(0.5 * Float64(x_m / y_m)) tmp = 0.0 if ((x_m <= 9.2e-28) || (!(x_m <= 1.45e+34) && (x_m <= 3.35e+47))) tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)); else tmp = Float64(Float64(1.0 + Float64(Float64(y_m * -2.0) / x_m)) * Float64(1.0 + Float64(2.0 * Float64(y_m / x_m)))); end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) t_0 = 0.5 * (x_m / y_m); tmp = 0.0; if ((x_m <= 9.2e-28) || (~((x_m <= 1.45e+34)) && (x_m <= 3.35e+47))) tmp = (1.0 + t_0) * (t_0 + -1.0); else tmp = (1.0 + ((y_m * -2.0) / x_m)) * (1.0 + (2.0 * (y_m / x_m))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x$95$m, 9.2e-28], And[N[Not[LessEqual[x$95$m, 1.45e+34]], $MachinePrecision], LessEqual[x$95$m, 3.35e+47]]], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(N[(y$95$m * -2.0), $MachinePrecision] / x$95$m), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x\_m}{y\_m}\\
\mathbf{if}\;x\_m \leq 9.2 \cdot 10^{-28} \lor \neg \left(x\_m \leq 1.45 \cdot 10^{+34}\right) \land x\_m \leq 3.35 \cdot 10^{+47}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + \frac{y\_m \cdot -2}{x\_m}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x\_m}\right)\\
\end{array}
\end{array}
if x < 9.19999999999999942e-28 or 1.4500000000000001e34 < x < 3.34999999999999986e47Initial program 54.0%
add-sqr-sqrt54.0%
difference-of-squares54.0%
*-commutative54.0%
associate-*r*54.0%
sqrt-prod54.0%
sqrt-unprod27.7%
add-sqr-sqrt38.4%
metadata-eval38.4%
*-commutative38.4%
associate-*r*38.0%
sqrt-prod38.0%
sqrt-unprod27.7%
add-sqr-sqrt54.0%
metadata-eval54.0%
Applied egg-rr54.0%
add-sqr-sqrt54.0%
times-frac54.8%
+-commutative54.8%
fma-define54.8%
add-sqr-sqrt54.8%
hypot-define54.8%
*-commutative54.8%
sqrt-prod27.8%
sqrt-prod27.8%
metadata-eval27.8%
associate-*l*27.8%
add-sqr-sqrt54.8%
Applied egg-rr99.4%
Taylor expanded in y around inf 28.8%
Taylor expanded in y around inf 62.9%
if 9.19999999999999942e-28 < x < 1.4500000000000001e34 or 3.34999999999999986e47 < x Initial program 48.8%
add-sqr-sqrt48.8%
difference-of-squares48.8%
*-commutative48.8%
associate-*r*48.8%
sqrt-prod48.8%
sqrt-unprod23.8%
add-sqr-sqrt42.6%
metadata-eval42.6%
*-commutative42.6%
associate-*r*42.6%
sqrt-prod42.6%
sqrt-unprod23.8%
add-sqr-sqrt48.8%
metadata-eval48.8%
Applied egg-rr48.8%
add-sqr-sqrt48.8%
times-frac50.4%
+-commutative50.4%
fma-define50.4%
add-sqr-sqrt50.4%
hypot-define50.4%
*-commutative50.4%
sqrt-prod24.5%
sqrt-prod24.5%
metadata-eval24.5%
associate-*l*24.5%
add-sqr-sqrt50.4%
Applied egg-rr99.9%
Taylor expanded in y around 0 81.5%
associate-*r/81.5%
Simplified81.5%
Taylor expanded in y around 0 81.2%
*-commutative81.2%
Simplified81.2%
Final simplification68.6%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (* 0.5 (/ x_m y_m))))
(if (or (<= x_m 4e-30) (and (not (<= x_m 9.5e+33)) (<= x_m 6.8e+46)))
(* (+ 1.0 t_0) (+ t_0 -1.0))
1.0)))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double tmp;
if ((x_m <= 4e-30) || (!(x_m <= 9.5e+33) && (x_m <= 6.8e+46))) {
tmp = (1.0 + t_0) * (t_0 + -1.0);
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x_m / y_m)
if ((x_m <= 4d-30) .or. (.not. (x_m <= 9.5d+33)) .and. (x_m <= 6.8d+46)) then
tmp = (1.0d0 + t_0) * (t_0 + (-1.0d0))
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = 0.5 * (x_m / y_m);
double tmp;
if ((x_m <= 4e-30) || (!(x_m <= 9.5e+33) && (x_m <= 6.8e+46))) {
tmp = (1.0 + t_0) * (t_0 + -1.0);
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): t_0 = 0.5 * (x_m / y_m) tmp = 0 if (x_m <= 4e-30) or (not (x_m <= 9.5e+33) and (x_m <= 6.8e+46)): tmp = (1.0 + t_0) * (t_0 + -1.0) else: tmp = 1.0 return tmp
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = Float64(0.5 * Float64(x_m / y_m)) tmp = 0.0 if ((x_m <= 4e-30) || (!(x_m <= 9.5e+33) && (x_m <= 6.8e+46))) tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0)); else tmp = 1.0; end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) t_0 = 0.5 * (x_m / y_m); tmp = 0.0; if ((x_m <= 4e-30) || (~((x_m <= 9.5e+33)) && (x_m <= 6.8e+46))) tmp = (1.0 + t_0) * (t_0 + -1.0); else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x$95$m, 4e-30], And[N[Not[LessEqual[x$95$m, 9.5e+33]], $MachinePrecision], LessEqual[x$95$m, 6.8e+46]]], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x\_m}{y\_m}\\
\mathbf{if}\;x\_m \leq 4 \cdot 10^{-30} \lor \neg \left(x\_m \leq 9.5 \cdot 10^{+33}\right) \land x\_m \leq 6.8 \cdot 10^{+46}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 4e-30 or 9.5000000000000003e33 < x < 6.7999999999999996e46Initial program 54.0%
add-sqr-sqrt54.0%
difference-of-squares54.0%
*-commutative54.0%
associate-*r*54.0%
sqrt-prod54.0%
sqrt-unprod27.7%
add-sqr-sqrt38.4%
metadata-eval38.4%
*-commutative38.4%
associate-*r*38.0%
sqrt-prod38.0%
sqrt-unprod27.7%
add-sqr-sqrt54.0%
metadata-eval54.0%
Applied egg-rr54.0%
add-sqr-sqrt54.0%
times-frac54.8%
+-commutative54.8%
fma-define54.8%
add-sqr-sqrt54.8%
hypot-define54.8%
*-commutative54.8%
sqrt-prod27.8%
sqrt-prod27.8%
metadata-eval27.8%
associate-*l*27.8%
add-sqr-sqrt54.8%
Applied egg-rr99.4%
Taylor expanded in y around inf 28.8%
Taylor expanded in y around inf 62.9%
if 4e-30 < x < 9.5000000000000003e33 or 6.7999999999999996e46 < x Initial program 48.8%
Taylor expanded in x around inf 80.3%
Final simplification68.3%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= x_m 4e-30) -1.0 (if (<= x_m 1.55e+34) 1.0 (if (<= x_m 5e+45) -1.0 1.0))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double tmp;
if (x_m <= 4e-30) {
tmp = -1.0;
} else if (x_m <= 1.55e+34) {
tmp = 1.0;
} else if (x_m <= 5e+45) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: tmp
if (x_m <= 4d-30) then
tmp = -1.0d0
else if (x_m <= 1.55d+34) then
tmp = 1.0d0
else if (x_m <= 5d+45) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double tmp;
if (x_m <= 4e-30) {
tmp = -1.0;
} else if (x_m <= 1.55e+34) {
tmp = 1.0;
} else if (x_m <= 5e+45) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): tmp = 0 if x_m <= 4e-30: tmp = -1.0 elif x_m <= 1.55e+34: tmp = 1.0 elif x_m <= 5e+45: tmp = -1.0 else: tmp = 1.0 return tmp
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) tmp = 0.0 if (x_m <= 4e-30) tmp = -1.0; elseif (x_m <= 1.55e+34) tmp = 1.0; elseif (x_m <= 5e+45) tmp = -1.0; else tmp = 1.0; end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) tmp = 0.0; if (x_m <= 4e-30) tmp = -1.0; elseif (x_m <= 1.55e+34) tmp = 1.0; elseif (x_m <= 5e+45) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := If[LessEqual[x$95$m, 4e-30], -1.0, If[LessEqual[x$95$m, 1.55e+34], 1.0, If[LessEqual[x$95$m, 5e+45], -1.0, 1.0]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 4 \cdot 10^{-30}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x\_m \leq 1.55 \cdot 10^{+34}:\\
\;\;\;\;1\\
\mathbf{elif}\;x\_m \leq 5 \cdot 10^{+45}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 4e-30 or 1.54999999999999989e34 < x < 5e45Initial program 54.0%
Taylor expanded in x around 0 61.8%
if 4e-30 < x < 1.54999999999999989e34 or 5e45 < x Initial program 48.8%
Taylor expanded in x around inf 80.3%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 -1.0)
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return -1.0;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
code = -1.0d0
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
return -1.0;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return -1.0
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return -1.0 end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = -1.0; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := -1.0
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
-1
\end{array}
Initial program 52.3%
Taylor expanded in x around 0 49.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* y y) 4.0))
(t_1 (+ (* x x) t_0))
(t_2 (/ t_0 t_1))
(t_3 (* (* y 4.0) y)))
(if (< (/ (- (* x x) t_3) (+ (* x x) t_3)) 0.9743233849626781)
(- (/ (* x x) t_1) t_2)
(- (pow (/ x (sqrt t_1)) 2.0) t_2))))
double code(double x, double y) {
double t_0 = (y * y) * 4.0;
double t_1 = (x * x) + t_0;
double t_2 = t_0 / t_1;
double t_3 = (y * 4.0) * y;
double tmp;
if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
tmp = ((x * x) / t_1) - t_2;
} else {
tmp = pow((x / sqrt(t_1)), 2.0) - t_2;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (y * y) * 4.0d0
t_1 = (x * x) + t_0
t_2 = t_0 / t_1
t_3 = (y * 4.0d0) * y
if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781d0) then
tmp = ((x * x) / t_1) - t_2
else
tmp = ((x / sqrt(t_1)) ** 2.0d0) - t_2
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y * y) * 4.0;
double t_1 = (x * x) + t_0;
double t_2 = t_0 / t_1;
double t_3 = (y * 4.0) * y;
double tmp;
if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
tmp = ((x * x) / t_1) - t_2;
} else {
tmp = Math.pow((x / Math.sqrt(t_1)), 2.0) - t_2;
}
return tmp;
}
def code(x, y): t_0 = (y * y) * 4.0 t_1 = (x * x) + t_0 t_2 = t_0 / t_1 t_3 = (y * 4.0) * y tmp = 0 if (((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781: tmp = ((x * x) / t_1) - t_2 else: tmp = math.pow((x / math.sqrt(t_1)), 2.0) - t_2 return tmp
function code(x, y) t_0 = Float64(Float64(y * y) * 4.0) t_1 = Float64(Float64(x * x) + t_0) t_2 = Float64(t_0 / t_1) t_3 = Float64(Float64(y * 4.0) * y) tmp = 0.0 if (Float64(Float64(Float64(x * x) - t_3) / Float64(Float64(x * x) + t_3)) < 0.9743233849626781) tmp = Float64(Float64(Float64(x * x) / t_1) - t_2); else tmp = Float64((Float64(x / sqrt(t_1)) ^ 2.0) - t_2); end return tmp end
function tmp_2 = code(x, y) t_0 = (y * y) * 4.0; t_1 = (x * x) + t_0; t_2 = t_0 / t_1; t_3 = (y * 4.0) * y; tmp = 0.0; if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) tmp = ((x * x) / t_1) - t_2; else tmp = ((x / sqrt(t_1)) ^ 2.0) - t_2; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[Less[N[(N[(N[(x * x), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], 0.9743233849626781], N[(N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[Power[N[(x / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot 4\\
t_1 := x \cdot x + t\_0\\
t_2 := \frac{t\_0}{t\_1}\\
t_3 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;\frac{x \cdot x - t\_3}{x \cdot x + t\_3} < 0.9743233849626781:\\
\;\;\;\;\frac{x \cdot x}{t\_1} - t\_2\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{\sqrt{t\_1}}\right)}^{2} - t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024089
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))
(/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))