
(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 5 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}
y_m = (fabs.f64 y)
(FPCore (x y_m)
:precision binary64
(if (<= y_m 62000000000.0)
1.0
(if (or (<= y_m 3.3e+62) (not (<= y_m 4.6e+86)))
(+ (* 0.5 (/ (* x (/ x y_m)) y_m)) -1.0)
1.0)))y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (y_m <= 62000000000.0) {
tmp = 1.0;
} else if ((y_m <= 3.3e+62) || !(y_m <= 4.6e+86)) {
tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (y_m <= 62000000000.0d0) then
tmp = 1.0d0
else if ((y_m <= 3.3d+62) .or. (.not. (y_m <= 4.6d+86))) then
tmp = (0.5d0 * ((x * (x / y_m)) / y_m)) + (-1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if (y_m <= 62000000000.0) {
tmp = 1.0;
} else if ((y_m <= 3.3e+62) || !(y_m <= 4.6e+86)) {
tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0;
} else {
tmp = 1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if y_m <= 62000000000.0: tmp = 1.0 elif (y_m <= 3.3e+62) or not (y_m <= 4.6e+86): tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0 else: tmp = 1.0 return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (y_m <= 62000000000.0) tmp = 1.0; elseif ((y_m <= 3.3e+62) || !(y_m <= 4.6e+86)) tmp = Float64(Float64(0.5 * Float64(Float64(x * Float64(x / y_m)) / y_m)) + -1.0); else tmp = 1.0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (y_m <= 62000000000.0) tmp = 1.0; elseif ((y_m <= 3.3e+62) || ~((y_m <= 4.6e+86))) tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0; else tmp = 1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[y$95$m, 62000000000.0], 1.0, If[Or[LessEqual[y$95$m, 3.3e+62], N[Not[LessEqual[y$95$m, 4.6e+86]], $MachinePrecision]], N[(N[(0.5 * N[(N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision], 1.0]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 62000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y_m \leq 3.3 \cdot 10^{+62} \lor \neg \left(y_m \leq 4.6 \cdot 10^{+86}\right):\\
\;\;\;\;0.5 \cdot \frac{x \cdot \frac{x}{y_m}}{y_m} + -1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < 6.2e10 or 3.3e62 < y < 4.59999999999999979e86Initial program 56.9%
Taylor expanded in x around inf 59.1%
if 6.2e10 < y < 3.3e62 or 4.59999999999999979e86 < y Initial program 33.3%
Taylor expanded in x around 0 70.4%
Taylor expanded in x around 0 79.7%
unpow279.7%
unpow279.7%
times-frac91.1%
unpow291.1%
Simplified91.1%
pow291.1%
associate-*r/91.0%
Applied egg-rr91.0%
Final simplification65.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (/ (- (* x x) t_0) (+ (* x x) t_0)))) (if (<= t_1 2.0) t_1 (+ (* 0.5 (pow (/ x y_m) 2.0)) -1.0))))
y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
double tmp;
if (t_1 <= 2.0) {
tmp = t_1;
} else {
tmp = (0.5 * pow((x / y_m), 2.0)) + -1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
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 = ((x * x) - t_0) / ((x * x) + t_0)
if (t_1 <= 2.0d0) then
tmp = t_1
else
tmp = (0.5d0 * ((x / y_m) ** 2.0d0)) + (-1.0d0)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
double tmp;
if (t_1 <= 2.0) {
tmp = t_1;
} else {
tmp = (0.5 * Math.pow((x / y_m), 2.0)) + -1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = y_m * (y_m * 4.0) t_1 = ((x * x) - t_0) / ((x * x) + t_0) tmp = 0 if t_1 <= 2.0: tmp = t_1 else: tmp = (0.5 * math.pow((x / y_m), 2.0)) + -1.0 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(y_m * Float64(y_m * 4.0)) t_1 = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0)) tmp = 0.0 if (t_1 <= 2.0) tmp = t_1; else tmp = Float64(Float64(0.5 * (Float64(x / y_m) ^ 2.0)) + -1.0); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = y_m * (y_m * 4.0); t_1 = ((x * x) - t_0) / ((x * x) + t_0); tmp = 0.0; if (t_1 <= 2.0) tmp = t_1; else tmp = (0.5 * ((x / y_m) ^ 2.0)) + -1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2.0], t$95$1, N[(N[(0.5 * N[Power[N[(x / y$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := y_m \cdot \left(y_m \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{if}\;t_1 \leq 2:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\frac{x}{y_m}\right)}^{2} + -1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) < 2Initial program 100.0%
if 2 < (/.f64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) Initial program 0.0%
Taylor expanded in x around 0 34.1%
Taylor expanded in x around 0 40.8%
unpow240.8%
unpow240.8%
times-frac60.1%
unpow260.1%
Simplified60.1%
Final simplification80.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (/ (- (* x x) t_0) (+ (* x x) t_0)))) (if (<= t_1 2.0) t_1 (+ (* 0.5 (/ (* x (/ x y_m)) y_m)) -1.0))))
y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
double tmp;
if (t_1 <= 2.0) {
tmp = t_1;
} else {
tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
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 = ((x * x) - t_0) / ((x * x) + t_0)
if (t_1 <= 2.0d0) then
tmp = t_1
else
tmp = (0.5d0 * ((x * (x / y_m)) / y_m)) + (-1.0d0)
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = y_m * (y_m * 4.0);
double t_1 = ((x * x) - t_0) / ((x * x) + t_0);
double tmp;
if (t_1 <= 2.0) {
tmp = t_1;
} else {
tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = y_m * (y_m * 4.0) t_1 = ((x * x) - t_0) / ((x * x) + t_0) tmp = 0 if t_1 <= 2.0: tmp = t_1 else: tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(y_m * Float64(y_m * 4.0)) t_1 = Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0)) tmp = 0.0 if (t_1 <= 2.0) tmp = t_1; else tmp = Float64(Float64(0.5 * Float64(Float64(x * Float64(x / y_m)) / y_m)) + -1.0); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = y_m * (y_m * 4.0); t_1 = ((x * x) - t_0) / ((x * x) + t_0); tmp = 0.0; if (t_1 <= 2.0) tmp = t_1; else tmp = (0.5 * ((x * (x / y_m)) / y_m)) + -1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2.0], t$95$1, N[(N[(0.5 * N[(N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := y_m \cdot \left(y_m \cdot 4\right)\\
t_1 := \frac{x \cdot x - t_0}{x \cdot x + t_0}\\
\mathbf{if}\;t_1 \leq 2:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot \frac{x}{y_m}}{y_m} + -1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) < 2Initial program 100.0%
if 2 < (/.f64 (-.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y)) (+.f64 (*.f64 x x) (*.f64 (*.f64 y 4) y))) Initial program 0.0%
Taylor expanded in x around 0 34.1%
Taylor expanded in x around 0 40.8%
unpow240.8%
unpow240.8%
times-frac60.1%
unpow260.1%
Simplified60.1%
pow260.1%
associate-*r/60.0%
Applied egg-rr60.0%
Final simplification80.8%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= y_m 44000000000.0) 1.0 (if (<= y_m 2e+62) -1.0 (if (<= y_m 4.4e+86) 1.0 -1.0))))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (y_m <= 44000000000.0) {
tmp = 1.0;
} else if (y_m <= 2e+62) {
tmp = -1.0;
} else if (y_m <= 4.4e+86) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (y_m <= 44000000000.0d0) then
tmp = 1.0d0
else if (y_m <= 2d+62) then
tmp = -1.0d0
else if (y_m <= 4.4d+86) then
tmp = 1.0d0
else
tmp = -1.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if (y_m <= 44000000000.0) {
tmp = 1.0;
} else if (y_m <= 2e+62) {
tmp = -1.0;
} else if (y_m <= 4.4e+86) {
tmp = 1.0;
} else {
tmp = -1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if y_m <= 44000000000.0: tmp = 1.0 elif y_m <= 2e+62: tmp = -1.0 elif y_m <= 4.4e+86: tmp = 1.0 else: tmp = -1.0 return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (y_m <= 44000000000.0) tmp = 1.0; elseif (y_m <= 2e+62) tmp = -1.0; elseif (y_m <= 4.4e+86) tmp = 1.0; else tmp = -1.0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (y_m <= 44000000000.0) tmp = 1.0; elseif (y_m <= 2e+62) tmp = -1.0; elseif (y_m <= 4.4e+86) tmp = 1.0; else tmp = -1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[y$95$m, 44000000000.0], 1.0, If[LessEqual[y$95$m, 2e+62], -1.0, If[LessEqual[y$95$m, 4.4e+86], 1.0, -1.0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y_m \leq 44000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;y_m \leq 2 \cdot 10^{+62}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y_m \leq 4.4 \cdot 10^{+86}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if y < 4.4e10 or 2.00000000000000007e62 < y < 4.40000000000000006e86Initial program 56.9%
Taylor expanded in x around inf 59.1%
if 4.4e10 < y < 2.00000000000000007e62 or 4.40000000000000006e86 < y Initial program 33.3%
Taylor expanded in x around 0 89.3%
Final simplification65.4%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 -1.0)
y_m = fabs(y);
double code(double x, double y_m) {
return -1.0;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = -1.0d0
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return -1.0;
}
y_m = math.fabs(y) def code(x, y_m): return -1.0
y_m = abs(y) function code(x, y_m) return -1.0 end
y_m = abs(y); function tmp = code(x, y_m) tmp = -1.0; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := -1.0
\begin{array}{l}
y_m = \left|y\right|
\\
-1
\end{array}
Initial program 51.9%
Taylor expanded in x around 0 51.7%
Final simplification51.7%
(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 2023320
(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))))