
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))
double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((x * x) + (y * y)) - (z * z)) / (y * 2.0d0)
end function
public static double code(double x, double y, double z) {
return (((x * x) + (y * y)) - (z * z)) / (y * 2.0);
}
def code(x, y, z): return (((x * x) + (y * y)) - (z * z)) / (y * 2.0)
function code(x, y, z) return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) - Float64(z * z)) / Float64(y * 2.0)) end
function tmp = code(x, y, z) tmp = (((x * x) + (y * y)) - (z * z)) / (y * 2.0); end
code[x_, y_, z_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(x \cdot x + y \cdot y\right) - z \cdot z}{y \cdot 2}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 5e-37)
(/ (fma (- y_m z) (+ y_m z) (* x x)) (* y_m 2.0))
(+ (* 0.5 (/ (+ y_m z) (/ y_m (- y_m z)))) (* 0.5 (* x (/ x y_m)))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 5e-37) {
tmp = fma((y_m - z), (y_m + z), (x * x)) / (y_m * 2.0);
} else {
tmp = (0.5 * ((y_m + z) / (y_m / (y_m - z)))) + (0.5 * (x * (x / y_m)));
}
return y_s * tmp;
}
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 5e-37) tmp = Float64(fma(Float64(y_m - z), Float64(y_m + z), Float64(x * x)) / Float64(y_m * 2.0)); else tmp = Float64(Float64(0.5 * Float64(Float64(y_m + z) / Float64(y_m / Float64(y_m - z)))) + Float64(0.5 * Float64(x * Float64(x / y_m)))); end return Float64(y_s * tmp) end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 5e-37], N[(N[(N[(y$95$m - z), $MachinePrecision] * N[(y$95$m + z), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] / N[(y$95$m / N[(y$95$m - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 5 \cdot 10^{-37}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y_m - z, y_m + z, x \cdot x\right)}{y_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y_m + z}{\frac{y_m}{y_m - z}} + 0.5 \cdot \left(x \cdot \frac{x}{y_m}\right)\\
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* 0.5 (* (+ y_m z) (/ (- y_m z) y_m)))
(if (<= t_0 INFINITY)
(+ (* 0.5 (* x (/ x y_m))) (* y_m 0.5))
(/ (+ y_m z) (/ (* y_m 2.0) (- y_m z))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else if (t_0 <= ((double) INFINITY)) {
tmp = (0.5 * (x * (x / y_m))) + (y_m * 0.5);
} else {
tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
}
return y_s * tmp;
}
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = (0.5 * (x * (x / y_m))) + (y_m * 0.5);
} else {
tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)) elif t_0 <= math.inf: tmp = (0.5 * (x * (x / y_m))) + (y_m * 0.5) else: tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(0.5 * Float64(Float64(y_m + z) * Float64(Float64(y_m - z) / y_m))); elseif (t_0 <= Inf) tmp = Float64(Float64(0.5 * Float64(x * Float64(x / y_m))) + Float64(y_m * 0.5)); else tmp = Float64(Float64(y_m + z) / Float64(Float64(y_m * 2.0) / Float64(y_m - z))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)); elseif (t_0 <= Inf) tmp = (0.5 * (x * (x / y_m))) + (y_m * 0.5); else tmp = (y_m + z) / ((y_m * 2.0) / (y_m - z)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] * N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(0.5 * N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m + z), $MachinePrecision] / N[(N[(y$95$m * 2.0), $MachinePrecision] / N[(y$95$m - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;0.5 \cdot \left(\left(y_m + z\right) \cdot \frac{y_m - z}{y_m}\right)\\
\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y_m}\right) + y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m + z}{\frac{y_m \cdot 2}{y_m - z}}\\
\end{array}
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* 0.5 (* x (/ x y_m)))))
(*
y_s
(if (<= (* x x) 2e+95)
(+ (* 0.5 (/ (+ y_m z) (/ y_m (- y_m z)))) t_0)
(+ t_0 (* y_m 0.5))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = 0.5 * (x * (x / y_m));
double tmp;
if ((x * x) <= 2e+95) {
tmp = (0.5 * ((y_m + z) / (y_m / (y_m - z)))) + t_0;
} else {
tmp = t_0 + (y_m * 0.5);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 0.5d0 * (x * (x / y_m))
if ((x * x) <= 2d+95) then
tmp = (0.5d0 * ((y_m + z) / (y_m / (y_m - z)))) + t_0
else
tmp = t_0 + (y_m * 0.5d0)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = 0.5 * (x * (x / y_m));
double tmp;
if ((x * x) <= 2e+95) {
tmp = (0.5 * ((y_m + z) / (y_m / (y_m - z)))) + t_0;
} else {
tmp = t_0 + (y_m * 0.5);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = 0.5 * (x * (x / y_m)) tmp = 0 if (x * x) <= 2e+95: tmp = (0.5 * ((y_m + z) / (y_m / (y_m - z)))) + t_0 else: tmp = t_0 + (y_m * 0.5) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(0.5 * Float64(x * Float64(x / y_m))) tmp = 0.0 if (Float64(x * x) <= 2e+95) tmp = Float64(Float64(0.5 * Float64(Float64(y_m + z) / Float64(y_m / Float64(y_m - z)))) + t_0); else tmp = Float64(t_0 + Float64(y_m * 0.5)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = 0.5 * (x * (x / y_m)); tmp = 0.0; if ((x * x) <= 2e+95) tmp = (0.5 * ((y_m + z) / (y_m / (y_m - z)))) + t_0; else tmp = t_0 + (y_m * 0.5); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(0.5 * N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(x * x), $MachinePrecision], 2e+95], N[(N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] / N[(y$95$m / N[(y$95$m - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot \frac{x}{y_m}\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+95}:\\
\;\;\;\;0.5 \cdot \frac{y_m + z}{\frac{y_m}{y_m - z}} + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + y_m \cdot 0.5\\
\end{array}
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (or (<= x 7.8e-72) (and (not (<= x 1.4e+77)) (<= x 2.9e+106)))
(* y_m 0.5)
(* (/ x y_m) (/ x 2.0)))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((x <= 7.8e-72) || (!(x <= 1.4e+77) && (x <= 2.9e+106))) {
tmp = y_m * 0.5;
} else {
tmp = (x / y_m) * (x / 2.0);
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= 7.8d-72) .or. (.not. (x <= 1.4d+77)) .and. (x <= 2.9d+106)) then
tmp = y_m * 0.5d0
else
tmp = (x / y_m) * (x / 2.0d0)
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((x <= 7.8e-72) || (!(x <= 1.4e+77) && (x <= 2.9e+106))) {
tmp = y_m * 0.5;
} else {
tmp = (x / y_m) * (x / 2.0);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if (x <= 7.8e-72) or (not (x <= 1.4e+77) and (x <= 2.9e+106)): tmp = y_m * 0.5 else: tmp = (x / y_m) * (x / 2.0) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if ((x <= 7.8e-72) || (!(x <= 1.4e+77) && (x <= 2.9e+106))) tmp = Float64(y_m * 0.5); else tmp = Float64(Float64(x / y_m) * Float64(x / 2.0)); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if ((x <= 7.8e-72) || (~((x <= 1.4e+77)) && (x <= 2.9e+106))) tmp = y_m * 0.5; else tmp = (x / y_m) * (x / 2.0); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[x, 7.8e-72], And[N[Not[LessEqual[x, 1.4e+77]], $MachinePrecision], LessEqual[x, 2.9e+106]]], N[(y$95$m * 0.5), $MachinePrecision], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{-72} \lor \neg \left(x \leq 1.4 \cdot 10^{+77}\right) \land x \leq 2.9 \cdot 10^{+106}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 7.8e-72)
(* y_m 0.5)
(if (<= x 2.6e+80)
(* (/ x y_m) (/ x 2.0))
(if (<= x 3.6e+106) (* y_m 0.5) (/ x (* y_m (/ 2.0 x))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 7.8e-72) {
tmp = y_m * 0.5;
} else if (x <= 2.6e+80) {
tmp = (x / y_m) * (x / 2.0);
} else if (x <= 3.6e+106) {
tmp = y_m * 0.5;
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 7.8d-72) then
tmp = y_m * 0.5d0
else if (x <= 2.6d+80) then
tmp = (x / y_m) * (x / 2.0d0)
else if (x <= 3.6d+106) then
tmp = y_m * 0.5d0
else
tmp = x / (y_m * (2.0d0 / x))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 7.8e-72) {
tmp = y_m * 0.5;
} else if (x <= 2.6e+80) {
tmp = (x / y_m) * (x / 2.0);
} else if (x <= 3.6e+106) {
tmp = y_m * 0.5;
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 7.8e-72: tmp = y_m * 0.5 elif x <= 2.6e+80: tmp = (x / y_m) * (x / 2.0) elif x <= 3.6e+106: tmp = y_m * 0.5 else: tmp = x / (y_m * (2.0 / x)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 7.8e-72) tmp = Float64(y_m * 0.5); elseif (x <= 2.6e+80) tmp = Float64(Float64(x / y_m) * Float64(x / 2.0)); elseif (x <= 3.6e+106) tmp = Float64(y_m * 0.5); else tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 7.8e-72) tmp = y_m * 0.5; elseif (x <= 2.6e+80) tmp = (x / y_m) * (x / 2.0); elseif (x <= 3.6e+106) tmp = y_m * 0.5; else tmp = x / (y_m * (2.0 / x)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 7.8e-72], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 2.6e+80], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e+106], N[(y$95$m * 0.5), $MachinePrecision], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{-72}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+80}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{+106}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 7.2e-72)
(* y_m 0.5)
(if (<= x 3.05e+78)
(/ (* x (- x)) (* y_m -2.0))
(if (<= x 3.2e+106) (* y_m 0.5) (/ x (* y_m (/ 2.0 x))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 7.2e-72) {
tmp = y_m * 0.5;
} else if (x <= 3.05e+78) {
tmp = (x * -x) / (y_m * -2.0);
} else if (x <= 3.2e+106) {
tmp = y_m * 0.5;
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 7.2d-72) then
tmp = y_m * 0.5d0
else if (x <= 3.05d+78) then
tmp = (x * -x) / (y_m * (-2.0d0))
else if (x <= 3.2d+106) then
tmp = y_m * 0.5d0
else
tmp = x / (y_m * (2.0d0 / x))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 7.2e-72) {
tmp = y_m * 0.5;
} else if (x <= 3.05e+78) {
tmp = (x * -x) / (y_m * -2.0);
} else if (x <= 3.2e+106) {
tmp = y_m * 0.5;
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 7.2e-72: tmp = y_m * 0.5 elif x <= 3.05e+78: tmp = (x * -x) / (y_m * -2.0) elif x <= 3.2e+106: tmp = y_m * 0.5 else: tmp = x / (y_m * (2.0 / x)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 7.2e-72) tmp = Float64(y_m * 0.5); elseif (x <= 3.05e+78) tmp = Float64(Float64(x * Float64(-x)) / Float64(y_m * -2.0)); elseif (x <= 3.2e+106) tmp = Float64(y_m * 0.5); else tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 7.2e-72) tmp = y_m * 0.5; elseif (x <= 3.05e+78) tmp = (x * -x) / (y_m * -2.0); elseif (x <= 3.2e+106) tmp = y_m * 0.5; else tmp = x / (y_m * (2.0 / x)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 7.2e-72], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 3.05e+78], N[(N[(x * (-x)), $MachinePrecision] / N[(y$95$m * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.2e+106], N[(y$95$m * 0.5), $MachinePrecision], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{-72}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;x \leq 3.05 \cdot 10^{+78}:\\
\;\;\;\;\frac{x \cdot \left(-x\right)}{y_m \cdot -2}\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{+106}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\end{array}
\end{array}
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 3.1e+106)
(* 0.5 (* (+ y_m z) (/ (- y_m z) y_m)))
(/ x (* y_m (/ 2.0 x))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 3.1e+106) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 3.1d+106) then
tmp = 0.5d0 * ((y_m + z) * ((y_m - z) / y_m))
else
tmp = x / (y_m * (2.0d0 / x))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 3.1e+106) {
tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m));
} else {
tmp = x / (y_m * (2.0 / x));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 3.1e+106: tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)) else: tmp = x / (y_m * (2.0 / x)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 3.1e+106) tmp = Float64(0.5 * Float64(Float64(y_m + z) * Float64(Float64(y_m - z) / y_m))); else tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 3.1e+106) tmp = 0.5 * ((y_m + z) * ((y_m - z) / y_m)); else tmp = x / (y_m * (2.0 / x)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 3.1e+106], N[(0.5 * N[(N[(y$95$m + z), $MachinePrecision] * N[(N[(y$95$m - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 3.1 \cdot 10^{+106}:\\
\;\;\;\;0.5 \cdot \left(\left(y_m + z\right) \cdot \frac{y_m - z}{y_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\end{array}
\end{array}
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= z 8.5e+175) (* y_m 0.5) (* x (/ x (* y_m -2.0))))))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 8.5e+175) {
tmp = y_m * 0.5;
} else {
tmp = x * (x / (y_m * -2.0));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (z <= 8.5d+175) then
tmp = y_m * 0.5d0
else
tmp = x * (x / (y_m * (-2.0d0)))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (z <= 8.5e+175) {
tmp = y_m * 0.5;
} else {
tmp = x * (x / (y_m * -2.0));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if z <= 8.5e+175: tmp = y_m * 0.5 else: tmp = x * (x / (y_m * -2.0)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (z <= 8.5e+175) tmp = Float64(y_m * 0.5); else tmp = Float64(x * Float64(x / Float64(y_m * -2.0))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (z <= 8.5e+175) tmp = y_m * 0.5; else tmp = x * (x / (y_m * -2.0)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[z, 8.5e+175], N[(y$95$m * 0.5), $MachinePrecision], N[(x * N[(x / N[(y$95$m * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{+175}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{x}{y_m \cdot -2}\\
\end{array}
\end{array}
y_m = (fabs.f64 y) y_s = (copysign.f64 1 y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* y_m 0.5)))
y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m * 0.5);
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (y_m * 0.5d0)
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m * 0.5);
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m * 0.5)
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m * 0.5)) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m * 0.5); end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \left(y_m \cdot 0.5\right)
\end{array}
(FPCore (x y z) :precision binary64 (- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x))))
double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y * 0.5d0) - (((0.5d0 / y) * (z + x)) * (z - x))
end function
public static double code(double x, double y, double z) {
return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x));
}
def code(x, y, z): return (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x))
function code(x, y, z) return Float64(Float64(y * 0.5) - Float64(Float64(Float64(0.5 / y) * Float64(z + x)) * Float64(z - x))) end
function tmp = code(x, y, z) tmp = (y * 0.5) - (((0.5 / y) * (z + x)) * (z - x)); end
code[x_, y_, z_] := N[(N[(y * 0.5), $MachinePrecision] - N[(N[(N[(0.5 / y), $MachinePrecision] * N[(z + x), $MachinePrecision]), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 0.5 - \left(\frac{0.5}{y} \cdot \left(z + x\right)\right) \cdot \left(z - x\right)
\end{array}
herbie shell --seed 2024008
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:herbie-target
(- (* y 0.5) (* (* (/ 0.5 y) (+ z x)) (- z x)))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))