
(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 6.6e-31)
(* 0.5 (/ (fma x x (- (* y_m y_m) (* z z))) y_m))
(* 0.5 (- (+ y_m (* x (/ x y_m))) (* z (/ z 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 <= 6.6e-31) {
tmp = 0.5 * (fma(x, x, ((y_m * y_m) - (z * z))) / y_m);
} else {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / 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 <= 6.6e-31) tmp = Float64(0.5 * Float64(fma(x, x, Float64(Float64(y_m * y_m) - Float64(z * z))) / y_m)); else tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z * Float64(z / 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, 6.6e-31], N[(0.5 * N[(N[(x * x + N[(N[(y$95$m * y$95$m), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / 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 6.6 \cdot 10^{-31}:\\
\;\;\;\;0.5 \cdot \frac{\mathsf{fma}\left(x, x, y\_m \cdot y\_m - z \cdot z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\end{array}
\end{array}
if y < 6.5999999999999998e-31Initial program 80.1%
remove-double-neg80.1%
distribute-lft-neg-out80.1%
distribute-frac-neg280.1%
distribute-frac-neg80.1%
neg-mul-180.1%
distribute-lft-neg-out80.1%
*-commutative80.1%
distribute-lft-neg-in80.1%
times-frac80.1%
metadata-eval80.1%
metadata-eval80.1%
associate--l+80.1%
fma-define82.1%
Simplified82.1%
if 6.5999999999999998e-31 < y Initial program 46.6%
remove-double-neg46.6%
distribute-lft-neg-out46.6%
distribute-frac-neg246.6%
distribute-frac-neg46.6%
neg-mul-146.6%
distribute-lft-neg-out46.6%
*-commutative46.6%
distribute-lft-neg-in46.6%
times-frac46.6%
metadata-eval46.6%
metadata-eval46.6%
associate--l+46.6%
fma-define46.6%
Simplified46.6%
Taylor expanded in x around 0 80.0%
pow280.0%
associate-/l*90.1%
Applied egg-rr90.1%
unpow290.1%
associate-/l*98.2%
Applied egg-rr98.2%
Final simplification85.7%
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 y_m) -0.5))))
(*
y_s
(if (<= x 2.45e-275)
t_0
(if (<= x 1.75e-229)
(* y_m 0.5)
(if (<= x 1.65e-211)
t_0
(if (<= x 3.6e-147)
(* y_m 0.5)
(if (<= x 5e+24) t_0 (* x (/ (* 0.5 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 t_0 = z * ((z / y_m) * -0.5);
double tmp;
if (x <= 2.45e-275) {
tmp = t_0;
} else if (x <= 1.75e-229) {
tmp = y_m * 0.5;
} else if (x <= 1.65e-211) {
tmp = t_0;
} else if (x <= 3.6e-147) {
tmp = y_m * 0.5;
} else if (x <= 5e+24) {
tmp = t_0;
} else {
tmp = x * ((0.5 * x) / 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) :: t_0
real(8) :: tmp
t_0 = z * ((z / y_m) * (-0.5d0))
if (x <= 2.45d-275) then
tmp = t_0
else if (x <= 1.75d-229) then
tmp = y_m * 0.5d0
else if (x <= 1.65d-211) then
tmp = t_0
else if (x <= 3.6d-147) then
tmp = y_m * 0.5d0
else if (x <= 5d+24) then
tmp = t_0
else
tmp = x * ((0.5d0 * x) / 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 t_0 = z * ((z / y_m) * -0.5);
double tmp;
if (x <= 2.45e-275) {
tmp = t_0;
} else if (x <= 1.75e-229) {
tmp = y_m * 0.5;
} else if (x <= 1.65e-211) {
tmp = t_0;
} else if (x <= 3.6e-147) {
tmp = y_m * 0.5;
} else if (x <= 5e+24) {
tmp = t_0;
} else {
tmp = x * ((0.5 * x) / 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 = z * ((z / y_m) * -0.5) tmp = 0 if x <= 2.45e-275: tmp = t_0 elif x <= 1.75e-229: tmp = y_m * 0.5 elif x <= 1.65e-211: tmp = t_0 elif x <= 3.6e-147: tmp = y_m * 0.5 elif x <= 5e+24: tmp = t_0 else: tmp = x * ((0.5 * 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) t_0 = Float64(z * Float64(Float64(z / y_m) * -0.5)) tmp = 0.0 if (x <= 2.45e-275) tmp = t_0; elseif (x <= 1.75e-229) tmp = Float64(y_m * 0.5); elseif (x <= 1.65e-211) tmp = t_0; elseif (x <= 3.6e-147) tmp = Float64(y_m * 0.5); elseif (x <= 5e+24) tmp = t_0; else tmp = Float64(x * Float64(Float64(0.5 * x) / 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 = z * ((z / y_m) * -0.5); tmp = 0.0; if (x <= 2.45e-275) tmp = t_0; elseif (x <= 1.75e-229) tmp = y_m * 0.5; elseif (x <= 1.65e-211) tmp = t_0; elseif (x <= 3.6e-147) tmp = y_m * 0.5; elseif (x <= 5e+24) tmp = t_0; else tmp = x * ((0.5 * x) / 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[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 2.45e-275], t$95$0, If[LessEqual[x, 1.75e-229], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.65e-211], t$95$0, If[LessEqual[x, 3.6e-147], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 5e+24], t$95$0, N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]]]]]]), $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(\frac{z}{y\_m} \cdot -0.5\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 2.45 \cdot 10^{-275}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-229}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-211}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-147}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\end{array}
\end{array}
\end{array}
if x < 2.44999999999999991e-275 or 1.7500000000000002e-229 < x < 1.6500000000000001e-211 or 3.60000000000000012e-147 < x < 5.00000000000000045e24Initial program 75.6%
clear-num75.6%
associate-/r/75.6%
*-commutative75.6%
associate-/r*75.6%
metadata-eval75.6%
add-sqr-sqrt75.6%
pow275.6%
hypot-define75.6%
pow275.6%
Applied egg-rr75.6%
Taylor expanded in z around inf 41.6%
associate-*r/41.6%
Simplified41.6%
associate-/l*41.6%
unpow241.6%
associate-*l/43.2%
associate-*r*43.2%
Applied egg-rr43.2%
if 2.44999999999999991e-275 < x < 1.7500000000000002e-229 or 1.6500000000000001e-211 < x < 3.60000000000000012e-147Initial program 46.5%
Taylor expanded in y around inf 65.6%
*-commutative65.6%
Simplified65.6%
if 5.00000000000000045e24 < x Initial program 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
associate-*l/74.2%
Simplified74.2%
associate-/l*74.2%
unpow274.2%
associate-*l*77.1%
Applied egg-rr77.1%
associate-*r/77.1%
Applied egg-rr77.1%
Final simplification53.1%
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 y_m) -0.5))))
(*
y_s
(if (<= x 1.38e-275)
t_0
(if (<= x 5.3e-226)
(* y_m 0.5)
(if (<= x 1.35e-211)
t_0
(if (<= x 3.5e-147)
(* y_m 0.5)
(if (<= x 1.2e+24) t_0 (/ (* 0.5 x) (/ y_m x))))))))))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 / y_m) * -0.5);
double tmp;
if (x <= 1.38e-275) {
tmp = t_0;
} else if (x <= 5.3e-226) {
tmp = y_m * 0.5;
} else if (x <= 1.35e-211) {
tmp = t_0;
} else if (x <= 3.5e-147) {
tmp = y_m * 0.5;
} else if (x <= 1.2e+24) {
tmp = t_0;
} else {
tmp = (0.5 * x) / (y_m / 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) :: t_0
real(8) :: tmp
t_0 = z * ((z / y_m) * (-0.5d0))
if (x <= 1.38d-275) then
tmp = t_0
else if (x <= 5.3d-226) then
tmp = y_m * 0.5d0
else if (x <= 1.35d-211) then
tmp = t_0
else if (x <= 3.5d-147) then
tmp = y_m * 0.5d0
else if (x <= 1.2d+24) then
tmp = t_0
else
tmp = (0.5d0 * x) / (y_m / 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 t_0 = z * ((z / y_m) * -0.5);
double tmp;
if (x <= 1.38e-275) {
tmp = t_0;
} else if (x <= 5.3e-226) {
tmp = y_m * 0.5;
} else if (x <= 1.35e-211) {
tmp = t_0;
} else if (x <= 3.5e-147) {
tmp = y_m * 0.5;
} else if (x <= 1.2e+24) {
tmp = t_0;
} else {
tmp = (0.5 * x) / (y_m / 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): t_0 = z * ((z / y_m) * -0.5) tmp = 0 if x <= 1.38e-275: tmp = t_0 elif x <= 5.3e-226: tmp = y_m * 0.5 elif x <= 1.35e-211: tmp = t_0 elif x <= 3.5e-147: tmp = y_m * 0.5 elif x <= 1.2e+24: tmp = t_0 else: tmp = (0.5 * x) / (y_m / x) 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(Float64(z / y_m) * -0.5)) tmp = 0.0 if (x <= 1.38e-275) tmp = t_0; elseif (x <= 5.3e-226) tmp = Float64(y_m * 0.5); elseif (x <= 1.35e-211) tmp = t_0; elseif (x <= 3.5e-147) tmp = Float64(y_m * 0.5); elseif (x <= 1.2e+24) tmp = t_0; else tmp = Float64(Float64(0.5 * x) / Float64(y_m / 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) t_0 = z * ((z / y_m) * -0.5); tmp = 0.0; if (x <= 1.38e-275) tmp = t_0; elseif (x <= 5.3e-226) tmp = y_m * 0.5; elseif (x <= 1.35e-211) tmp = t_0; elseif (x <= 3.5e-147) tmp = y_m * 0.5; elseif (x <= 1.2e+24) tmp = t_0; else tmp = (0.5 * x) / (y_m / 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_] := Block[{t$95$0 = N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 1.38e-275], t$95$0, If[LessEqual[x, 5.3e-226], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.35e-211], t$95$0, If[LessEqual[x, 3.5e-147], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.2e+24], t$95$0, N[(N[(0.5 * x), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]]]]]]), $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(\frac{z}{y\_m} \cdot -0.5\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.38 \cdot 10^{-275}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.3 \cdot 10^{-226}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-211}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-147}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot x}{\frac{y\_m}{x}}\\
\end{array}
\end{array}
\end{array}
if x < 1.37999999999999997e-275 or 5.3000000000000004e-226 < x < 1.35e-211 or 3.50000000000000004e-147 < x < 1.2e24Initial program 75.6%
clear-num75.6%
associate-/r/75.6%
*-commutative75.6%
associate-/r*75.6%
metadata-eval75.6%
add-sqr-sqrt75.6%
pow275.6%
hypot-define75.6%
pow275.6%
Applied egg-rr75.6%
Taylor expanded in z around inf 41.6%
associate-*r/41.6%
Simplified41.6%
associate-/l*41.6%
unpow241.6%
associate-*l/43.2%
associate-*r*43.2%
Applied egg-rr43.2%
if 1.37999999999999997e-275 < x < 5.3000000000000004e-226 or 1.35e-211 < x < 3.50000000000000004e-147Initial program 46.5%
Taylor expanded in y around inf 65.6%
*-commutative65.6%
Simplified65.6%
if 1.2e24 < x Initial program 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
associate-*l/74.2%
Simplified74.2%
associate-/l*74.2%
unpow274.2%
associate-*l*77.1%
Applied egg-rr77.1%
associate-*r/77.1%
Applied egg-rr77.1%
associate-*r/74.2%
*-commutative74.2%
associate-/l*77.1%
clear-num77.1%
un-div-inv77.1%
Applied egg-rr77.1%
Final simplification53.1%
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 y_m) -0.5))))
(*
y_s
(if (<= x 2.45e-275)
t_0
(if (<= x 4.5e-228)
(* y_m 0.5)
(if (<= x 1.3e-211)
(/ (* z (* z -0.5)) y_m)
(if (<= x 6.8e-147)
(* y_m 0.5)
(if (<= x 4.6e+24) t_0 (/ (* 0.5 x) (/ y_m x))))))))))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 / y_m) * -0.5);
double tmp;
if (x <= 2.45e-275) {
tmp = t_0;
} else if (x <= 4.5e-228) {
tmp = y_m * 0.5;
} else if (x <= 1.3e-211) {
tmp = (z * (z * -0.5)) / y_m;
} else if (x <= 6.8e-147) {
tmp = y_m * 0.5;
} else if (x <= 4.6e+24) {
tmp = t_0;
} else {
tmp = (0.5 * x) / (y_m / 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) :: t_0
real(8) :: tmp
t_0 = z * ((z / y_m) * (-0.5d0))
if (x <= 2.45d-275) then
tmp = t_0
else if (x <= 4.5d-228) then
tmp = y_m * 0.5d0
else if (x <= 1.3d-211) then
tmp = (z * (z * (-0.5d0))) / y_m
else if (x <= 6.8d-147) then
tmp = y_m * 0.5d0
else if (x <= 4.6d+24) then
tmp = t_0
else
tmp = (0.5d0 * x) / (y_m / 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 t_0 = z * ((z / y_m) * -0.5);
double tmp;
if (x <= 2.45e-275) {
tmp = t_0;
} else if (x <= 4.5e-228) {
tmp = y_m * 0.5;
} else if (x <= 1.3e-211) {
tmp = (z * (z * -0.5)) / y_m;
} else if (x <= 6.8e-147) {
tmp = y_m * 0.5;
} else if (x <= 4.6e+24) {
tmp = t_0;
} else {
tmp = (0.5 * x) / (y_m / 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): t_0 = z * ((z / y_m) * -0.5) tmp = 0 if x <= 2.45e-275: tmp = t_0 elif x <= 4.5e-228: tmp = y_m * 0.5 elif x <= 1.3e-211: tmp = (z * (z * -0.5)) / y_m elif x <= 6.8e-147: tmp = y_m * 0.5 elif x <= 4.6e+24: tmp = t_0 else: tmp = (0.5 * x) / (y_m / x) 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(Float64(z / y_m) * -0.5)) tmp = 0.0 if (x <= 2.45e-275) tmp = t_0; elseif (x <= 4.5e-228) tmp = Float64(y_m * 0.5); elseif (x <= 1.3e-211) tmp = Float64(Float64(z * Float64(z * -0.5)) / y_m); elseif (x <= 6.8e-147) tmp = Float64(y_m * 0.5); elseif (x <= 4.6e+24) tmp = t_0; else tmp = Float64(Float64(0.5 * x) / Float64(y_m / 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) t_0 = z * ((z / y_m) * -0.5); tmp = 0.0; if (x <= 2.45e-275) tmp = t_0; elseif (x <= 4.5e-228) tmp = y_m * 0.5; elseif (x <= 1.3e-211) tmp = (z * (z * -0.5)) / y_m; elseif (x <= 6.8e-147) tmp = y_m * 0.5; elseif (x <= 4.6e+24) tmp = t_0; else tmp = (0.5 * x) / (y_m / 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_] := Block[{t$95$0 = N[(z * N[(N[(z / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[x, 2.45e-275], t$95$0, If[LessEqual[x, 4.5e-228], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 1.3e-211], N[(N[(z * N[(z * -0.5), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision], If[LessEqual[x, 6.8e-147], N[(y$95$m * 0.5), $MachinePrecision], If[LessEqual[x, 4.6e+24], t$95$0, N[(N[(0.5 * x), $MachinePrecision] / N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]]]]]]), $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(\frac{z}{y\_m} \cdot -0.5\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 2.45 \cdot 10^{-275}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-228}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-211}:\\
\;\;\;\;\frac{z \cdot \left(z \cdot -0.5\right)}{y\_m}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-147}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot x}{\frac{y\_m}{x}}\\
\end{array}
\end{array}
\end{array}
if x < 2.44999999999999991e-275 or 6.79999999999999991e-147 < x < 4.5999999999999998e24Initial program 75.3%
clear-num75.3%
associate-/r/75.2%
*-commutative75.2%
associate-/r*75.2%
metadata-eval75.2%
add-sqr-sqrt75.2%
pow275.2%
hypot-define75.2%
pow275.2%
Applied egg-rr75.2%
Taylor expanded in z around inf 40.1%
associate-*r/40.1%
Simplified40.1%
associate-/l*40.1%
unpow240.1%
associate-*l/41.7%
associate-*r*41.7%
Applied egg-rr41.7%
if 2.44999999999999991e-275 < x < 4.4999999999999999e-228 or 1.3e-211 < x < 6.79999999999999991e-147Initial program 46.5%
Taylor expanded in y around inf 65.6%
*-commutative65.6%
Simplified65.6%
if 4.4999999999999999e-228 < x < 1.3e-211Initial program 84.5%
clear-num84.2%
associate-/r/84.8%
*-commutative84.8%
associate-/r*84.8%
metadata-eval84.8%
add-sqr-sqrt84.8%
pow284.8%
hypot-define84.8%
pow284.8%
Applied egg-rr84.8%
Taylor expanded in z around inf 83.4%
associate-*r/83.4%
Simplified83.4%
associate-/l*83.4%
unpow283.4%
associate-*l/83.1%
associate-*r*83.1%
Applied egg-rr83.1%
associate-*r/83.1%
associate-*l/83.4%
*-commutative83.4%
Applied egg-rr83.4%
if 4.5999999999999998e24 < x Initial program 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
associate-*l/74.2%
Simplified74.2%
associate-/l*74.2%
unpow274.2%
associate-*l*77.1%
Applied egg-rr77.1%
associate-*r/77.1%
Applied egg-rr77.1%
associate-*r/74.2%
*-commutative74.2%
associate-/l*77.1%
clear-num77.1%
un-div-inv77.1%
Applied egg-rr77.1%
Final simplification53.2%
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.35e+193)
(* 0.5 (- (+ y_m (* x (/ x y_m))) (* z (/ z y_m))))
(/ (* 0.5 x) (/ y_m 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 <= 1.35e+193) {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / y_m)));
} else {
tmp = (0.5 * x) / (y_m / 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 <= 1.35d+193) then
tmp = 0.5d0 * ((y_m + (x * (x / y_m))) - (z * (z / y_m)))
else
tmp = (0.5d0 * x) / (y_m / 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 <= 1.35e+193) {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / y_m)));
} else {
tmp = (0.5 * x) / (y_m / 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 <= 1.35e+193: tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / y_m))) else: tmp = (0.5 * x) / (y_m / 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 <= 1.35e+193) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z * Float64(z / y_m)))); else tmp = Float64(Float64(0.5 * x) / Float64(y_m / 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 <= 1.35e+193) tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z * (z / y_m))); else tmp = (0.5 * x) / (y_m / 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, 1.35e+193], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * x), $MachinePrecision] / N[(y$95$m / x), $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.35 \cdot 10^{+193}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - z \cdot \frac{z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot x}{\frac{y\_m}{x}}\\
\end{array}
\end{array}
if x < 1.35e193Initial program 73.4%
remove-double-neg73.4%
distribute-lft-neg-out73.4%
distribute-frac-neg273.4%
distribute-frac-neg73.4%
neg-mul-173.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
distribute-lft-neg-in73.4%
times-frac73.4%
metadata-eval73.4%
metadata-eval73.4%
associate--l+73.4%
fma-define75.1%
Simplified75.1%
Taylor expanded in x around 0 87.3%
pow287.3%
associate-/l*91.0%
Applied egg-rr91.0%
unpow291.0%
associate-/l*94.3%
Applied egg-rr94.3%
if 1.35e193 < x Initial program 66.2%
Taylor expanded in x around inf 85.7%
*-commutative85.7%
associate-*l/85.7%
Simplified85.7%
associate-/l*85.7%
unpow285.7%
associate-*l*88.9%
Applied egg-rr88.9%
associate-*r/88.9%
Applied egg-rr88.9%
associate-*r/85.7%
*-commutative85.7%
associate-/l*88.9%
clear-num88.9%
un-div-inv88.9%
Applied egg-rr88.9%
Final simplification93.7%
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.45e+193)
(* 0.5 (- (+ y_m (* x (/ x y_m))) (/ z (/ y_m z))))
(/ (* 0.5 x) (/ y_m 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 <= 1.45e+193) {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
} else {
tmp = (0.5 * x) / (y_m / 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 <= 1.45d+193) then
tmp = 0.5d0 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)))
else
tmp = (0.5d0 * x) / (y_m / 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 <= 1.45e+193) {
tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z)));
} else {
tmp = (0.5 * x) / (y_m / 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 <= 1.45e+193: tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))) else: tmp = (0.5 * x) / (y_m / 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 <= 1.45e+193) tmp = Float64(0.5 * Float64(Float64(y_m + Float64(x * Float64(x / y_m))) - Float64(z / Float64(y_m / z)))); else tmp = Float64(Float64(0.5 * x) / Float64(y_m / 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 <= 1.45e+193) tmp = 0.5 * ((y_m + (x * (x / y_m))) - (z / (y_m / z))); else tmp = (0.5 * x) / (y_m / 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, 1.45e+193], N[(0.5 * N[(N[(y$95$m + N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z / N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * x), $MachinePrecision] / N[(y$95$m / x), $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.45 \cdot 10^{+193}:\\
\;\;\;\;0.5 \cdot \left(\left(y\_m + x \cdot \frac{x}{y\_m}\right) - \frac{z}{\frac{y\_m}{z}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot x}{\frac{y\_m}{x}}\\
\end{array}
\end{array}
if x < 1.45000000000000007e193Initial program 73.4%
remove-double-neg73.4%
distribute-lft-neg-out73.4%
distribute-frac-neg273.4%
distribute-frac-neg73.4%
neg-mul-173.4%
distribute-lft-neg-out73.4%
*-commutative73.4%
distribute-lft-neg-in73.4%
times-frac73.4%
metadata-eval73.4%
metadata-eval73.4%
associate--l+73.4%
fma-define75.1%
Simplified75.1%
Taylor expanded in x around 0 87.3%
pow287.3%
associate-/l*91.0%
Applied egg-rr91.0%
unpow291.0%
associate-/l*94.3%
Applied egg-rr94.3%
clear-num94.2%
un-div-inv94.3%
Applied egg-rr94.3%
if 1.45000000000000007e193 < x Initial program 66.2%
Taylor expanded in x around inf 85.7%
*-commutative85.7%
associate-*l/85.7%
Simplified85.7%
associate-/l*85.7%
unpow285.7%
associate-*l*88.9%
Applied egg-rr88.9%
associate-*r/88.9%
Applied egg-rr88.9%
associate-*r/85.7%
*-commutative85.7%
associate-/l*88.9%
clear-num88.9%
un-div-inv88.9%
Applied egg-rr88.9%
Final simplification93.7%
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.35e+25) (* 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.35e+25) {
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.35d+25) 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.35e+25) {
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.35e+25: 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.35e+25) 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.35e+25) 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.35e+25], 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.35 \cdot 10^{+25}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \frac{0.5}{y\_m}\right)\\
\end{array}
\end{array}
if x < 1.35e25Initial program 72.2%
Taylor expanded in y around inf 33.4%
*-commutative33.4%
Simplified33.4%
if 1.35e25 < x Initial program 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
associate-*l/74.2%
Simplified74.2%
associate-/l*74.2%
unpow274.2%
associate-*l*77.1%
Applied egg-rr77.1%
Final simplification43.7%
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.1e+25) (* y_m 0.5) (* x (/ (* 0.5 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 (x <= 1.1e+25) {
tmp = y_m * 0.5;
} else {
tmp = x * ((0.5 * x) / 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.1d+25) then
tmp = y_m * 0.5d0
else
tmp = x * ((0.5d0 * x) / 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.1e+25) {
tmp = y_m * 0.5;
} else {
tmp = x * ((0.5 * x) / 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.1e+25: tmp = y_m * 0.5 else: tmp = x * ((0.5 * 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 (x <= 1.1e+25) tmp = Float64(y_m * 0.5); else tmp = Float64(x * Float64(Float64(0.5 * x) / 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.1e+25) tmp = y_m * 0.5; else tmp = x * ((0.5 * x) / 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.1e+25], N[(y$95$m * 0.5), $MachinePrecision], N[(x * N[(N[(0.5 * x), $MachinePrecision] / y$95$m), $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.1 \cdot 10^{+25}:\\
\;\;\;\;y\_m \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{0.5 \cdot x}{y\_m}\\
\end{array}
\end{array}
if x < 1.1e25Initial program 72.2%
Taylor expanded in y around inf 33.4%
*-commutative33.4%
Simplified33.4%
if 1.1e25 < x Initial program 74.2%
Taylor expanded in x around inf 74.2%
*-commutative74.2%
associate-*l/74.2%
Simplified74.2%
associate-/l*74.2%
unpow274.2%
associate-*l*77.1%
Applied egg-rr77.1%
associate-*r/77.1%
Applied egg-rr77.1%
Final simplification43.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.7%
Taylor expanded in y around inf 28.4%
*-commutative28.4%
Simplified28.4%
Final simplification28.4%
(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 2024039
(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)))