
(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 10 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 1.3e+126)
(/ (fma (- y_m z) (+ y_m z) (* x x)) (* y_m 2.0))
(/ (+ y_m z) (/ y_m (* (- y_m z) 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 <= 1.3e+126) {
tmp = fma((y_m - z), (y_m + z), (x * x)) / (y_m * 2.0);
} else {
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 1.3e+126) tmp = Float64(fma(Float64(y_m - z), Float64(y_m + z), Float64(x * x)) / Float64(y_m * 2.0)); else tmp = Float64(Float64(y_m + z) / Float64(y_m / Float64(Float64(y_m - z) * 0.5))); 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, 1.3e+126], 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[(y$95$m + z), $MachinePrecision] / N[(y$95$m / N[(N[(y$95$m - z), $MachinePrecision] * 0.5), $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 1.3 \cdot 10^{+126}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y_m - z, y_m + z, x \cdot x\right)}{y_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m + z}{\frac{y_m}{\left(y_m - z\right) \cdot 0.5}}\\
\end{array}
\end{array}
if y < 1.3e126Initial program 77.6%
associate--l+77.6%
+-commutative77.6%
sqr-neg77.6%
difference-of-squares78.3%
fma-def80.1%
sub-neg80.1%
sub-neg80.1%
remove-double-neg80.1%
Simplified80.1%
if 1.3e126 < y Initial program 29.0%
associate--l+29.0%
+-commutative29.0%
sqr-neg29.0%
difference-of-squares29.7%
fma-def29.7%
sub-neg29.7%
sub-neg29.7%
remove-double-neg29.7%
Simplified29.7%
Taylor expanded in x around 0 29.7%
associate-/l*87.2%
div-inv87.1%
associate-/l*87.1%
div-inv87.1%
metadata-eval87.1%
Applied egg-rr87.1%
associate-*r/87.2%
*-rgt-identity87.2%
*-commutative87.2%
Simplified87.2%
Final simplification80.9%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* z (* z (/ -0.5 y_m)))) (t_1 (* (/ x y_m) (/ x 2.0))))
(*
y_s
(if (<= y_m 1.35e-276)
t_1
(if (<= y_m 5.2e-219)
t_0
(if (<= y_m 2.2e-181)
t_1
(if (<= y_m 1.18e-153)
t_0
(if (<= y_m 6.2e-60)
t_1
(if (<= y_m 49000000.0)
t_0
(if (<= y_m 7.8e+20)
t_1
(if (or (<= y_m 3.15e+32) (not (<= y_m 6.8e+68)))
(* y_m 0.5)
t_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 = z * (z * (-0.5 / y_m));
double t_1 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.35e-276) {
tmp = t_1;
} else if (y_m <= 5.2e-219) {
tmp = t_0;
} else if (y_m <= 2.2e-181) {
tmp = t_1;
} else if (y_m <= 1.18e-153) {
tmp = t_0;
} else if (y_m <= 6.2e-60) {
tmp = t_1;
} else if (y_m <= 49000000.0) {
tmp = t_0;
} else if (y_m <= 7.8e+20) {
tmp = t_1;
} else if ((y_m <= 3.15e+32) || !(y_m <= 6.8e+68)) {
tmp = y_m * 0.5;
} else {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (z * ((-0.5d0) / y_m))
t_1 = (x / y_m) * (x / 2.0d0)
if (y_m <= 1.35d-276) then
tmp = t_1
else if (y_m <= 5.2d-219) then
tmp = t_0
else if (y_m <= 2.2d-181) then
tmp = t_1
else if (y_m <= 1.18d-153) then
tmp = t_0
else if (y_m <= 6.2d-60) then
tmp = t_1
else if (y_m <= 49000000.0d0) then
tmp = t_0
else if (y_m <= 7.8d+20) then
tmp = t_1
else if ((y_m <= 3.15d+32) .or. (.not. (y_m <= 6.8d+68))) then
tmp = y_m * 0.5d0
else
tmp = t_0
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 = z * (z * (-0.5 / y_m));
double t_1 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.35e-276) {
tmp = t_1;
} else if (y_m <= 5.2e-219) {
tmp = t_0;
} else if (y_m <= 2.2e-181) {
tmp = t_1;
} else if (y_m <= 1.18e-153) {
tmp = t_0;
} else if (y_m <= 6.2e-60) {
tmp = t_1;
} else if (y_m <= 49000000.0) {
tmp = t_0;
} else if (y_m <= 7.8e+20) {
tmp = t_1;
} else if ((y_m <= 3.15e+32) || !(y_m <= 6.8e+68)) {
tmp = y_m * 0.5;
} else {
tmp = t_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 = z * (z * (-0.5 / y_m)) t_1 = (x / y_m) * (x / 2.0) tmp = 0 if y_m <= 1.35e-276: tmp = t_1 elif y_m <= 5.2e-219: tmp = t_0 elif y_m <= 2.2e-181: tmp = t_1 elif y_m <= 1.18e-153: tmp = t_0 elif y_m <= 6.2e-60: tmp = t_1 elif y_m <= 49000000.0: tmp = t_0 elif y_m <= 7.8e+20: tmp = t_1 elif (y_m <= 3.15e+32) or not (y_m <= 6.8e+68): tmp = y_m * 0.5 else: tmp = t_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 = Float64(z * Float64(z * Float64(-0.5 / y_m))) t_1 = Float64(Float64(x / y_m) * Float64(x / 2.0)) tmp = 0.0 if (y_m <= 1.35e-276) tmp = t_1; elseif (y_m <= 5.2e-219) tmp = t_0; elseif (y_m <= 2.2e-181) tmp = t_1; elseif (y_m <= 1.18e-153) tmp = t_0; elseif (y_m <= 6.2e-60) tmp = t_1; elseif (y_m <= 49000000.0) tmp = t_0; elseif (y_m <= 7.8e+20) tmp = t_1; elseif ((y_m <= 3.15e+32) || !(y_m <= 6.8e+68)) tmp = Float64(y_m * 0.5); else tmp = t_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 = z * (z * (-0.5 / y_m)); t_1 = (x / y_m) * (x / 2.0); tmp = 0.0; if (y_m <= 1.35e-276) tmp = t_1; elseif (y_m <= 5.2e-219) tmp = t_0; elseif (y_m <= 2.2e-181) tmp = t_1; elseif (y_m <= 1.18e-153) tmp = t_0; elseif (y_m <= 6.2e-60) tmp = t_1; elseif (y_m <= 49000000.0) tmp = t_0; elseif (y_m <= 7.8e+20) tmp = t_1; elseif ((y_m <= 3.15e+32) || ~((y_m <= 6.8e+68))) tmp = y_m * 0.5; else tmp = t_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[(z * N[(z * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.35e-276], t$95$1, If[LessEqual[y$95$m, 5.2e-219], t$95$0, If[LessEqual[y$95$m, 2.2e-181], t$95$1, If[LessEqual[y$95$m, 1.18e-153], t$95$0, If[LessEqual[y$95$m, 6.2e-60], t$95$1, If[LessEqual[y$95$m, 49000000.0], t$95$0, If[LessEqual[y$95$m, 7.8e+20], t$95$1, If[Or[LessEqual[y$95$m, 3.15e+32], N[Not[LessEqual[y$95$m, 6.8e+68]], $MachinePrecision]], N[(y$95$m * 0.5), $MachinePrecision], t$95$0]]]]]]]]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \frac{-0.5}{y_m}\right)\\
t_1 := \frac{x}{y_m} \cdot \frac{x}{2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.35 \cdot 10^{-276}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 5.2 \cdot 10^{-219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 2.2 \cdot 10^{-181}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 1.18 \cdot 10^{-153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 6.2 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 49000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 7.8 \cdot 10^{+20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 3.15 \cdot 10^{+32} \lor \neg \left(y_m \leq 6.8 \cdot 10^{+68}\right):\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
\end{array}
if y < 1.34999999999999993e-276 or 5.20000000000000004e-219 < y < 2.19999999999999997e-181 or 1.1800000000000001e-153 < y < 6.19999999999999976e-60 or 4.9e7 < y < 7.8e20Initial program 73.1%
Taylor expanded in x around inf 37.7%
unpow237.7%
times-frac38.7%
Applied egg-rr38.7%
if 1.34999999999999993e-276 < y < 5.20000000000000004e-219 or 2.19999999999999997e-181 < y < 1.1800000000000001e-153 or 6.19999999999999976e-60 < y < 4.9e7 or 3.1500000000000001e32 < y < 6.8000000000000003e68Initial program 88.4%
Taylor expanded in z around inf 61.2%
associate-*r/61.2%
associate-/l*61.3%
Simplified61.3%
associate-/r/61.1%
unpow261.1%
associate-*r*61.1%
Applied egg-rr61.1%
if 7.8e20 < y < 3.1500000000000001e32 or 6.8000000000000003e68 < y Initial program 48.6%
Taylor expanded in y around inf 67.6%
Final simplification47.9%
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 (/ (/ y_m z) z)))
(t_1 (* z (* z (/ -0.5 y_m))))
(t_2 (* (/ x y_m) (/ x 2.0))))
(*
y_s
(if (<= y_m 1.25e-276)
t_2
(if (<= y_m 1.4e-217)
t_0
(if (<= y_m 2.3e-180)
t_2
(if (<= y_m 6.8e-152)
t_0
(if (<= y_m 8.5e-61)
t_2
(if (<= y_m 36000000.0)
t_1
(if (<= y_m 8.5e+20)
t_2
(if (or (<= y_m 6.4e+33) (not (<= y_m 1.25e+67)))
(* y_m 0.5)
t_1)))))))))))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 / ((y_m / z) / z);
double t_1 = z * (z * (-0.5 / y_m));
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.25e-276) {
tmp = t_2;
} else if (y_m <= 1.4e-217) {
tmp = t_0;
} else if (y_m <= 2.3e-180) {
tmp = t_2;
} else if (y_m <= 6.8e-152) {
tmp = t_0;
} else if (y_m <= 8.5e-61) {
tmp = t_2;
} else if (y_m <= 36000000.0) {
tmp = t_1;
} else if (y_m <= 8.5e+20) {
tmp = t_2;
} else if ((y_m <= 6.4e+33) || !(y_m <= 1.25e+67)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-0.5d0) / ((y_m / z) / z)
t_1 = z * (z * ((-0.5d0) / y_m))
t_2 = (x / y_m) * (x / 2.0d0)
if (y_m <= 1.25d-276) then
tmp = t_2
else if (y_m <= 1.4d-217) then
tmp = t_0
else if (y_m <= 2.3d-180) then
tmp = t_2
else if (y_m <= 6.8d-152) then
tmp = t_0
else if (y_m <= 8.5d-61) then
tmp = t_2
else if (y_m <= 36000000.0d0) then
tmp = t_1
else if (y_m <= 8.5d+20) then
tmp = t_2
else if ((y_m <= 6.4d+33) .or. (.not. (y_m <= 1.25d+67))) then
tmp = y_m * 0.5d0
else
tmp = t_1
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 / ((y_m / z) / z);
double t_1 = z * (z * (-0.5 / y_m));
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.25e-276) {
tmp = t_2;
} else if (y_m <= 1.4e-217) {
tmp = t_0;
} else if (y_m <= 2.3e-180) {
tmp = t_2;
} else if (y_m <= 6.8e-152) {
tmp = t_0;
} else if (y_m <= 8.5e-61) {
tmp = t_2;
} else if (y_m <= 36000000.0) {
tmp = t_1;
} else if (y_m <= 8.5e+20) {
tmp = t_2;
} else if ((y_m <= 6.4e+33) || !(y_m <= 1.25e+67)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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 / ((y_m / z) / z) t_1 = z * (z * (-0.5 / y_m)) t_2 = (x / y_m) * (x / 2.0) tmp = 0 if y_m <= 1.25e-276: tmp = t_2 elif y_m <= 1.4e-217: tmp = t_0 elif y_m <= 2.3e-180: tmp = t_2 elif y_m <= 6.8e-152: tmp = t_0 elif y_m <= 8.5e-61: tmp = t_2 elif y_m <= 36000000.0: tmp = t_1 elif y_m <= 8.5e+20: tmp = t_2 elif (y_m <= 6.4e+33) or not (y_m <= 1.25e+67): tmp = y_m * 0.5 else: tmp = t_1 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(Float64(y_m / z) / z)) t_1 = Float64(z * Float64(z * Float64(-0.5 / y_m))) t_2 = Float64(Float64(x / y_m) * Float64(x / 2.0)) tmp = 0.0 if (y_m <= 1.25e-276) tmp = t_2; elseif (y_m <= 1.4e-217) tmp = t_0; elseif (y_m <= 2.3e-180) tmp = t_2; elseif (y_m <= 6.8e-152) tmp = t_0; elseif (y_m <= 8.5e-61) tmp = t_2; elseif (y_m <= 36000000.0) tmp = t_1; elseif (y_m <= 8.5e+20) tmp = t_2; elseif ((y_m <= 6.4e+33) || !(y_m <= 1.25e+67)) tmp = Float64(y_m * 0.5); else tmp = t_1; 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 / ((y_m / z) / z); t_1 = z * (z * (-0.5 / y_m)); t_2 = (x / y_m) * (x / 2.0); tmp = 0.0; if (y_m <= 1.25e-276) tmp = t_2; elseif (y_m <= 1.4e-217) tmp = t_0; elseif (y_m <= 2.3e-180) tmp = t_2; elseif (y_m <= 6.8e-152) tmp = t_0; elseif (y_m <= 8.5e-61) tmp = t_2; elseif (y_m <= 36000000.0) tmp = t_1; elseif (y_m <= 8.5e+20) tmp = t_2; elseif ((y_m <= 6.4e+33) || ~((y_m <= 1.25e+67))) tmp = y_m * 0.5; else tmp = t_1; 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[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(z * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.25e-276], t$95$2, If[LessEqual[y$95$m, 1.4e-217], t$95$0, If[LessEqual[y$95$m, 2.3e-180], t$95$2, If[LessEqual[y$95$m, 6.8e-152], t$95$0, If[LessEqual[y$95$m, 8.5e-61], t$95$2, If[LessEqual[y$95$m, 36000000.0], t$95$1, If[LessEqual[y$95$m, 8.5e+20], t$95$2, If[Or[LessEqual[y$95$m, 6.4e+33], N[Not[LessEqual[y$95$m, 1.25e+67]], $MachinePrecision]], N[(y$95$m * 0.5), $MachinePrecision], t$95$1]]]]]]]]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{-0.5}{\frac{\frac{y_m}{z}}{z}}\\
t_1 := z \cdot \left(z \cdot \frac{-0.5}{y_m}\right)\\
t_2 := \frac{x}{y_m} \cdot \frac{x}{2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.25 \cdot 10^{-276}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 1.4 \cdot 10^{-217}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 2.3 \cdot 10^{-180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 6.8 \cdot 10^{-152}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 8.5 \cdot 10^{-61}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 36000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 8.5 \cdot 10^{+20}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 6.4 \cdot 10^{+33} \lor \neg \left(y_m \leq 1.25 \cdot 10^{+67}\right):\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
\end{array}
if y < 1.24999999999999992e-276 or 1.4e-217 < y < 2.29999999999999996e-180 or 6.79999999999999968e-152 < y < 8.50000000000000016e-61 or 3.6e7 < y < 8.5e20Initial program 73.1%
Taylor expanded in x around inf 37.7%
unpow237.7%
times-frac38.7%
Applied egg-rr38.7%
if 1.24999999999999992e-276 < y < 1.4e-217 or 2.29999999999999996e-180 < y < 6.79999999999999968e-152Initial program 88.1%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
associate-/l*64.6%
Simplified64.6%
*-un-lft-identity64.6%
unpow264.6%
times-frac64.5%
Applied egg-rr64.5%
associate-*l/64.6%
*-lft-identity64.6%
Simplified64.6%
if 8.50000000000000016e-61 < y < 3.6e7 or 6.40000000000000034e33 < y < 1.24999999999999994e67Initial program 88.8%
Taylor expanded in z around inf 58.2%
associate-*r/58.2%
associate-/l*58.1%
Simplified58.1%
associate-/r/57.9%
unpow257.9%
associate-*r*58.0%
Applied egg-rr58.0%
if 8.5e20 < y < 6.40000000000000034e33 or 1.24999999999999994e67 < y Initial program 48.6%
Taylor expanded in y around inf 67.6%
Final simplification47.9%
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 (/ (/ y_m z) z)))
(t_1 (* z (* z (/ -0.5 y_m))))
(t_2 (* (/ x y_m) (/ x 2.0))))
(*
y_s
(if (<= y_m 1.15e-276)
t_2
(if (<= y_m 3.9e-218)
t_0
(if (<= y_m 1.4e-180)
(/ x (* y_m (/ 2.0 x)))
(if (<= y_m 1.42e-151)
t_0
(if (<= y_m 1.05e-60)
t_2
(if (<= y_m 215000000.0)
t_1
(if (<= y_m 1.5e+21)
t_2
(if (or (<= y_m 6.2e+33) (not (<= y_m 6.6e+69)))
(* y_m 0.5)
t_1)))))))))))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 / ((y_m / z) / z);
double t_1 = z * (z * (-0.5 / y_m));
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.15e-276) {
tmp = t_2;
} else if (y_m <= 3.9e-218) {
tmp = t_0;
} else if (y_m <= 1.4e-180) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 1.42e-151) {
tmp = t_0;
} else if (y_m <= 1.05e-60) {
tmp = t_2;
} else if (y_m <= 215000000.0) {
tmp = t_1;
} else if (y_m <= 1.5e+21) {
tmp = t_2;
} else if ((y_m <= 6.2e+33) || !(y_m <= 6.6e+69)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-0.5d0) / ((y_m / z) / z)
t_1 = z * (z * ((-0.5d0) / y_m))
t_2 = (x / y_m) * (x / 2.0d0)
if (y_m <= 1.15d-276) then
tmp = t_2
else if (y_m <= 3.9d-218) then
tmp = t_0
else if (y_m <= 1.4d-180) then
tmp = x / (y_m * (2.0d0 / x))
else if (y_m <= 1.42d-151) then
tmp = t_0
else if (y_m <= 1.05d-60) then
tmp = t_2
else if (y_m <= 215000000.0d0) then
tmp = t_1
else if (y_m <= 1.5d+21) then
tmp = t_2
else if ((y_m <= 6.2d+33) .or. (.not. (y_m <= 6.6d+69))) then
tmp = y_m * 0.5d0
else
tmp = t_1
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 / ((y_m / z) / z);
double t_1 = z * (z * (-0.5 / y_m));
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.15e-276) {
tmp = t_2;
} else if (y_m <= 3.9e-218) {
tmp = t_0;
} else if (y_m <= 1.4e-180) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 1.42e-151) {
tmp = t_0;
} else if (y_m <= 1.05e-60) {
tmp = t_2;
} else if (y_m <= 215000000.0) {
tmp = t_1;
} else if (y_m <= 1.5e+21) {
tmp = t_2;
} else if ((y_m <= 6.2e+33) || !(y_m <= 6.6e+69)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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 / ((y_m / z) / z) t_1 = z * (z * (-0.5 / y_m)) t_2 = (x / y_m) * (x / 2.0) tmp = 0 if y_m <= 1.15e-276: tmp = t_2 elif y_m <= 3.9e-218: tmp = t_0 elif y_m <= 1.4e-180: tmp = x / (y_m * (2.0 / x)) elif y_m <= 1.42e-151: tmp = t_0 elif y_m <= 1.05e-60: tmp = t_2 elif y_m <= 215000000.0: tmp = t_1 elif y_m <= 1.5e+21: tmp = t_2 elif (y_m <= 6.2e+33) or not (y_m <= 6.6e+69): tmp = y_m * 0.5 else: tmp = t_1 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(Float64(y_m / z) / z)) t_1 = Float64(z * Float64(z * Float64(-0.5 / y_m))) t_2 = Float64(Float64(x / y_m) * Float64(x / 2.0)) tmp = 0.0 if (y_m <= 1.15e-276) tmp = t_2; elseif (y_m <= 3.9e-218) tmp = t_0; elseif (y_m <= 1.4e-180) tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); elseif (y_m <= 1.42e-151) tmp = t_0; elseif (y_m <= 1.05e-60) tmp = t_2; elseif (y_m <= 215000000.0) tmp = t_1; elseif (y_m <= 1.5e+21) tmp = t_2; elseif ((y_m <= 6.2e+33) || !(y_m <= 6.6e+69)) tmp = Float64(y_m * 0.5); else tmp = t_1; 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 / ((y_m / z) / z); t_1 = z * (z * (-0.5 / y_m)); t_2 = (x / y_m) * (x / 2.0); tmp = 0.0; if (y_m <= 1.15e-276) tmp = t_2; elseif (y_m <= 3.9e-218) tmp = t_0; elseif (y_m <= 1.4e-180) tmp = x / (y_m * (2.0 / x)); elseif (y_m <= 1.42e-151) tmp = t_0; elseif (y_m <= 1.05e-60) tmp = t_2; elseif (y_m <= 215000000.0) tmp = t_1; elseif (y_m <= 1.5e+21) tmp = t_2; elseif ((y_m <= 6.2e+33) || ~((y_m <= 6.6e+69))) tmp = y_m * 0.5; else tmp = t_1; 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[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(z * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.15e-276], t$95$2, If[LessEqual[y$95$m, 3.9e-218], t$95$0, If[LessEqual[y$95$m, 1.4e-180], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 1.42e-151], t$95$0, If[LessEqual[y$95$m, 1.05e-60], t$95$2, If[LessEqual[y$95$m, 215000000.0], t$95$1, If[LessEqual[y$95$m, 1.5e+21], t$95$2, If[Or[LessEqual[y$95$m, 6.2e+33], N[Not[LessEqual[y$95$m, 6.6e+69]], $MachinePrecision]], N[(y$95$m * 0.5), $MachinePrecision], t$95$1]]]]]]]]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{-0.5}{\frac{\frac{y_m}{z}}{z}}\\
t_1 := z \cdot \left(z \cdot \frac{-0.5}{y_m}\right)\\
t_2 := \frac{x}{y_m} \cdot \frac{x}{2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.15 \cdot 10^{-276}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 3.9 \cdot 10^{-218}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 1.4 \cdot 10^{-180}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\mathbf{elif}\;y_m \leq 1.42 \cdot 10^{-151}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 1.05 \cdot 10^{-60}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 215000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 1.5 \cdot 10^{+21}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 6.2 \cdot 10^{+33} \lor \neg \left(y_m \leq 6.6 \cdot 10^{+69}\right):\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
\end{array}
if y < 1.14999999999999991e-276 or 1.42000000000000002e-151 < y < 1.04999999999999996e-60 or 2.15e8 < y < 1.5e21Initial program 72.9%
Taylor expanded in x around inf 35.7%
unpow235.7%
times-frac36.8%
Applied egg-rr36.8%
if 1.14999999999999991e-276 < y < 3.9e-218 or 1.39999999999999999e-180 < y < 1.42000000000000002e-151Initial program 88.1%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
associate-/l*64.6%
Simplified64.6%
*-un-lft-identity64.6%
unpow264.6%
times-frac64.5%
Applied egg-rr64.5%
associate-*l/64.6%
*-lft-identity64.6%
Simplified64.6%
if 3.9e-218 < y < 1.39999999999999999e-180Initial program 80.0%
Taylor expanded in x around inf 100.0%
unpow2100.0%
times-frac100.0%
Applied egg-rr100.0%
*-commutative100.0%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
if 1.04999999999999996e-60 < y < 2.15e8 or 6.2e33 < y < 6.5999999999999997e69Initial program 88.8%
Taylor expanded in z around inf 58.2%
associate-*r/58.2%
associate-/l*58.1%
Simplified58.1%
associate-/r/57.9%
unpow257.9%
associate-*r*58.0%
Applied egg-rr58.0%
if 1.5e21 < y < 6.2e33 or 6.5999999999999997e69 < y Initial program 48.6%
Taylor expanded in y around inf 67.6%
Final simplification47.9%
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 (/ (/ y_m z) z)))
(t_1 (/ (* z -0.5) (/ y_m z)))
(t_2 (* (/ x y_m) (/ x 2.0))))
(*
y_s
(if (<= y_m 1.1e-276)
t_2
(if (<= y_m 3.6e-217)
t_0
(if (<= y_m 6.5e-181)
(/ x (* y_m (/ 2.0 x)))
(if (<= y_m 2.8e-153)
t_0
(if (<= y_m 1.25e-59)
t_2
(if (<= y_m 1250000000.0)
t_1
(if (<= y_m 2.16e+21)
t_2
(if (or (<= y_m 9.2e+32) (not (<= y_m 9.4e+67)))
(* y_m 0.5)
t_1)))))))))))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 / ((y_m / z) / z);
double t_1 = (z * -0.5) / (y_m / z);
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.1e-276) {
tmp = t_2;
} else if (y_m <= 3.6e-217) {
tmp = t_0;
} else if (y_m <= 6.5e-181) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 2.8e-153) {
tmp = t_0;
} else if (y_m <= 1.25e-59) {
tmp = t_2;
} else if (y_m <= 1250000000.0) {
tmp = t_1;
} else if (y_m <= 2.16e+21) {
tmp = t_2;
} else if ((y_m <= 9.2e+32) || !(y_m <= 9.4e+67)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (-0.5d0) / ((y_m / z) / z)
t_1 = (z * (-0.5d0)) / (y_m / z)
t_2 = (x / y_m) * (x / 2.0d0)
if (y_m <= 1.1d-276) then
tmp = t_2
else if (y_m <= 3.6d-217) then
tmp = t_0
else if (y_m <= 6.5d-181) then
tmp = x / (y_m * (2.0d0 / x))
else if (y_m <= 2.8d-153) then
tmp = t_0
else if (y_m <= 1.25d-59) then
tmp = t_2
else if (y_m <= 1250000000.0d0) then
tmp = t_1
else if (y_m <= 2.16d+21) then
tmp = t_2
else if ((y_m <= 9.2d+32) .or. (.not. (y_m <= 9.4d+67))) then
tmp = y_m * 0.5d0
else
tmp = t_1
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 / ((y_m / z) / z);
double t_1 = (z * -0.5) / (y_m / z);
double t_2 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 1.1e-276) {
tmp = t_2;
} else if (y_m <= 3.6e-217) {
tmp = t_0;
} else if (y_m <= 6.5e-181) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 2.8e-153) {
tmp = t_0;
} else if (y_m <= 1.25e-59) {
tmp = t_2;
} else if (y_m <= 1250000000.0) {
tmp = t_1;
} else if (y_m <= 2.16e+21) {
tmp = t_2;
} else if ((y_m <= 9.2e+32) || !(y_m <= 9.4e+67)) {
tmp = y_m * 0.5;
} else {
tmp = t_1;
}
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 / ((y_m / z) / z) t_1 = (z * -0.5) / (y_m / z) t_2 = (x / y_m) * (x / 2.0) tmp = 0 if y_m <= 1.1e-276: tmp = t_2 elif y_m <= 3.6e-217: tmp = t_0 elif y_m <= 6.5e-181: tmp = x / (y_m * (2.0 / x)) elif y_m <= 2.8e-153: tmp = t_0 elif y_m <= 1.25e-59: tmp = t_2 elif y_m <= 1250000000.0: tmp = t_1 elif y_m <= 2.16e+21: tmp = t_2 elif (y_m <= 9.2e+32) or not (y_m <= 9.4e+67): tmp = y_m * 0.5 else: tmp = t_1 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(Float64(y_m / z) / z)) t_1 = Float64(Float64(z * -0.5) / Float64(y_m / z)) t_2 = Float64(Float64(x / y_m) * Float64(x / 2.0)) tmp = 0.0 if (y_m <= 1.1e-276) tmp = t_2; elseif (y_m <= 3.6e-217) tmp = t_0; elseif (y_m <= 6.5e-181) tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); elseif (y_m <= 2.8e-153) tmp = t_0; elseif (y_m <= 1.25e-59) tmp = t_2; elseif (y_m <= 1250000000.0) tmp = t_1; elseif (y_m <= 2.16e+21) tmp = t_2; elseif ((y_m <= 9.2e+32) || !(y_m <= 9.4e+67)) tmp = Float64(y_m * 0.5); else tmp = t_1; 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 / ((y_m / z) / z); t_1 = (z * -0.5) / (y_m / z); t_2 = (x / y_m) * (x / 2.0); tmp = 0.0; if (y_m <= 1.1e-276) tmp = t_2; elseif (y_m <= 3.6e-217) tmp = t_0; elseif (y_m <= 6.5e-181) tmp = x / (y_m * (2.0 / x)); elseif (y_m <= 2.8e-153) tmp = t_0; elseif (y_m <= 1.25e-59) tmp = t_2; elseif (y_m <= 1250000000.0) tmp = t_1; elseif (y_m <= 2.16e+21) tmp = t_2; elseif ((y_m <= 9.2e+32) || ~((y_m <= 9.4e+67))) tmp = y_m * 0.5; else tmp = t_1; 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[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z * -0.5), $MachinePrecision] / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.1e-276], t$95$2, If[LessEqual[y$95$m, 3.6e-217], t$95$0, If[LessEqual[y$95$m, 6.5e-181], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.8e-153], t$95$0, If[LessEqual[y$95$m, 1.25e-59], t$95$2, If[LessEqual[y$95$m, 1250000000.0], t$95$1, If[LessEqual[y$95$m, 2.16e+21], t$95$2, If[Or[LessEqual[y$95$m, 9.2e+32], N[Not[LessEqual[y$95$m, 9.4e+67]], $MachinePrecision]], N[(y$95$m * 0.5), $MachinePrecision], t$95$1]]]]]]]]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
y_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{-0.5}{\frac{\frac{y_m}{z}}{z}}\\
t_1 := \frac{z \cdot -0.5}{\frac{y_m}{z}}\\
t_2 := \frac{x}{y_m} \cdot \frac{x}{2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 1.1 \cdot 10^{-276}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 3.6 \cdot 10^{-217}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 6.5 \cdot 10^{-181}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\mathbf{elif}\;y_m \leq 2.8 \cdot 10^{-153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 1.25 \cdot 10^{-59}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 1250000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 2.16 \cdot 10^{+21}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y_m \leq 9.2 \cdot 10^{+32} \lor \neg \left(y_m \leq 9.4 \cdot 10^{+67}\right):\\
\;\;\;\;y_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
\end{array}
if y < 1.0999999999999999e-276 or 2.8000000000000001e-153 < y < 1.25e-59 or 1.25e9 < y < 2.16e21Initial program 72.9%
Taylor expanded in x around inf 35.7%
unpow235.7%
times-frac36.8%
Applied egg-rr36.8%
if 1.0999999999999999e-276 < y < 3.59999999999999981e-217 or 6.4999999999999997e-181 < y < 2.8000000000000001e-153Initial program 88.1%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
associate-/l*64.6%
Simplified64.6%
*-un-lft-identity64.6%
unpow264.6%
times-frac64.5%
Applied egg-rr64.5%
associate-*l/64.6%
*-lft-identity64.6%
Simplified64.6%
if 3.59999999999999981e-217 < y < 6.4999999999999997e-181Initial program 80.0%
Taylor expanded in x around inf 100.0%
unpow2100.0%
times-frac100.0%
Applied egg-rr100.0%
*-commutative100.0%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
if 1.25e-59 < y < 1.25e9 or 9.1999999999999998e32 < y < 9.40000000000000035e67Initial program 88.8%
Taylor expanded in z around inf 58.2%
associate-*r/58.2%
associate-/l*58.1%
Simplified58.1%
associate-/r/57.9%
unpow257.9%
associate-*r*58.0%
Applied egg-rr58.0%
associate-*l/58.2%
associate-/l*58.0%
associate-*l/58.2%
*-commutative58.2%
Applied egg-rr58.2%
if 2.16e21 < y < 9.1999999999999998e32 or 9.40000000000000035e67 < y Initial program 48.6%
Taylor expanded in y around inf 67.6%
Final simplification48.0%
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 (/ (/ y_m z) z))) (t_1 (* (/ x y_m) (/ x 2.0))))
(*
y_s
(if (<= y_m 9e-277)
t_1
(if (<= y_m 1.32e-216)
t_0
(if (<= y_m 2.4e-182)
(/ x (* y_m (/ 2.0 x)))
(if (<= y_m 3.2e-153)
t_0
(if (<= y_m 8e-61)
t_1
(if (<= y_m 2.6e+162)
(/ (* (- y_m z) (+ y_m 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 t_0 = -0.5 / ((y_m / z) / z);
double t_1 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 9e-277) {
tmp = t_1;
} else if (y_m <= 1.32e-216) {
tmp = t_0;
} else if (y_m <= 2.4e-182) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 3.2e-153) {
tmp = t_0;
} else if (y_m <= 8e-61) {
tmp = t_1;
} else if (y_m <= 2.6e+162) {
tmp = ((y_m - z) * (y_m + 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-0.5d0) / ((y_m / z) / z)
t_1 = (x / y_m) * (x / 2.0d0)
if (y_m <= 9d-277) then
tmp = t_1
else if (y_m <= 1.32d-216) then
tmp = t_0
else if (y_m <= 2.4d-182) then
tmp = x / (y_m * (2.0d0 / x))
else if (y_m <= 3.2d-153) then
tmp = t_0
else if (y_m <= 8d-61) then
tmp = t_1
else if (y_m <= 2.6d+162) then
tmp = ((y_m - z) * (y_m + 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 t_0 = -0.5 / ((y_m / z) / z);
double t_1 = (x / y_m) * (x / 2.0);
double tmp;
if (y_m <= 9e-277) {
tmp = t_1;
} else if (y_m <= 1.32e-216) {
tmp = t_0;
} else if (y_m <= 2.4e-182) {
tmp = x / (y_m * (2.0 / x));
} else if (y_m <= 3.2e-153) {
tmp = t_0;
} else if (y_m <= 8e-61) {
tmp = t_1;
} else if (y_m <= 2.6e+162) {
tmp = ((y_m - z) * (y_m + 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): t_0 = -0.5 / ((y_m / z) / z) t_1 = (x / y_m) * (x / 2.0) tmp = 0 if y_m <= 9e-277: tmp = t_1 elif y_m <= 1.32e-216: tmp = t_0 elif y_m <= 2.4e-182: tmp = x / (y_m * (2.0 / x)) elif y_m <= 3.2e-153: tmp = t_0 elif y_m <= 8e-61: tmp = t_1 elif y_m <= 2.6e+162: tmp = ((y_m - z) * (y_m + 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) t_0 = Float64(-0.5 / Float64(Float64(y_m / z) / z)) t_1 = Float64(Float64(x / y_m) * Float64(x / 2.0)) tmp = 0.0 if (y_m <= 9e-277) tmp = t_1; elseif (y_m <= 1.32e-216) tmp = t_0; elseif (y_m <= 2.4e-182) tmp = Float64(x / Float64(y_m * Float64(2.0 / x))); elseif (y_m <= 3.2e-153) tmp = t_0; elseif (y_m <= 8e-61) tmp = t_1; elseif (y_m <= 2.6e+162) tmp = Float64(Float64(Float64(y_m - z) * Float64(y_m + 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) t_0 = -0.5 / ((y_m / z) / z); t_1 = (x / y_m) * (x / 2.0); tmp = 0.0; if (y_m <= 9e-277) tmp = t_1; elseif (y_m <= 1.32e-216) tmp = t_0; elseif (y_m <= 2.4e-182) tmp = x / (y_m * (2.0 / x)); elseif (y_m <= 3.2e-153) tmp = t_0; elseif (y_m <= 8e-61) tmp = t_1; elseif (y_m <= 2.6e+162) tmp = ((y_m - z) * (y_m + 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_] := Block[{t$95$0 = N[(-0.5 / N[(N[(y$95$m / z), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / y$95$m), $MachinePrecision] * N[(x / 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 9e-277], t$95$1, If[LessEqual[y$95$m, 1.32e-216], t$95$0, If[LessEqual[y$95$m, 2.4e-182], N[(x / N[(y$95$m * N[(2.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 3.2e-153], t$95$0, If[LessEqual[y$95$m, 8e-61], t$95$1, If[LessEqual[y$95$m, 2.6e+162], N[(N[(N[(y$95$m - z), $MachinePrecision] * N[(y$95$m + 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)
\\
\begin{array}{l}
t_0 := \frac{-0.5}{\frac{\frac{y_m}{z}}{z}}\\
t_1 := \frac{x}{y_m} \cdot \frac{x}{2}\\
y_s \cdot \begin{array}{l}
\mathbf{if}\;y_m \leq 9 \cdot 10^{-277}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 1.32 \cdot 10^{-216}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 2.4 \cdot 10^{-182}:\\
\;\;\;\;\frac{x}{y_m \cdot \frac{2}{x}}\\
\mathbf{elif}\;y_m \leq 3.2 \cdot 10^{-153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y_m \leq 8 \cdot 10^{-61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y_m \leq 2.6 \cdot 10^{+162}:\\
\;\;\;\;\frac{\left(y_m - z\right) \cdot \left(y_m + z\right)}{y_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if y < 8.99999999999999985e-277 or 3.1999999999999999e-153 < y < 8.0000000000000003e-61Initial program 72.6%
Taylor expanded in x around inf 34.9%
unpow234.9%
times-frac36.0%
Applied egg-rr36.0%
if 8.99999999999999985e-277 < y < 1.31999999999999997e-216 or 2.3999999999999998e-182 < y < 3.1999999999999999e-153Initial program 88.1%
Taylor expanded in z around inf 64.4%
associate-*r/64.4%
associate-/l*64.6%
Simplified64.6%
*-un-lft-identity64.6%
unpow264.6%
times-frac64.5%
Applied egg-rr64.5%
associate-*l/64.6%
*-lft-identity64.6%
Simplified64.6%
if 1.31999999999999997e-216 < y < 2.3999999999999998e-182Initial program 80.0%
Taylor expanded in x around inf 100.0%
unpow2100.0%
times-frac100.0%
Applied egg-rr100.0%
*-commutative100.0%
clear-num100.0%
frac-times100.0%
*-un-lft-identity100.0%
Applied egg-rr100.0%
if 8.0000000000000003e-61 < y < 2.6e162Initial program 87.9%
associate--l+87.9%
+-commutative87.9%
sqr-neg87.9%
difference-of-squares87.9%
fma-def87.9%
sub-neg87.9%
sub-neg87.9%
remove-double-neg87.9%
Simplified87.9%
Taylor expanded in x around 0 72.1%
if 2.6e162 < y Initial program 15.0%
Taylor expanded in y around inf 82.9%
Final simplification50.8%
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 4.8e+104) (and (not (<= x 5.9e+166)) (<= x 5.3e+172)))
(/ (+ y_m z) (/ y_m (* (- y_m z) 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 <= 4.8e+104) || (!(x <= 5.9e+166) && (x <= 5.3e+172))) {
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 4.8d+104) .or. (.not. (x <= 5.9d+166)) .and. (x <= 5.3d+172)) then
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 4.8e+104) || (!(x <= 5.9e+166) && (x <= 5.3e+172))) {
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 4.8e+104) or (not (x <= 5.9e+166) and (x <= 5.3e+172)): tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 4.8e+104) || (!(x <= 5.9e+166) && (x <= 5.3e+172))) tmp = Float64(Float64(y_m + z) / Float64(y_m / Float64(Float64(y_m - z) * 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 <= 4.8e+104) || (~((x <= 5.9e+166)) && (x <= 5.3e+172))) tmp = (y_m + z) / (y_m / ((y_m - z) * 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, 4.8e+104], And[N[Not[LessEqual[x, 5.9e+166]], $MachinePrecision], LessEqual[x, 5.3e+172]]], N[(N[(y$95$m + z), $MachinePrecision] / N[(y$95$m / N[(N[(y$95$m - z), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $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 4.8 \cdot 10^{+104} \lor \neg \left(x \leq 5.9 \cdot 10^{+166}\right) \land x \leq 5.3 \cdot 10^{+172}:\\
\;\;\;\;\frac{y_m + z}{\frac{y_m}{\left(y_m - z\right) \cdot 0.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y_m} \cdot \frac{x}{2}\\
\end{array}
\end{array}
if x < 4.8e104 or 5.90000000000000012e166 < x < 5.3e172Initial program 72.9%
associate--l+72.9%
+-commutative72.9%
sqr-neg72.9%
difference-of-squares73.6%
fma-def74.5%
sub-neg74.5%
sub-neg74.5%
remove-double-neg74.5%
Simplified74.5%
Taylor expanded in x around 0 53.8%
associate-/l*75.3%
div-inv75.2%
associate-/l*75.2%
div-inv75.2%
metadata-eval75.2%
Applied egg-rr75.2%
associate-*r/75.3%
*-rgt-identity75.3%
*-commutative75.3%
Simplified75.3%
if 4.8e104 < x < 5.90000000000000012e166 or 5.3e172 < x Initial program 67.5%
Taylor expanded in x around inf 73.2%
unpow273.2%
times-frac80.7%
Applied egg-rr80.7%
Final simplification76.0%
y_m = (fabs.f64 y)
y_s = (copysign.f64 1 y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= z 4.2e+70)
(/ (+ y_m z) 2.0)
(if (or (<= z 2.9e+82) (not (<= z 5.6e+113)))
(* z (* z (/ -0.5 y_m)))
(* 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 (z <= 4.2e+70) {
tmp = (y_m + z) / 2.0;
} else if ((z <= 2.9e+82) || !(z <= 5.6e+113)) {
tmp = z * (z * (-0.5 / y_m));
} 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 (z <= 4.2d+70) then
tmp = (y_m + z) / 2.0d0
else if ((z <= 2.9d+82) .or. (.not. (z <= 5.6d+113))) then
tmp = z * (z * ((-0.5d0) / y_m))
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 (z <= 4.2e+70) {
tmp = (y_m + z) / 2.0;
} else if ((z <= 2.9e+82) || !(z <= 5.6e+113)) {
tmp = z * (z * (-0.5 / y_m));
} 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 z <= 4.2e+70: tmp = (y_m + z) / 2.0 elif (z <= 2.9e+82) or not (z <= 5.6e+113): tmp = z * (z * (-0.5 / y_m)) 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 (z <= 4.2e+70) tmp = Float64(Float64(y_m + z) / 2.0); elseif ((z <= 2.9e+82) || !(z <= 5.6e+113)) tmp = Float64(z * Float64(z * Float64(-0.5 / y_m))); 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 (z <= 4.2e+70) tmp = (y_m + z) / 2.0; elseif ((z <= 2.9e+82) || ~((z <= 5.6e+113))) tmp = z * (z * (-0.5 / y_m)); 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[z, 4.2e+70], N[(N[(y$95$m + z), $MachinePrecision] / 2.0), $MachinePrecision], If[Or[LessEqual[z, 2.9e+82], N[Not[LessEqual[z, 5.6e+113]], $MachinePrecision]], N[(z * N[(z * N[(-0.5 / y$95$m), $MachinePrecision]), $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}\;z \leq 4.2 \cdot 10^{+70}:\\
\;\;\;\;\frac{y_m + z}{2}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+82} \lor \neg \left(z \leq 5.6 \cdot 10^{+113}\right):\\
\;\;\;\;z \cdot \left(z \cdot \frac{-0.5}{y_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y_m \cdot 0.5\\
\end{array}
\end{array}
if z < 4.20000000000000015e70Initial program 74.2%
associate--l+74.2%
+-commutative74.2%
sqr-neg74.2%
difference-of-squares74.3%
fma-def75.3%
sub-neg75.3%
sub-neg75.3%
remove-double-neg75.3%
Simplified75.3%
Taylor expanded in x around 0 43.8%
associate-/l*63.4%
div-inv63.4%
associate-/l*63.4%
div-inv63.4%
metadata-eval63.4%
Applied egg-rr63.4%
associate-*r/63.4%
*-rgt-identity63.4%
*-commutative63.4%
Simplified63.4%
Taylor expanded in y around inf 42.3%
if 4.20000000000000015e70 < z < 2.9000000000000001e82 or 5.59999999999999995e113 < z Initial program 71.6%
Taylor expanded in z around inf 79.2%
associate-*r/79.2%
associate-/l*79.2%
Simplified79.2%
associate-/r/79.2%
unpow279.2%
associate-*r*85.6%
Applied egg-rr85.6%
if 2.9000000000000001e82 < z < 5.59999999999999995e113Initial program 27.8%
Taylor expanded in y around inf 67.9%
Final simplification50.3%
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 3.8e+125)
(/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))
(/ (+ y_m z) (/ y_m (* (- y_m z) 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 <= 3.8e+125) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 3.8d+125) then
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
else
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 3.8e+125) {
tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
} else {
tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 3.8e+125: tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) else: tmp = (y_m + z) / (y_m / ((y_m - z) * 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 <= 3.8e+125) tmp = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)); else tmp = Float64(Float64(y_m + z) / Float64(y_m / Float64(Float64(y_m - z) * 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 <= 3.8e+125) tmp = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); else tmp = (y_m + z) / (y_m / ((y_m - z) * 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, 3.8e+125], 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[(N[(y$95$m + z), $MachinePrecision] / N[(y$95$m / N[(N[(y$95$m - z), $MachinePrecision] * 0.5), $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 3.8 \cdot 10^{+125}:\\
\;\;\;\;\frac{\left(x \cdot x + y_m \cdot y_m\right) - z \cdot z}{y_m \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{y_m + z}{\frac{y_m}{\left(y_m - z\right) \cdot 0.5}}\\
\end{array}
\end{array}
if y < 3.80000000000000002e125Initial program 77.6%
if 3.80000000000000002e125 < y Initial program 29.0%
associate--l+29.0%
+-commutative29.0%
sqr-neg29.0%
difference-of-squares29.7%
fma-def29.7%
sub-neg29.7%
sub-neg29.7%
remove-double-neg29.7%
Simplified29.7%
Taylor expanded in x around 0 29.7%
associate-/l*87.2%
div-inv87.1%
associate-/l*87.1%
div-inv87.1%
metadata-eval87.1%
Applied egg-rr87.1%
associate-*r/87.2%
*-rgt-identity87.2%
*-commutative87.2%
Simplified87.2%
Final simplification78.7%
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}
Initial program 72.1%
Taylor expanded in y around inf 37.0%
Final simplification37.0%
(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 2024018
(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)))