
(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 13 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 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* (* z -0.5) (/ z y_m))
(if (<= t_0 4e+303)
t_0
(* y_m (+ 0.5 (/ (* 0.5 (/ (- x z) y_m)) (/ y_m (+ x z))))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + ((0.5 * ((x - z) / y_m)) / (y_m / (x + z))));
}
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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
if (t_0 <= 0.0d0) then
tmp = (z * (-0.5d0)) * (z / y_m)
else if (t_0 <= 4d+303) then
tmp = t_0
else
tmp = y_m * (0.5d0 + ((0.5d0 * ((x - z) / y_m)) / (y_m / (x + z))))
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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + ((0.5 * ((x - z) / y_m)) / (y_m / (x + z))));
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = (z * -0.5) * (z / y_m) elif t_0 <= 4e+303: tmp = t_0 else: tmp = y_m * (0.5 + ((0.5 * ((x - z) / y_m)) / (y_m / (x + z)))) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(z * -0.5) * Float64(z / y_m)); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = Float64(y_m * Float64(0.5 + Float64(Float64(0.5 * Float64(Float64(x - z) / y_m)) / Float64(y_m / Float64(x + z))))); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = (z * -0.5) * (z / y_m); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = y_m * (0.5 + ((0.5 * ((x - z) / y_m)) / (y_m / (x + z)))); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+303], t$95$0, N[(y$95$m * N[(0.5 + N[(N[(0.5 * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision] / N[(y$95$m / N[(x + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y\_m}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + \frac{0.5 \cdot \frac{x - z}{y\_m}}{\frac{y\_m}{x + z}}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 0.0Initial program 82.5%
remove-double-neg82.5%
distribute-lft-neg-out82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
neg-mul-182.5%
distribute-lft-neg-out82.5%
*-commutative82.5%
distribute-lft-neg-in82.5%
times-frac82.5%
metadata-eval82.5%
metadata-eval82.5%
associate--l+82.5%
fma-define82.5%
Simplified82.5%
Taylor expanded in y around inf 84.6%
Taylor expanded in z around inf 26.3%
associate-*r/26.3%
Simplified26.3%
unpow226.3%
Applied egg-rr26.3%
associate-*r*26.3%
*-un-lft-identity26.3%
times-frac28.6%
Applied egg-rr28.6%
if 0.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 4e303Initial program 97.9%
if 4e303 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 50.0%
remove-double-neg50.0%
distribute-lft-neg-out50.0%
distribute-frac-neg250.0%
distribute-frac-neg50.0%
neg-mul-150.0%
distribute-lft-neg-out50.0%
*-commutative50.0%
distribute-lft-neg-in50.0%
times-frac50.0%
metadata-eval50.0%
metadata-eval50.0%
associate--l+50.0%
fma-define55.8%
Simplified55.8%
Taylor expanded in y around inf 65.8%
unpow265.8%
unpow265.8%
difference-of-squares79.3%
Applied egg-rr79.3%
*-commutative79.3%
unpow279.3%
times-frac99.9%
Applied egg-rr99.9%
associate-*r*99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification69.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* (* z -0.5) (/ z y_m))
(if (<= t_0 4e+303)
t_0
(if (<= t_0 INFINITY)
(* y_m (+ 0.5 (* 0.5 (* (/ (+ x z) y_m) (/ x y_m)))))
(* y_m (+ 0.5 (* 0.5 (* (/ z y_m) (/ (- x 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 t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (x / y_m))));
} else {
tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (x / y_m))));
} else {
tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = (z * -0.5) * (z / y_m) elif t_0 <= 4e+303: tmp = t_0 elif t_0 <= math.inf: tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (x / y_m)))) else: tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - 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) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(z * -0.5) * Float64(z / y_m)); elseif (t_0 <= 4e+303) tmp = t_0; elseif (t_0 <= Inf) tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z) / y_m) * Float64(x / y_m))))); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(z / y_m) * Float64(Float64(x - z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = (z * -0.5) * (z / y_m); elseif (t_0 <= 4e+303) tmp = t_0; elseif (t_0 <= Inf) tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (x / y_m)))); else tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+303], t$95$0, If[LessEqual[t$95$0, Infinity], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y\_m}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x + z}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{x - z}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 0.0Initial program 82.5%
remove-double-neg82.5%
distribute-lft-neg-out82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
neg-mul-182.5%
distribute-lft-neg-out82.5%
*-commutative82.5%
distribute-lft-neg-in82.5%
times-frac82.5%
metadata-eval82.5%
metadata-eval82.5%
associate--l+82.5%
fma-define82.5%
Simplified82.5%
Taylor expanded in y around inf 84.6%
Taylor expanded in z around inf 26.3%
associate-*r/26.3%
Simplified26.3%
unpow226.3%
Applied egg-rr26.3%
associate-*r*26.3%
*-un-lft-identity26.3%
times-frac28.6%
Applied egg-rr28.6%
if 0.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 4e303Initial program 97.9%
if 4e303 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0Initial program 65.9%
remove-double-neg65.9%
distribute-lft-neg-out65.9%
distribute-frac-neg265.9%
distribute-frac-neg65.9%
neg-mul-165.9%
distribute-lft-neg-out65.9%
*-commutative65.9%
distribute-lft-neg-in65.9%
times-frac65.9%
metadata-eval65.9%
metadata-eval65.9%
associate--l+65.9%
fma-define65.9%
Simplified65.9%
Taylor expanded in y around inf 86.7%
unpow286.7%
unpow286.7%
difference-of-squares86.7%
Applied egg-rr86.7%
*-commutative86.7%
unpow286.7%
times-frac100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 66.2%
if +inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 0.0%
remove-double-neg0.0%
distribute-lft-neg-out0.0%
distribute-frac-neg20.0%
distribute-frac-neg0.0%
neg-mul-10.0%
distribute-lft-neg-out0.0%
*-commutative0.0%
distribute-lft-neg-in0.0%
times-frac0.0%
metadata-eval0.0%
metadata-eval0.0%
associate--l+0.0%
fma-define24.0%
Simplified24.0%
Taylor expanded in y around inf 0.0%
unpow20.0%
unpow20.0%
difference-of-squares56.0%
Applied egg-rr56.0%
*-commutative56.0%
unpow256.0%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 83.9%
Final simplification57.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* (* z -0.5) (/ z y_m))
(if (<= t_0 4e+303)
t_0
(* y_m (+ 0.5 (* 0.5 (/ (* (/ (- x z) y_m) (+ x 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 t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * ((((x - z) / y_m) * (x + z)) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
if (t_0 <= 0.0d0) then
tmp = (z * (-0.5d0)) * (z / y_m)
else if (t_0 <= 4d+303) then
tmp = t_0
else
tmp = y_m * (0.5d0 + (0.5d0 * ((((x - z) / y_m) * (x + z)) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * ((((x - z) / y_m) * (x + z)) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = (z * -0.5) * (z / y_m) elif t_0 <= 4e+303: tmp = t_0 else: tmp = y_m * (0.5 + (0.5 * ((((x - z) / y_m) * (x + 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) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(z * -0.5) * Float64(z / y_m)); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(Float64(x - z) / y_m) * Float64(x + z)) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = (z * -0.5) * (z / y_m); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = y_m * (0.5 + (0.5 * ((((x - z) / y_m) * (x + z)) / 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[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+303], t$95$0, N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y\_m}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \frac{\frac{x - z}{y\_m} \cdot \left(x + z\right)}{y\_m}\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 0.0Initial program 82.5%
remove-double-neg82.5%
distribute-lft-neg-out82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
neg-mul-182.5%
distribute-lft-neg-out82.5%
*-commutative82.5%
distribute-lft-neg-in82.5%
times-frac82.5%
metadata-eval82.5%
metadata-eval82.5%
associate--l+82.5%
fma-define82.5%
Simplified82.5%
Taylor expanded in y around inf 84.6%
Taylor expanded in z around inf 26.3%
associate-*r/26.3%
Simplified26.3%
unpow226.3%
Applied egg-rr26.3%
associate-*r*26.3%
*-un-lft-identity26.3%
times-frac28.6%
Applied egg-rr28.6%
if 0.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 4e303Initial program 97.9%
if 4e303 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 50.0%
remove-double-neg50.0%
distribute-lft-neg-out50.0%
distribute-frac-neg250.0%
distribute-frac-neg50.0%
neg-mul-150.0%
distribute-lft-neg-out50.0%
*-commutative50.0%
distribute-lft-neg-in50.0%
times-frac50.0%
metadata-eval50.0%
metadata-eval50.0%
associate--l+50.0%
fma-define55.8%
Simplified55.8%
Taylor expanded in y around inf 65.8%
unpow265.8%
unpow265.8%
difference-of-squares79.3%
Applied egg-rr79.3%
*-commutative79.3%
unpow279.3%
times-frac99.9%
Applied egg-rr99.9%
associate-*r/100.0%
Applied egg-rr100.0%
Final simplification69.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- (+ (* x x) (* y_m y_m)) (* z z)) (* y_m 2.0))))
(*
y_s
(if (<= t_0 0.0)
(* (* z -0.5) (/ z y_m))
(if (<= t_0 4e+303)
t_0
(* y_m (+ 0.5 (* 0.5 (* (/ (- x z) y_m) (/ (+ x 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 t_0 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((x + z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0d0)
if (t_0 <= 0.0d0) then
tmp = (z * (-0.5d0)) * (z / y_m)
else if (t_0 <= 4d+303) then
tmp = t_0
else
tmp = y_m * (0.5d0 + (0.5d0 * (((x - z) / y_m) * ((x + z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0);
double tmp;
if (t_0 <= 0.0) {
tmp = (z * -0.5) * (z / y_m);
} else if (t_0 <= 4e+303) {
tmp = t_0;
} else {
tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((x + z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0) tmp = 0 if t_0 <= 0.0: tmp = (z * -0.5) * (z / y_m) elif t_0 <= 4e+303: tmp = t_0 else: tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((x + 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) t_0 = Float64(Float64(Float64(Float64(x * x) + Float64(y_m * y_m)) - Float64(z * z)) / Float64(y_m * 2.0)) tmp = 0.0 if (t_0 <= 0.0) tmp = Float64(Float64(z * -0.5) * Float64(z / y_m)); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x - z) / y_m) * Float64(Float64(x + z) / 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 = (((x * x) + (y_m * y_m)) - (z * z)) / (y_m * 2.0); tmp = 0.0; if (t_0 <= 0.0) tmp = (z * -0.5) * (z / y_m); elseif (t_0 <= 4e+303) tmp = t_0; else tmp = y_m * (0.5 + (0.5 * (((x - z) / y_m) * ((x + z) / 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[(N[(N[(N[(x * x), $MachinePrecision] + N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] - N[(z * z), $MachinePrecision]), $MachinePrecision] / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 0.0], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+303], t$95$0, N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(N[(x + z), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\left(x \cdot x + y\_m \cdot y\_m\right) - z \cdot z}{y\_m \cdot 2}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y\_m}\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+303}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x - z}{y\_m} \cdot \frac{x + z}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 0.0Initial program 82.5%
remove-double-neg82.5%
distribute-lft-neg-out82.5%
distribute-frac-neg282.5%
distribute-frac-neg82.5%
neg-mul-182.5%
distribute-lft-neg-out82.5%
*-commutative82.5%
distribute-lft-neg-in82.5%
times-frac82.5%
metadata-eval82.5%
metadata-eval82.5%
associate--l+82.5%
fma-define82.5%
Simplified82.5%
Taylor expanded in y around inf 84.6%
Taylor expanded in z around inf 26.3%
associate-*r/26.3%
Simplified26.3%
unpow226.3%
Applied egg-rr26.3%
associate-*r*26.3%
*-un-lft-identity26.3%
times-frac28.6%
Applied egg-rr28.6%
if 0.0 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < 4e303Initial program 97.9%
if 4e303 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) Initial program 50.0%
remove-double-neg50.0%
distribute-lft-neg-out50.0%
distribute-frac-neg250.0%
distribute-frac-neg50.0%
neg-mul-150.0%
distribute-lft-neg-out50.0%
*-commutative50.0%
distribute-lft-neg-in50.0%
times-frac50.0%
metadata-eval50.0%
metadata-eval50.0%
associate--l+50.0%
fma-define55.8%
Simplified55.8%
Taylor expanded in y around inf 65.8%
unpow265.8%
unpow265.8%
difference-of-squares79.3%
Applied egg-rr79.3%
*-commutative79.3%
unpow279.3%
times-frac99.9%
Applied egg-rr99.9%
Final simplification69.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 9e+44)
(* 0.5 (/ (* (- x z) (+ x z)) y_m))
(* y_m (+ 0.5 (* 0.5 (* (/ z y_m) (/ (- x 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 <= 9e+44) {
tmp = 0.5 * (((x - z) * (x + z)) / y_m);
} else {
tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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 (y_m <= 9d+44) then
tmp = 0.5d0 * (((x - z) * (x + z)) / y_m)
else
tmp = y_m * (0.5d0 + (0.5d0 * ((z / y_m) * ((x - z) / 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 (y_m <= 9e+44) {
tmp = 0.5 * (((x - z) * (x + z)) / y_m);
} else {
tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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 y_m <= 9e+44: tmp = 0.5 * (((x - z) * (x + z)) / y_m) else: tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - 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 <= 9e+44) tmp = Float64(0.5 * Float64(Float64(Float64(x - z) * Float64(x + z)) / y_m)); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(z / y_m) * Float64(Float64(x - z) / 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 (y_m <= 9e+44) tmp = 0.5 * (((x - z) * (x + z)) / y_m); else tmp = y_m * (0.5 + (0.5 * ((z / y_m) * ((x - z) / 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[y$95$m, 9e+44], N[(0.5 * N[(N[(N[(x - z), $MachinePrecision] * N[(x + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(z / y$95$m), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $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 9 \cdot 10^{+44}:\\
\;\;\;\;0.5 \cdot \frac{\left(x - z\right) \cdot \left(x + z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{z}{y\_m} \cdot \frac{x - z}{y\_m}\right)\right)\\
\end{array}
\end{array}
if y < 9e44Initial program 78.5%
remove-double-neg78.5%
distribute-lft-neg-out78.5%
distribute-frac-neg278.5%
distribute-frac-neg78.5%
neg-mul-178.5%
distribute-lft-neg-out78.5%
*-commutative78.5%
distribute-lft-neg-in78.5%
times-frac78.5%
metadata-eval78.5%
metadata-eval78.5%
associate--l+78.5%
fma-define80.4%
Simplified80.4%
Taylor expanded in y around inf 74.0%
unpow274.0%
unpow274.0%
difference-of-squares79.8%
Applied egg-rr79.8%
Taylor expanded in y around 0 74.2%
if 9e44 < y Initial program 46.2%
remove-double-neg46.2%
distribute-lft-neg-out46.2%
distribute-frac-neg246.2%
distribute-frac-neg46.2%
neg-mul-146.2%
distribute-lft-neg-out46.2%
*-commutative46.2%
distribute-lft-neg-in46.2%
times-frac46.2%
metadata-eval46.2%
metadata-eval46.2%
associate--l+46.2%
fma-define50.1%
Simplified50.1%
Taylor expanded in y around inf 78.3%
unpow278.3%
unpow278.3%
difference-of-squares82.3%
Applied egg-rr82.3%
*-commutative82.3%
unpow282.3%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 87.9%
Final simplification76.9%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 6.5e+110)
(* 0.5 (/ (* (- x z) (+ x z)) y_m))
(* y_m (+ 0.5 (* 0.5 (* (/ (+ x z) y_m) (/ x y_m))))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 6.5e+110) {
tmp = 0.5 * (((x - z) * (x + z)) / y_m);
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (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 (y_m <= 6.5d+110) then
tmp = 0.5d0 * (((x - z) * (x + z)) / y_m)
else
tmp = y_m * (0.5d0 + (0.5d0 * (((x + z) / y_m) * (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 (y_m <= 6.5e+110) {
tmp = 0.5 * (((x - z) * (x + z)) / y_m);
} else {
tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (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 y_m <= 6.5e+110: tmp = 0.5 * (((x - z) * (x + z)) / y_m) else: tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (x / y_m)))) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 6.5e+110) tmp = Float64(0.5 * Float64(Float64(Float64(x - z) * Float64(x + z)) / y_m)); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(Float64(Float64(x + z) / y_m) * Float64(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 (y_m <= 6.5e+110) tmp = 0.5 * (((x - z) * (x + z)) / y_m); else tmp = y_m * (0.5 + (0.5 * (((x + z) / y_m) * (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[y$95$m, 6.5e+110], N[(0.5 * N[(N[(N[(x - z), $MachinePrecision] * N[(x + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(N[(N[(x + z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(x / y$95$m), $MachinePrecision]), $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.5 \cdot 10^{+110}:\\
\;\;\;\;0.5 \cdot \frac{\left(x - z\right) \cdot \left(x + z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(\frac{x + z}{y\_m} \cdot \frac{x}{y\_m}\right)\right)\\
\end{array}
\end{array}
if y < 6.4999999999999997e110Initial program 78.6%
remove-double-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg278.6%
distribute-frac-neg78.6%
neg-mul-178.6%
distribute-lft-neg-out78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
associate--l+78.6%
fma-define81.4%
Simplified81.4%
Taylor expanded in y around inf 74.4%
unpow274.4%
unpow274.4%
difference-of-squares80.9%
Applied egg-rr80.9%
Taylor expanded in y around 0 74.4%
if 6.4999999999999997e110 < y Initial program 36.4%
remove-double-neg36.4%
distribute-lft-neg-out36.4%
distribute-frac-neg236.4%
distribute-frac-neg36.4%
neg-mul-136.4%
distribute-lft-neg-out36.4%
*-commutative36.4%
distribute-lft-neg-in36.4%
times-frac36.4%
metadata-eval36.4%
metadata-eval36.4%
associate--l+36.4%
fma-define36.4%
Simplified36.4%
Taylor expanded in y around inf 77.5%
unpow277.5%
unpow277.5%
difference-of-squares77.5%
Applied egg-rr77.5%
*-commutative77.5%
unpow277.5%
times-frac100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 92.7%
Final simplification77.3%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 7e+59)
(* 0.5 (* x (/ x y_m)))
(if (<= y_m 6.5e+110) (/ (* (* 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 (y_m <= 7e+59) {
tmp = 0.5 * (x * (x / y_m));
} else if (y_m <= 6.5e+110) {
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 (y_m <= 7d+59) then
tmp = 0.5d0 * (x * (x / y_m))
else if (y_m <= 6.5d+110) 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 (y_m <= 7e+59) {
tmp = 0.5 * (x * (x / y_m));
} else if (y_m <= 6.5e+110) {
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 y_m <= 7e+59: tmp = 0.5 * (x * (x / y_m)) elif y_m <= 6.5e+110: 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 (y_m <= 7e+59) tmp = Float64(0.5 * Float64(x * Float64(x / y_m))); elseif (y_m <= 6.5e+110) tmp = Float64(Float64(Float64(z * z) * -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 (y_m <= 7e+59) tmp = 0.5 * (x * (x / y_m)); elseif (y_m <= 6.5e+110) 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[y$95$m, 7e+59], N[(0.5 * N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 6.5e+110], N[(N[(N[(z * z), $MachinePrecision] * -0.5), $MachinePrecision] / y$95$m), $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 7 \cdot 10^{+59}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\mathbf{elif}\;y\_m \leq 6.5 \cdot 10^{+110}:\\
\;\;\;\;\frac{\left(z \cdot z\right) \cdot -0.5}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 7e59Initial program 78.6%
remove-double-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg278.6%
distribute-frac-neg78.6%
neg-mul-178.6%
distribute-lft-neg-out78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
associate--l+78.6%
fma-define80.5%
Simplified80.5%
Taylor expanded in z around 0 51.3%
rem-square-sqrt51.3%
unpow251.3%
unpow251.3%
hypot-undefine51.3%
unpow251.3%
unpow251.3%
hypot-undefine51.3%
unpow251.3%
hypot-undefine51.3%
unpow251.3%
unpow251.3%
+-commutative51.3%
unpow251.3%
unpow251.3%
hypot-define51.3%
Simplified51.3%
unpow251.3%
associate-/l*61.0%
Applied egg-rr61.0%
Taylor expanded in y around 0 22.7%
Taylor expanded in y around 0 42.2%
if 7e59 < y < 6.4999999999999997e110Initial program 79.7%
remove-double-neg79.7%
distribute-lft-neg-out79.7%
distribute-frac-neg279.7%
distribute-frac-neg79.7%
neg-mul-179.7%
distribute-lft-neg-out79.7%
*-commutative79.7%
distribute-lft-neg-in79.7%
times-frac79.7%
metadata-eval79.7%
metadata-eval79.7%
associate--l+79.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in y around inf 79.5%
Taylor expanded in z around inf 66.8%
associate-*r/66.8%
Simplified66.8%
unpow266.8%
Applied egg-rr66.8%
if 6.4999999999999997e110 < y Initial program 36.4%
remove-double-neg36.4%
distribute-lft-neg-out36.4%
distribute-frac-neg236.4%
distribute-frac-neg36.4%
neg-mul-136.4%
distribute-lft-neg-out36.4%
*-commutative36.4%
distribute-lft-neg-in36.4%
times-frac36.4%
metadata-eval36.4%
metadata-eval36.4%
associate--l+36.4%
fma-define36.4%
Simplified36.4%
Taylor expanded in y around inf 79.3%
Final simplification48.9%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 9e+110) (* 0.5 (/ (* (- x z) (+ x z)) 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 (y_m <= 9e+110) {
tmp = 0.5 * (((x - z) * (x + z)) / 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 (y_m <= 9d+110) then
tmp = 0.5d0 * (((x - z) * (x + z)) / 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 (y_m <= 9e+110) {
tmp = 0.5 * (((x - z) * (x + z)) / 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 y_m <= 9e+110: tmp = 0.5 * (((x - z) * (x + z)) / 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 (y_m <= 9e+110) tmp = Float64(0.5 * Float64(Float64(Float64(x - z) * Float64(x + z)) / 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 (y_m <= 9e+110) tmp = 0.5 * (((x - z) * (x + z)) / 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[y$95$m, 9e+110], N[(0.5 * N[(N[(N[(x - z), $MachinePrecision] * N[(x + z), $MachinePrecision]), $MachinePrecision] / y$95$m), $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 9 \cdot 10^{+110}:\\
\;\;\;\;0.5 \cdot \frac{\left(x - z\right) \cdot \left(x + z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 9.0000000000000005e110Initial program 78.6%
remove-double-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg278.6%
distribute-frac-neg78.6%
neg-mul-178.6%
distribute-lft-neg-out78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
associate--l+78.6%
fma-define81.4%
Simplified81.4%
Taylor expanded in y around inf 74.4%
unpow274.4%
unpow274.4%
difference-of-squares80.9%
Applied egg-rr80.9%
Taylor expanded in y around 0 74.4%
if 9.0000000000000005e110 < y Initial program 36.4%
remove-double-neg36.4%
distribute-lft-neg-out36.4%
distribute-frac-neg236.4%
distribute-frac-neg36.4%
neg-mul-136.4%
distribute-lft-neg-out36.4%
*-commutative36.4%
distribute-lft-neg-in36.4%
times-frac36.4%
metadata-eval36.4%
metadata-eval36.4%
associate--l+36.4%
fma-define36.4%
Simplified36.4%
Taylor expanded in y around inf 79.3%
Final simplification75.2%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= (* x x) 1e-20) (* (* z -0.5) (/ z y_m)) (* 0.5 (* x (/ x y_m))))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((x * x) <= 1e-20) {
tmp = (z * -0.5) * (z / y_m);
} else {
tmp = 0.5 * (x * (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 * x) <= 1d-20) then
tmp = (z * (-0.5d0)) * (z / y_m)
else
tmp = 0.5d0 * (x * (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 * x) <= 1e-20) {
tmp = (z * -0.5) * (z / y_m);
} else {
tmp = 0.5 * (x * (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 * x) <= 1e-20: tmp = (z * -0.5) * (z / y_m) else: tmp = 0.5 * (x * (x / y_m)) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(x * x) <= 1e-20) tmp = Float64(Float64(z * -0.5) * Float64(z / y_m)); else tmp = Float64(0.5 * Float64(x * Float64(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 * x) <= 1e-20) tmp = (z * -0.5) * (z / y_m); else tmp = 0.5 * (x * (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[N[(x * x), $MachinePrecision], 1e-20], N[(N[(z * -0.5), $MachinePrecision] * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[(x / 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 \cdot x \leq 10^{-20}:\\
\;\;\;\;\left(z \cdot -0.5\right) \cdot \frac{z}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999945e-21Initial program 76.9%
remove-double-neg76.9%
distribute-lft-neg-out76.9%
distribute-frac-neg276.9%
distribute-frac-neg76.9%
neg-mul-176.9%
distribute-lft-neg-out76.9%
*-commutative76.9%
distribute-lft-neg-in76.9%
times-frac76.9%
metadata-eval76.9%
metadata-eval76.9%
associate--l+76.9%
fma-define76.9%
Simplified76.9%
Taylor expanded in y around inf 82.6%
Taylor expanded in z around inf 51.3%
associate-*r/51.2%
Simplified51.2%
unpow251.2%
Applied egg-rr51.2%
associate-*r*51.2%
*-un-lft-identity51.2%
times-frac56.3%
Applied egg-rr56.3%
if 9.99999999999999945e-21 < (*.f64 x x) Initial program 67.6%
remove-double-neg67.6%
distribute-lft-neg-out67.6%
distribute-frac-neg267.6%
distribute-frac-neg67.6%
neg-mul-167.6%
distribute-lft-neg-out67.6%
*-commutative67.6%
distribute-lft-neg-in67.6%
times-frac67.6%
metadata-eval67.6%
metadata-eval67.6%
associate--l+67.6%
fma-define72.1%
Simplified72.1%
Taylor expanded in z around 0 65.6%
rem-square-sqrt65.6%
unpow265.6%
unpow265.6%
hypot-undefine65.6%
unpow265.6%
unpow265.6%
hypot-undefine65.6%
unpow265.6%
hypot-undefine65.6%
unpow265.6%
unpow265.6%
+-commutative65.6%
unpow265.6%
unpow265.6%
hypot-define65.6%
Simplified65.6%
unpow265.6%
associate-/l*82.8%
Applied egg-rr82.8%
Taylor expanded in y around 0 32.5%
Taylor expanded in y around 0 62.0%
Final simplification59.3%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= y_m 9.2e+110) (* 0.5 (* x (/ x 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 (y_m <= 9.2e+110) {
tmp = 0.5 * (x * (x / 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 (y_m <= 9.2d+110) then
tmp = 0.5d0 * (x * (x / 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 (y_m <= 9.2e+110) {
tmp = 0.5 * (x * (x / 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 y_m <= 9.2e+110: tmp = 0.5 * (x * (x / 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 (y_m <= 9.2e+110) tmp = Float64(0.5 * Float64(x * Float64(x / 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 (y_m <= 9.2e+110) tmp = 0.5 * (x * (x / 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[y$95$m, 9.2e+110], N[(0.5 * N[(x * N[(x / 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}\;y\_m \leq 9.2 \cdot 10^{+110}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{x}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 9.2000000000000001e110Initial program 78.6%
remove-double-neg78.6%
distribute-lft-neg-out78.6%
distribute-frac-neg278.6%
distribute-frac-neg78.6%
neg-mul-178.6%
distribute-lft-neg-out78.6%
*-commutative78.6%
distribute-lft-neg-in78.6%
times-frac78.6%
metadata-eval78.6%
metadata-eval78.6%
associate--l+78.6%
fma-define81.4%
Simplified81.4%
Taylor expanded in z around 0 50.2%
rem-square-sqrt50.2%
unpow250.2%
unpow250.2%
hypot-undefine50.2%
unpow250.2%
unpow250.2%
hypot-undefine50.2%
unpow250.2%
hypot-undefine50.2%
unpow250.2%
unpow250.2%
+-commutative50.2%
unpow250.2%
unpow250.2%
hypot-define50.2%
Simplified50.2%
unpow250.2%
associate-/l*59.5%
Applied egg-rr59.5%
Taylor expanded in y around 0 22.6%
Taylor expanded in y around 0 40.7%
if 9.2000000000000001e110 < y Initial program 36.4%
remove-double-neg36.4%
distribute-lft-neg-out36.4%
distribute-frac-neg236.4%
distribute-frac-neg36.4%
neg-mul-136.4%
distribute-lft-neg-out36.4%
*-commutative36.4%
distribute-lft-neg-in36.4%
times-frac36.4%
metadata-eval36.4%
metadata-eval36.4%
associate--l+36.4%
fma-define36.4%
Simplified36.4%
Taylor expanded in y around inf 79.3%
Final simplification46.8%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) 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.0%
remove-double-neg72.0%
distribute-lft-neg-out72.0%
distribute-frac-neg272.0%
distribute-frac-neg72.0%
neg-mul-172.0%
distribute-lft-neg-out72.0%
*-commutative72.0%
distribute-lft-neg-in72.0%
times-frac72.0%
metadata-eval72.0%
metadata-eval72.0%
associate--l+72.0%
fma-define74.4%
Simplified74.4%
Taylor expanded in y around inf 30.2%
Final simplification30.2%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* x 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 * (x * 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 * (x * 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 * (x * 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 * (x * 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(x * 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 * (x * 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[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 72.0%
remove-double-neg72.0%
distribute-lft-neg-out72.0%
distribute-frac-neg272.0%
distribute-frac-neg72.0%
neg-mul-172.0%
distribute-lft-neg-out72.0%
*-commutative72.0%
distribute-lft-neg-in72.0%
times-frac72.0%
metadata-eval72.0%
metadata-eval72.0%
associate--l+72.0%
fma-define74.4%
Simplified74.4%
Taylor expanded in z around 0 47.3%
rem-square-sqrt47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
+-commutative47.3%
unpow247.3%
unpow247.3%
hypot-define47.3%
Simplified47.3%
unpow247.3%
associate-/l*64.3%
Applied egg-rr64.3%
Taylor expanded in y around 0 20.1%
Taylor expanded in y around inf 2.7%
Final simplification2.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (* x -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 * (x * -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 * (x * (-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 * (x * -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 * (x * -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(x * -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 * (x * -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[(x * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(x \cdot -0.5\right)
\end{array}
Initial program 72.0%
remove-double-neg72.0%
distribute-lft-neg-out72.0%
distribute-frac-neg272.0%
distribute-frac-neg72.0%
neg-mul-172.0%
distribute-lft-neg-out72.0%
*-commutative72.0%
distribute-lft-neg-in72.0%
times-frac72.0%
metadata-eval72.0%
metadata-eval72.0%
associate--l+72.0%
fma-define74.4%
Simplified74.4%
Taylor expanded in z around 0 47.3%
rem-square-sqrt47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
hypot-undefine47.3%
unpow247.3%
unpow247.3%
+-commutative47.3%
unpow247.3%
unpow247.3%
hypot-define47.3%
Simplified47.3%
unpow247.3%
associate-/l*64.3%
Applied egg-rr64.3%
Taylor expanded in y around 0 20.1%
Taylor expanded in y around -inf 3.2%
Final simplification3.2%
(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 2024145
(FPCore (x y z)
:name "Diagrams.TwoD.Apollonian:initialConfig from diagrams-contrib-1.3.0.5, A"
:precision binary64
:alt
(! :herbie-platform default (- (* y 1/2) (* (* (/ 1/2 y) (+ z x)) (- z x))))
(/ (- (+ (* x x) (* y y)) (* z z)) (* y 2.0)))