
(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
(let* ((t_0 (hypot (hypot x y_m) z)))
(*
y_s
(if (<= (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)) -5e+38)
(* (/ z y_m) (/ z -2.0))
(* t_0 (/ t_0 (* 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 t_0 = hypot(hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = t_0 * (t_0 / (y_m * 2.0));
}
return y_s * tmp;
}
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = Math.hypot(Math.hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = t_0 * (t_0 / (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): t_0 = math.hypot(math.hypot(x, y_m), z) tmp = 0 if ((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38: tmp = (z / y_m) * (z / -2.0) else: tmp = t_0 * (t_0 / (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) t_0 = hypot(hypot(x, y_m), z) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e+38) tmp = Float64(Float64(z / y_m) * Float64(z / -2.0)); else tmp = Float64(t_0 * Float64(t_0 / 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) t_0 = hypot(hypot(x, y_m), z); tmp = 0.0; if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) tmp = (z / y_m) * (z / -2.0); else tmp = t_0 * (t_0 / (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_] := Block[{t$95$0 = N[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e+38], N[(N[(z / y$95$m), $MachinePrecision] * N[(z / -2.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 / 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)
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(\mathsf{hypot}\left(x, y_m\right), z\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2} \leq -5 \cdot 10^{+38}:\\
\;\;\;\;\frac{z}{y_m} \cdot \frac{z}{-2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \frac{t_0}{y_m \cdot 2}\\
\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 (hypot (hypot x y_m) z)))
(*
y_s
(if (<= (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)) -5e+38)
(* (/ z y_m) (/ z -2.0))
(* t_0 (* t_0 (/ 0.5 y_m)))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = hypot(hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = t_0 * (t_0 * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double t_0 = Math.hypot(Math.hypot(x, y_m), z);
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = t_0 * (t_0 * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = math.hypot(math.hypot(x, y_m), z) tmp = 0 if ((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38: tmp = (z / y_m) * (z / -2.0) else: tmp = t_0 * (t_0 * (0.5 / y_m)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = hypot(hypot(x, y_m), z) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e+38) tmp = Float64(Float64(z / y_m) * Float64(z / -2.0)); else tmp = Float64(t_0 * Float64(t_0 * Float64(0.5 / y_m))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = hypot(hypot(x, y_m), z); tmp = 0.0; if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) tmp = (z / y_m) * (z / -2.0); else tmp = t_0 * (t_0 * (0.5 / y_m)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e+38], N[(N[(z / y$95$m), $MachinePrecision] * N[(z / -2.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(t$95$0 * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(\mathsf{hypot}\left(x, y_m\right), z\right)\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2} \leq -5 \cdot 10^{+38}:\\
\;\;\;\;\frac{z}{y_m} \cdot \frac{z}{-2}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(t_0 \cdot \frac{0.5}{y_m}\right)\\
\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 (<= (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0)) -5e+38)
(* (/ z y_m) (/ z -2.0))
(pow (* (hypot (hypot x y_m) z) (sqrt (/ 0.5 y_m))) 2.0))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = pow((hypot(hypot(x, y_m), z) * sqrt((0.5 / y_m))), 2.0);
}
return y_s * tmp;
}
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) {
tmp = (z / y_m) * (z / -2.0);
} else {
tmp = Math.pow((Math.hypot(Math.hypot(x, y_m), z) * Math.sqrt((0.5 / y_m))), 2.0);
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if ((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38: tmp = (z / y_m) * (z / -2.0) else: tmp = math.pow((math.hypot(math.hypot(x, y_m), z) * math.sqrt((0.5 / y_m))), 2.0) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) <= -5e+38) tmp = Float64(Float64(z / y_m) * Float64(z / -2.0)); else tmp = Float64(hypot(hypot(x, y_m), z) * sqrt(Float64(0.5 / y_m))) ^ 2.0; end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (((((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0)) <= -5e+38) tmp = (z / y_m) * (z / -2.0); else tmp = (hypot(hypot(x, y_m), z) * sqrt((0.5 / y_m))) ^ 2.0; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], -5e+38], N[(N[(z / y$95$m), $MachinePrecision] * N[(z / -2.0), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[Sqrt[N[Sqrt[x ^ 2 + y$95$m ^ 2], $MachinePrecision] ^ 2 + z ^ 2], $MachinePrecision] * N[Sqrt[N[(0.5 / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2} \leq -5 \cdot 10^{+38}:\\
\;\;\;\;\frac{z}{y_m} \cdot \frac{z}{-2}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(\mathsf{hypot}\left(x, y_m\right), z\right) \cdot \sqrt{\frac{0.5}{y_m}}\right)}^{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 (<= z 2.45e-224)
(* y_m 0.5)
(if (<= z 8.2e-169)
(* x (* x (/ 0.5 y_m)))
(if (<= z 1.12e-91)
(* y_m 0.5)
(if (<= z 1.9e+36)
(* (/ x y_m) (/ x 2.0))
(* (/ z y_m) (/ z -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 <= 2.45e-224) {
tmp = y_m * 0.5;
} else if (z <= 8.2e-169) {
tmp = x * (x * (0.5 / y_m));
} else if (z <= 1.12e-91) {
tmp = y_m * 0.5;
} else if (z <= 1.9e+36) {
tmp = (x / y_m) * (x / 2.0);
} else {
tmp = (z / y_m) * (z / -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 <= 2.45d-224) then
tmp = y_m * 0.5d0
else if (z <= 8.2d-169) then
tmp = x * (x * (0.5d0 / y_m))
else if (z <= 1.12d-91) then
tmp = y_m * 0.5d0
else if (z <= 1.9d+36) then
tmp = (x / y_m) * (x / 2.0d0)
else
tmp = (z / y_m) * (z / (-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 <= 2.45e-224) {
tmp = y_m * 0.5;
} else if (z <= 8.2e-169) {
tmp = x * (x * (0.5 / y_m));
} else if (z <= 1.12e-91) {
tmp = y_m * 0.5;
} else if (z <= 1.9e+36) {
tmp = (x / y_m) * (x / 2.0);
} else {
tmp = (z / y_m) * (z / -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 <= 2.45e-224: tmp = y_m * 0.5 elif z <= 8.2e-169: tmp = x * (x * (0.5 / y_m)) elif z <= 1.12e-91: tmp = y_m * 0.5 elif z <= 1.9e+36: tmp = (x / y_m) * (x / 2.0) else: tmp = (z / y_m) * (z / -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 <= 2.45e-224) tmp = Float64(y_m * 0.5); elseif (z <= 8.2e-169) tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); elseif (z <= 1.12e-91) tmp = Float64(y_m * 0.5); elseif (z <= 1.9e+36) tmp = Float64(Float64(x / y_m) * Float64(x / 2.0)); else tmp = Float64(Float64(z / y_m) * Float64(z / -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 <= 2.45e-224) tmp = y_m * 0.5; elseif (z <= 8.2e-169) tmp = x * (x * (0.5 / y_m)); elseif (z <= 1.12e-91) tmp = y_m * 0.5; elseif (z <= 1.9e+36) tmp = (x / y_m) * (x / 2.0); else tmp = (z / y_m) * (z / -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, 2.45e-224], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[z, 8.2e-169], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.12e-91], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[z, 1.9e+36], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z / y$95$m), $MachinePrecision] * N[(z / -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}\;z \leq 2.45 \cdot 10^{-224}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-169}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y_m}\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{-91}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+36}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y_m} \cdot \frac{z}{-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 (<= z 3.5e-224)
(* y_m 0.5)
(if (<= z 4.8e-167)
(/ (* x 0.5) (/ y_m x))
(if (<= z 1.1e-90)
(* y_m 0.5)
(if (<= z 1.26e+33)
(* (/ x y_m) (/ x 2.0))
(* (/ z y_m) (/ z -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 <= 3.5e-224) {
tmp = y_m * 0.5;
} else if (z <= 4.8e-167) {
tmp = (x * 0.5) / (y_m / x);
} else if (z <= 1.1e-90) {
tmp = y_m * 0.5;
} else if (z <= 1.26e+33) {
tmp = (x / y_m) * (x / 2.0);
} else {
tmp = (z / y_m) * (z / -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 <= 3.5d-224) then
tmp = y_m * 0.5d0
else if (z <= 4.8d-167) then
tmp = (x * 0.5d0) / (y_m / x)
else if (z <= 1.1d-90) then
tmp = y_m * 0.5d0
else if (z <= 1.26d+33) then
tmp = (x / y_m) * (x / 2.0d0)
else
tmp = (z / y_m) * (z / (-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 <= 3.5e-224) {
tmp = y_m * 0.5;
} else if (z <= 4.8e-167) {
tmp = (x * 0.5) / (y_m / x);
} else if (z <= 1.1e-90) {
tmp = y_m * 0.5;
} else if (z <= 1.26e+33) {
tmp = (x / y_m) * (x / 2.0);
} else {
tmp = (z / y_m) * (z / -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 <= 3.5e-224: tmp = y_m * 0.5 elif z <= 4.8e-167: tmp = (x * 0.5) / (y_m / x) elif z <= 1.1e-90: tmp = y_m * 0.5 elif z <= 1.26e+33: tmp = (x / y_m) * (x / 2.0) else: tmp = (z / y_m) * (z / -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 <= 3.5e-224) tmp = Float64(y_m * 0.5); elseif (z <= 4.8e-167) tmp = Float64(Float64(x * 0.5) / Float64(y_m / x)); elseif (z <= 1.1e-90) tmp = Float64(y_m * 0.5); elseif (z <= 1.26e+33) tmp = Float64(Float64(x / y_m) * Float64(x / 2.0)); else tmp = Float64(Float64(z / y_m) * Float64(z / -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 <= 3.5e-224) tmp = y_m * 0.5; elseif (z <= 4.8e-167) tmp = (x * 0.5) / (y_m / x); elseif (z <= 1.1e-90) tmp = y_m * 0.5; elseif (z <= 1.26e+33) tmp = (x / y_m) * (x / 2.0); else tmp = (z / y_m) * (z / -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, 3.5e-224], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[z, 4.8e-167], N[(N[(x * 0.5), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-90], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[z, 1.26e+33], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(z / y$95$m), $MachinePrecision] * N[(z / -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}\;z \leq 3.5 \cdot 10^{-224}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-167}:\\
\;\;\;\;\frac{x \cdot 0.5}{\frac{y_m}{x}}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-90}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;z \leq 1.26 \cdot 10^{+33}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{y_m} \cdot \frac{z}{-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 (or (<= x 1.2e-68) (and (not (<= x 2.9e-57)) (<= x 6.4e+47)))
(* y_m 0.5)
(* x (* x (/ 0.5 y_m))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((x <= 1.2e-68) || (!(x <= 2.9e-57) && (x <= 6.4e+47))) {
tmp = y_m * 0.5;
} else {
tmp = x * (x * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if ((x <= 1.2d-68) .or. (.not. (x <= 2.9d-57)) .and. (x <= 6.4d+47)) then
tmp = y_m * 0.5d0
else
tmp = x * (x * (0.5d0 / y_m))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((x <= 1.2e-68) || (!(x <= 2.9e-57) && (x <= 6.4e+47))) {
tmp = y_m * 0.5;
} else {
tmp = x * (x * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if (x <= 1.2e-68) or (not (x <= 2.9e-57) and (x <= 6.4e+47)): tmp = y_m * 0.5 else: tmp = x * (x * (0.5 / y_m)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if ((x <= 1.2e-68) || (!(x <= 2.9e-57) && (x <= 6.4e+47))) tmp = Float64(y_m * 0.5); else tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if ((x <= 1.2e-68) || (~((x <= 2.9e-57)) && (x <= 6.4e+47))) tmp = y_m * 0.5; else tmp = x * (x * (0.5 / y_m)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[Or[LessEqual[x, 1.2e-68], And[N[Not[LessEqual[x, 2.9e-57]], $MachinePrecision], LessEqual[x, 6.4e+47]]], N[(y$95$m * 0.5), $MachinePrecision], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{-68} \lor \neg \left(x \leq 2.9 \cdot 10^{-57}\right) \land x \leq 6.4 \cdot 10^{+47}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{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
(*
y_s
(if (<= x 1.2e-68)
(* y_m 0.5)
(if (<= x 1.7e-57)
(* (/ x y_m) (/ x 2.0))
(if (<= x 5.5e+48) (* y_m 0.5) (* x (* x (/ 0.5 y_m))))))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.2e-68) {
tmp = y_m * 0.5;
} else if (x <= 1.7e-57) {
tmp = (x / y_m) * (x / 2.0);
} else if (x <= 5.5e+48) {
tmp = y_m * 0.5;
} else {
tmp = x * (x * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.2d-68) then
tmp = y_m * 0.5d0
else if (x <= 1.7d-57) then
tmp = (x / y_m) * (x / 2.0d0)
else if (x <= 5.5d+48) then
tmp = y_m * 0.5d0
else
tmp = x * (x * (0.5d0 / y_m))
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.2e-68) {
tmp = y_m * 0.5;
} else if (x <= 1.7e-57) {
tmp = (x / y_m) * (x / 2.0);
} else if (x <= 5.5e+48) {
tmp = y_m * 0.5;
} else {
tmp = x * (x * (0.5 / y_m));
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.2e-68: tmp = y_m * 0.5 elif x <= 1.7e-57: tmp = (x / y_m) * (x / 2.0) elif x <= 5.5e+48: tmp = y_m * 0.5 else: tmp = x * (x * (0.5 / y_m)) return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.2e-68) tmp = Float64(y_m * 0.5); elseif (x <= 1.7e-57) tmp = Float64(Float64(x / y_m) * Float64(x / 2.0)); elseif (x <= 5.5e+48) tmp = Float64(y_m * 0.5); else tmp = Float64(x * Float64(x * Float64(0.5 / y_m))); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.2e-68) tmp = y_m * 0.5; elseif (x <= 1.7e-57) tmp = (x / y_m) * (x / 2.0); elseif (x <= 5.5e+48) tmp = y_m * 0.5; else tmp = x * (x * (0.5 / y_m)); end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.2e-68], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.7e-57], N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e+48], N[(y$95$m * 0.5), $MachinePrecision], N[(x * N[(x * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.2 \cdot 10^{-68}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-57}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{+48}:\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{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
(*
y_s
(if (<= y_m 2.16e+157)
(/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))
(* y_m 0.5))))y_m = fabs(y);
y_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.16e+157) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y_m = abs(y)
y_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.16d+157) then
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y_m = Math.abs(y);
y_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.16e+157) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y_m = math.fabs(y) y_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 2.16e+157: tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) else: tmp = y_m * 0.5 return y_s * tmp
y_m = abs(y) y_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 2.16e+157) tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y_m = abs(y); y_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 2.16e+157) tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y_m = N[Abs[y], $MachinePrecision]
y_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.16e+157], N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 2.16 \cdot 10^{+157}:\\
\;\;\;\;\frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot 0.5\\
\end{array}
\end{array}
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 2024006
(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)))