
(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 11 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}
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (let* ((t_0 (hypot x (* y 2.0)))) (/ (fma y 2.0 x) (* t_0 (/ t_0 (fma y -2.0 x))))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = hypot(x, (y * 2.0));
return fma(y, 2.0, x) / (t_0 * (t_0 / fma(y, -2.0, x)));
}
x = abs(x) y = abs(y) function code(x, y) t_0 = hypot(x, Float64(y * 2.0)) return Float64(fma(y, 2.0, x) / Float64(t_0 * Float64(t_0 / fma(y, -2.0, x)))) end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(y * 2.0 + x), $MachinePrecision] / N[(t$95$0 * N[(t$95$0 / N[(y * -2.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\mathsf{fma}\left(y, 2, x\right)}{t_0 \cdot \frac{t_0}{\mathsf{fma}\left(y, -2, x\right)}}
\end{array}
\end{array}
Initial program 53.1%
add-sqr-sqrt53.1%
difference-of-squares53.1%
*-commutative53.1%
associate-*r*53.1%
sqrt-prod53.1%
sqrt-prod26.0%
add-sqr-sqrt39.0%
metadata-eval39.0%
*-commutative39.0%
associate-*r*39.0%
sqrt-prod39.0%
sqrt-prod26.0%
add-sqr-sqrt53.1%
metadata-eval53.1%
Applied egg-rr53.1%
add-sqr-sqrt53.1%
times-frac54.4%
+-commutative54.4%
fma-def54.4%
add-sqr-sqrt54.4%
hypot-def54.5%
*-commutative54.5%
sqrt-prod26.7%
sqrt-prod26.7%
metadata-eval26.7%
associate-*l*26.7%
add-sqr-sqrt54.5%
Applied egg-rr99.9%
add-cbrt-cube100.0%
Applied egg-rr100.0%
associate-*l*100.0%
cube-unmult100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-commutative100.0%
Simplified100.0%
rem-cbrt-cube99.9%
*-commutative99.9%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
+-commutative100.0%
fma-def100.0%
Applied egg-rr100.0%
Final simplification100.0%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (let* ((t_0 (hypot x (* y 2.0)))) (* (/ (fma y 2.0 x) t_0) (/ (- x (* y 2.0)) t_0))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = hypot(x, (y * 2.0));
return (fma(y, 2.0, x) / t_0) * ((x - (y * 2.0)) / t_0);
}
x = abs(x) y = abs(y) function code(x, y) t_0 = hypot(x, Float64(y * 2.0)) return Float64(Float64(fma(y, 2.0, x) / t_0) * Float64(Float64(x - Float64(y * 2.0)) / t_0)) end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\mathsf{fma}\left(y, 2, x\right)}{t_0} \cdot \frac{x - y \cdot 2}{t_0}
\end{array}
\end{array}
Initial program 53.1%
add-sqr-sqrt53.1%
difference-of-squares53.1%
*-commutative53.1%
associate-*r*53.1%
sqrt-prod53.1%
sqrt-prod26.0%
add-sqr-sqrt39.0%
metadata-eval39.0%
*-commutative39.0%
associate-*r*39.0%
sqrt-prod39.0%
sqrt-prod26.0%
add-sqr-sqrt53.1%
metadata-eval53.1%
Applied egg-rr53.1%
add-sqr-sqrt53.1%
times-frac54.4%
+-commutative54.4%
fma-def54.4%
add-sqr-sqrt54.4%
hypot-def54.5%
*-commutative54.5%
sqrt-prod26.7%
sqrt-prod26.7%
metadata-eval26.7%
associate-*l*26.7%
add-sqr-sqrt54.5%
Applied egg-rr99.9%
Final simplification99.9%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (let* ((t_0 (hypot x (* y 2.0)))) (/ (* (/ (fma y 2.0 x) t_0) (- x (* y 2.0))) t_0)))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = hypot(x, (y * 2.0));
return ((fma(y, 2.0, x) / t_0) * (x - (y * 2.0))) / t_0;
}
x = abs(x) y = abs(y) function code(x, y) t_0 = hypot(x, Float64(y * 2.0)) return Float64(Float64(Float64(fma(y, 2.0, x) / t_0) * Float64(x - Float64(y * 2.0))) / t_0) end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\frac{\mathsf{fma}\left(y, 2, x\right)}{t_0} \cdot \left(x - y \cdot 2\right)}{t_0}
\end{array}
\end{array}
Initial program 53.1%
add-sqr-sqrt53.1%
difference-of-squares53.1%
*-commutative53.1%
associate-*r*53.1%
sqrt-prod53.1%
sqrt-prod26.0%
add-sqr-sqrt39.0%
metadata-eval39.0%
*-commutative39.0%
associate-*r*39.0%
sqrt-prod39.0%
sqrt-prod26.0%
add-sqr-sqrt53.1%
metadata-eval53.1%
Applied egg-rr53.1%
add-sqr-sqrt53.1%
times-frac54.4%
+-commutative54.4%
fma-def54.4%
add-sqr-sqrt54.4%
hypot-def54.5%
*-commutative54.5%
sqrt-prod26.7%
sqrt-prod26.7%
metadata-eval26.7%
associate-*l*26.7%
add-sqr-sqrt54.5%
Applied egg-rr99.9%
associate-*r/100.0%
Applied egg-rr100.0%
Final simplification100.0%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ y x))))
(if (<= (* x x) 2e-267)
(fma 0.5 (* (/ x y) (/ x y)) -1.0)
(if (<= (* x x) 2e+261)
(/ (fma y 2.0 x) (/ (fma x x (* (* y y) 4.0)) (- x (* y 2.0))))
(+ (* -4.0 t_0) (fma -4.0 t_0 1.0))))))x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = (y / x) * (y / x);
double tmp;
if ((x * x) <= 2e-267) {
tmp = fma(0.5, ((x / y) * (x / y)), -1.0);
} else if ((x * x) <= 2e+261) {
tmp = fma(y, 2.0, x) / (fma(x, x, ((y * y) * 4.0)) / (x - (y * 2.0)));
} else {
tmp = (-4.0 * t_0) + fma(-4.0, t_0, 1.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) t_0 = Float64(Float64(y / x) * Float64(y / x)) tmp = 0.0 if (Float64(x * x) <= 2e-267) tmp = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -1.0); elseif (Float64(x * x) <= 2e+261) tmp = Float64(fma(y, 2.0, x) / Float64(fma(x, x, Float64(Float64(y * y) * 4.0)) / Float64(x - Float64(y * 2.0)))); else tmp = Float64(Float64(-4.0 * t_0) + fma(-4.0, t_0, 1.0)); end return tmp end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 2e-267], N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+261], N[(N[(y * 2.0 + x), $MachinePrecision] / N[(N[(x * x + N[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision] / N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * t$95$0), $MachinePrecision] + N[(-4.0 * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{y}{x}\\
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{-267}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+261}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right) \cdot 4\right)}{x - y \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot t_0 + \mathsf{fma}\left(-4, t_0, 1\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 2e-267Initial program 57.5%
Taylor expanded in x around 0 76.8%
fma-neg76.8%
unpow276.8%
unpow276.8%
times-frac87.3%
metadata-eval87.3%
Simplified87.3%
if 2e-267 < (*.f64 x x) < 1.9999999999999999e261Initial program 82.8%
add-sqr-sqrt82.8%
difference-of-squares82.8%
*-commutative82.8%
associate-*r*82.8%
sqrt-prod82.8%
sqrt-prod42.7%
add-sqr-sqrt71.8%
metadata-eval71.8%
*-commutative71.8%
associate-*r*71.8%
sqrt-prod71.8%
sqrt-prod42.7%
add-sqr-sqrt82.8%
metadata-eval82.8%
Applied egg-rr82.8%
add-sqr-sqrt82.8%
times-frac83.3%
+-commutative83.3%
fma-def83.3%
add-sqr-sqrt83.3%
hypot-def83.3%
*-commutative83.3%
sqrt-prod43.0%
sqrt-prod43.0%
metadata-eval43.0%
associate-*l*43.0%
add-sqr-sqrt83.3%
Applied egg-rr99.9%
expm1-log1p-u99.9%
expm1-udef99.9%
frac-times82.8%
hypot-udef82.8%
hypot-udef82.8%
add-sqr-sqrt82.8%
fma-def82.8%
Applied egg-rr82.8%
expm1-def82.8%
expm1-log1p82.8%
associate-/l*83.3%
swap-sqr83.3%
metadata-eval83.3%
Simplified83.3%
if 1.9999999999999999e261 < (*.f64 x x) Initial program 9.0%
add-sqr-sqrt9.0%
difference-of-squares9.0%
*-commutative9.0%
associate-*r*9.0%
sqrt-prod9.0%
sqrt-prod6.4%
add-sqr-sqrt9.0%
metadata-eval9.0%
*-commutative9.0%
associate-*r*9.0%
sqrt-prod9.0%
sqrt-prod6.4%
add-sqr-sqrt9.0%
metadata-eval9.0%
Applied egg-rr9.0%
Taylor expanded in x around inf 78.4%
cancel-sign-sub-inv78.4%
metadata-eval78.4%
+-commutative78.4%
unpow278.4%
unpow278.4%
times-frac78.4%
unpow278.4%
associate-+r+78.4%
distribute-rgt-out78.4%
metadata-eval78.4%
mul0-rgt78.4%
associate-+r+78.4%
metadata-eval78.4%
Simplified92.1%
unpow292.1%
Applied egg-rr92.1%
unpow292.1%
Applied egg-rr92.1%
Final simplification87.1%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ y x) (/ y x))))
(if (<= (* x x) 5e-281)
(fma 0.5 (* (/ x y) (/ x y)) -1.0)
(if (<= (* x x) 2e+261)
(/ (* (- x (* y 2.0)) (+ x (* y 2.0))) (+ (* x x) (* y (* y 4.0))))
(+ (* -4.0 t_0) (fma -4.0 t_0 1.0))))))x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = (y / x) * (y / x);
double tmp;
if ((x * x) <= 5e-281) {
tmp = fma(0.5, ((x / y) * (x / y)), -1.0);
} else if ((x * x) <= 2e+261) {
tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0)));
} else {
tmp = (-4.0 * t_0) + fma(-4.0, t_0, 1.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) t_0 = Float64(Float64(y / x) * Float64(y / x)) tmp = 0.0 if (Float64(x * x) <= 5e-281) tmp = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -1.0); elseif (Float64(x * x) <= 2e+261) tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) * Float64(x + Float64(y * 2.0))) / Float64(Float64(x * x) + Float64(y * Float64(y * 4.0)))); else tmp = Float64(Float64(-4.0 * t_0) + fma(-4.0, t_0, 1.0)); end return tmp end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-281], N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 2e+261], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * t$95$0), $MachinePrecision] + N[(-4.0 * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := \frac{y}{x} \cdot \frac{y}{x}\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-281}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+261}:\\
\;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot t_0 + \mathsf{fma}\left(-4, t_0, 1\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 4.9999999999999998e-281Initial program 55.7%
Taylor expanded in x around 0 75.8%
fma-neg75.8%
unpow275.8%
unpow275.8%
times-frac86.8%
metadata-eval86.8%
Simplified86.8%
if 4.9999999999999998e-281 < (*.f64 x x) < 1.9999999999999999e261Initial program 83.3%
add-sqr-sqrt83.3%
difference-of-squares83.3%
*-commutative83.3%
associate-*r*83.3%
sqrt-prod83.3%
sqrt-prod42.4%
add-sqr-sqrt70.8%
metadata-eval70.8%
*-commutative70.8%
associate-*r*70.8%
sqrt-prod70.8%
sqrt-prod42.4%
add-sqr-sqrt83.3%
metadata-eval83.3%
Applied egg-rr83.3%
if 1.9999999999999999e261 < (*.f64 x x) Initial program 9.0%
add-sqr-sqrt9.0%
difference-of-squares9.0%
*-commutative9.0%
associate-*r*9.0%
sqrt-prod9.0%
sqrt-prod6.4%
add-sqr-sqrt9.0%
metadata-eval9.0%
*-commutative9.0%
associate-*r*9.0%
sqrt-prod9.0%
sqrt-prod6.4%
add-sqr-sqrt9.0%
metadata-eval9.0%
Applied egg-rr9.0%
Taylor expanded in x around inf 78.4%
cancel-sign-sub-inv78.4%
metadata-eval78.4%
+-commutative78.4%
unpow278.4%
unpow278.4%
times-frac78.4%
unpow278.4%
associate-+r+78.4%
distribute-rgt-out78.4%
metadata-eval78.4%
mul0-rgt78.4%
associate-+r+78.4%
metadata-eval78.4%
Simplified92.1%
unpow292.1%
Applied egg-rr92.1%
unpow292.1%
Applied egg-rr92.1%
Final simplification86.9%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= x 6.5e-141)
(fma 0.5 (* (/ x y) (/ x y)) -1.0)
(if (<= x 1.7e+131)
(/ (* (- x (* y 2.0)) (+ x (* y 2.0))) (+ (* x x) (* y (* y 4.0))))
(+ 1.0 (* (* (/ y x) (/ y x)) -8.0)))))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if (x <= 6.5e-141) {
tmp = fma(0.5, ((x / y) * (x / y)), -1.0);
} else if (x <= 1.7e+131) {
tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0)));
} else {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (x <= 6.5e-141) tmp = fma(0.5, Float64(Float64(x / y) * Float64(x / y)), -1.0); elseif (x <= 1.7e+131) tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) * Float64(x + Float64(y * 2.0))) / Float64(Float64(x * x) + Float64(y * Float64(y * 4.0)))); else tmp = Float64(1.0 + Float64(Float64(Float64(y / x) * Float64(y / x)) * -8.0)); end return tmp end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[x, 6.5e-141], N[(0.5 * N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], If[LessEqual[x, 1.7e+131], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{-141}:\\
\;\;\;\;\mathsf{fma}\left(0.5, \frac{x}{y} \cdot \frac{x}{y}, -1\right)\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{+131}:\\
\;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot -8\\
\end{array}
\end{array}
if x < 6.4999999999999995e-141Initial program 51.2%
Taylor expanded in x around 0 48.8%
fma-neg48.8%
unpow248.8%
unpow248.8%
times-frac54.6%
metadata-eval54.6%
Simplified54.6%
if 6.4999999999999995e-141 < x < 1.69999999999999993e131Initial program 81.3%
add-sqr-sqrt81.3%
difference-of-squares81.4%
*-commutative81.4%
associate-*r*81.4%
sqrt-prod81.4%
sqrt-prod42.3%
add-sqr-sqrt66.2%
metadata-eval66.2%
*-commutative66.2%
associate-*r*66.2%
sqrt-prod66.2%
sqrt-prod42.3%
add-sqr-sqrt81.4%
metadata-eval81.4%
Applied egg-rr81.4%
if 1.69999999999999993e131 < x Initial program 16.2%
Taylor expanded in x around inf 75.7%
associate--l+75.7%
Simplified75.7%
Taylor expanded in y around 0 84.0%
unpow284.0%
unpow284.0%
times-frac92.3%
unpow292.3%
Simplified92.3%
unpow292.3%
Applied egg-rr92.3%
Final simplification66.2%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (* y 4.0))))
(if (<= (* x x) 5e-281)
-1.0
(if (<= (* x x) 2e+261)
(/ (- (* x x) t_0) (+ (* x x) t_0))
(+ 1.0 (* (* (/ y x) (/ y x)) -8.0))))))x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = y * (y * 4.0);
double tmp;
if ((x * x) <= 5e-281) {
tmp = -1.0;
} else if ((x * x) <= 2e+261) {
tmp = ((x * x) - t_0) / ((x * x) + t_0);
} else {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y * (y * 4.0d0)
if ((x * x) <= 5d-281) then
tmp = -1.0d0
else if ((x * x) <= 2d+261) then
tmp = ((x * x) - t_0) / ((x * x) + t_0)
else
tmp = 1.0d0 + (((y / x) * (y / x)) * (-8.0d0))
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double t_0 = y * (y * 4.0);
double tmp;
if ((x * x) <= 5e-281) {
tmp = -1.0;
} else if ((x * x) <= 2e+261) {
tmp = ((x * x) - t_0) / ((x * x) + t_0);
} else {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): t_0 = y * (y * 4.0) tmp = 0 if (x * x) <= 5e-281: tmp = -1.0 elif (x * x) <= 2e+261: tmp = ((x * x) - t_0) / ((x * x) + t_0) else: tmp = 1.0 + (((y / x) * (y / x)) * -8.0) return tmp
x = abs(x) y = abs(y) function code(x, y) t_0 = Float64(y * Float64(y * 4.0)) tmp = 0.0 if (Float64(x * x) <= 5e-281) tmp = -1.0; elseif (Float64(x * x) <= 2e+261) tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0)); else tmp = Float64(1.0 + Float64(Float64(Float64(y / x) * Float64(y / x)) * -8.0)); end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) t_0 = y * (y * 4.0); tmp = 0.0; if ((x * x) <= 5e-281) tmp = -1.0; elseif ((x * x) <= 2e+261) tmp = ((x * x) - t_0) / ((x * x) + t_0); else tmp = 1.0 + (((y / x) * (y / x)) * -8.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 5e-281], -1.0, If[LessEqual[N[(x * x), $MachinePrecision], 2e+261], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-281}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{+261}:\\
\;\;\;\;\frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot -8\\
\end{array}
\end{array}
if (*.f64 x x) < 4.9999999999999998e-281Initial program 55.7%
Taylor expanded in x around 0 85.9%
if 4.9999999999999998e-281 < (*.f64 x x) < 1.9999999999999999e261Initial program 83.3%
if 1.9999999999999999e261 < (*.f64 x x) Initial program 9.0%
Taylor expanded in x around inf 69.2%
associate--l+69.2%
Simplified69.2%
Taylor expanded in y around 0 78.4%
unpow278.4%
unpow278.4%
times-frac92.1%
unpow292.1%
Simplified92.1%
unpow292.1%
Applied egg-rr92.1%
Final simplification86.7%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= x 6.5e-141)
-1.0
(if (<= x 4.6e+130)
(/ (* (- x (* y 2.0)) (+ x (* y 2.0))) (+ (* x x) (* y (* y 4.0))))
(+ 1.0 (* (* (/ y x) (/ y x)) -8.0)))))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if (x <= 6.5e-141) {
tmp = -1.0;
} else if (x <= 4.6e+130) {
tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0)));
} else {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6.5d-141) then
tmp = -1.0d0
else if (x <= 4.6d+130) then
tmp = ((x - (y * 2.0d0)) * (x + (y * 2.0d0))) / ((x * x) + (y * (y * 4.0d0)))
else
tmp = 1.0d0 + (((y / x) * (y / x)) * (-8.0d0))
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (x <= 6.5e-141) {
tmp = -1.0;
} else if (x <= 4.6e+130) {
tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0)));
} else {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): tmp = 0 if x <= 6.5e-141: tmp = -1.0 elif x <= 4.6e+130: tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0))) else: tmp = 1.0 + (((y / x) * (y / x)) * -8.0) return tmp
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (x <= 6.5e-141) tmp = -1.0; elseif (x <= 4.6e+130) tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) * Float64(x + Float64(y * 2.0))) / Float64(Float64(x * x) + Float64(y * Float64(y * 4.0)))); else tmp = Float64(1.0 + Float64(Float64(Float64(y / x) * Float64(y / x)) * -8.0)); end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.5e-141) tmp = -1.0; elseif (x <= 4.6e+130) tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((x * x) + (y * (y * 4.0))); else tmp = 1.0 + (((y / x) * (y / x)) * -8.0); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[x, 6.5e-141], -1.0, If[LessEqual[x, 4.6e+130], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{-141}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+130}:\\
\;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{x \cdot x + y \cdot \left(y \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot -8\\
\end{array}
\end{array}
if x < 6.4999999999999995e-141Initial program 51.2%
Taylor expanded in x around 0 52.9%
if 6.4999999999999995e-141 < x < 4.60000000000000042e130Initial program 81.3%
add-sqr-sqrt81.3%
difference-of-squares81.4%
*-commutative81.4%
associate-*r*81.4%
sqrt-prod81.4%
sqrt-prod42.3%
add-sqr-sqrt66.2%
metadata-eval66.2%
*-commutative66.2%
associate-*r*66.2%
sqrt-prod66.2%
sqrt-prod42.3%
add-sqr-sqrt81.4%
metadata-eval81.4%
Applied egg-rr81.4%
if 4.60000000000000042e130 < x Initial program 16.2%
Taylor expanded in x around inf 75.7%
associate--l+75.7%
Simplified75.7%
Taylor expanded in y around 0 84.0%
unpow284.0%
unpow284.0%
times-frac92.3%
unpow292.3%
Simplified92.3%
unpow292.3%
Applied egg-rr92.3%
Final simplification65.1%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= (* x x) 1e-163)
-1.0
(if (or (<= (* x x) 2e-28) (not (<= (* x x) 1e+37)))
(+ 1.0 (* (* (/ y x) (/ y x)) -8.0))
-1.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x * x) <= 1e-163) {
tmp = -1.0;
} else if (((x * x) <= 2e-28) || !((x * x) <= 1e+37)) {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
} else {
tmp = -1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x * x) <= 1d-163) then
tmp = -1.0d0
else if (((x * x) <= 2d-28) .or. (.not. ((x * x) <= 1d+37))) then
tmp = 1.0d0 + (((y / x) * (y / x)) * (-8.0d0))
else
tmp = -1.0d0
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x * x) <= 1e-163) {
tmp = -1.0;
} else if (((x * x) <= 2e-28) || !((x * x) <= 1e+37)) {
tmp = 1.0 + (((y / x) * (y / x)) * -8.0);
} else {
tmp = -1.0;
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): tmp = 0 if (x * x) <= 1e-163: tmp = -1.0 elif ((x * x) <= 2e-28) or not ((x * x) <= 1e+37): tmp = 1.0 + (((y / x) * (y / x)) * -8.0) else: tmp = -1.0 return tmp
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x * x) <= 1e-163) tmp = -1.0; elseif ((Float64(x * x) <= 2e-28) || !(Float64(x * x) <= 1e+37)) tmp = Float64(1.0 + Float64(Float64(Float64(y / x) * Float64(y / x)) * -8.0)); else tmp = -1.0; end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if ((x * x) <= 1e-163) tmp = -1.0; elseif (((x * x) <= 2e-28) || ~(((x * x) <= 1e+37))) tmp = 1.0 + (((y / x) * (y / x)) * -8.0); else tmp = -1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-163], -1.0, If[Or[LessEqual[N[(x * x), $MachinePrecision], 2e-28], N[Not[LessEqual[N[(x * x), $MachinePrecision], 1e+37]], $MachinePrecision]], N[(1.0 + N[(N[(N[(y / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision], -1.0]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-163}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \cdot x \leq 2 \cdot 10^{-28} \lor \neg \left(x \cdot x \leq 10^{+37}\right):\\
\;\;\;\;1 + \left(\frac{y}{x} \cdot \frac{y}{x}\right) \cdot -8\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999923e-164 or 1.99999999999999994e-28 < (*.f64 x x) < 9.99999999999999954e36Initial program 67.3%
Taylor expanded in x around 0 80.6%
if 9.99999999999999923e-164 < (*.f64 x x) < 1.99999999999999994e-28 or 9.99999999999999954e36 < (*.f64 x x) Initial program 43.4%
Taylor expanded in x around inf 66.5%
associate--l+66.5%
Simplified66.5%
Taylor expanded in y around 0 72.7%
unpow272.7%
unpow272.7%
times-frac79.8%
unpow279.8%
Simplified79.8%
unpow279.8%
Applied egg-rr79.8%
Final simplification80.1%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= x 6.6e-81) -1.0 (if (<= x 6e-14) 1.0 (if (<= x 3e+18) -1.0 1.0))))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if (x <= 6.6e-81) {
tmp = -1.0;
} else if (x <= 6e-14) {
tmp = 1.0;
} else if (x <= 3e+18) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6.6d-81) then
tmp = -1.0d0
else if (x <= 6d-14) then
tmp = 1.0d0
else if (x <= 3d+18) then
tmp = -1.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (x <= 6.6e-81) {
tmp = -1.0;
} else if (x <= 6e-14) {
tmp = 1.0;
} else if (x <= 3e+18) {
tmp = -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): tmp = 0 if x <= 6.6e-81: tmp = -1.0 elif x <= 6e-14: tmp = 1.0 elif x <= 3e+18: tmp = -1.0 else: tmp = 1.0 return tmp
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (x <= 6.6e-81) tmp = -1.0; elseif (x <= 6e-14) tmp = 1.0; elseif (x <= 3e+18) tmp = -1.0; else tmp = 1.0; end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.6e-81) tmp = -1.0; elseif (x <= 6e-14) tmp = 1.0; elseif (x <= 3e+18) tmp = -1.0; else tmp = 1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[x, 6.6e-81], -1.0, If[LessEqual[x, 6e-14], 1.0, If[LessEqual[x, 3e+18], -1.0, 1.0]]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.6 \cdot 10^{-81}:\\
\;\;\;\;-1\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-14}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+18}:\\
\;\;\;\;-1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 6.59999999999999975e-81 or 5.9999999999999997e-14 < x < 3e18Initial program 54.5%
Taylor expanded in x around 0 54.9%
if 6.59999999999999975e-81 < x < 5.9999999999999997e-14 or 3e18 < x Initial program 50.0%
Taylor expanded in x around inf 76.0%
Final simplification61.5%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 -1.0)
x = abs(x);
y = abs(y);
double code(double x, double y) {
return -1.0;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = -1.0d0
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
return -1.0;
}
x = abs(x) y = abs(y) def code(x, y): return -1.0
x = abs(x) y = abs(y) function code(x, y) return -1.0 end
x = abs(x) y = abs(y) function tmp = code(x, y) tmp = -1.0; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := -1.0
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
-1
\end{array}
Initial program 53.1%
Taylor expanded in x around 0 45.6%
Final simplification45.6%
(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 2023274
(FPCore (x y)
:name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(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))))