
(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 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (- x z) y_m)))
(*
y_s
(if (<= y_m 1.12e-131)
(* 0.5 (* (+ x z) t_0))
(* y_m (+ 0.5 (* 0.5 (* t_0 (/ (+ 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 - z) / y_m;
double tmp;
if (y_m <= 1.12e-131) {
tmp = 0.5 * ((x + z) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * ((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 - z) / y_m
if (y_m <= 1.12d-131) then
tmp = 0.5d0 * ((x + z) * t_0)
else
tmp = y_m * (0.5d0 + (0.5d0 * (t_0 * ((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 - z) / y_m;
double tmp;
if (y_m <= 1.12e-131) {
tmp = 0.5 * ((x + z) * t_0);
} else {
tmp = y_m * (0.5 + (0.5 * (t_0 * ((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 - z) / y_m tmp = 0 if y_m <= 1.12e-131: tmp = 0.5 * ((x + z) * t_0) else: tmp = y_m * (0.5 + (0.5 * (t_0 * ((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(x - z) / y_m) tmp = 0.0 if (y_m <= 1.12e-131) tmp = Float64(0.5 * Float64(Float64(x + z) * t_0)); else tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(t_0 * 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 - z) / y_m; tmp = 0.0; if (y_m <= 1.12e-131) tmp = 0.5 * ((x + z) * t_0); else tmp = y_m * (0.5 + (0.5 * (t_0 * ((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[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.12e-131], N[(0.5 * N[(N[(x + z), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(y$95$m * N[(0.5 + N[(0.5 * N[(t$95$0 * 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{x - z}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.12 \cdot 10^{-131}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_0 \cdot \frac{x + z}{y\_m}\right)\right)\\
\end{array}
\end{array}
\end{array}
if y < 1.12000000000000001e-131Initial 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-define79.8%
Simplified79.8%
Taylor expanded in y around inf 73.2%
pow273.2%
unpow273.2%
difference-of-squares75.1%
Applied egg-rr75.1%
Taylor expanded in y around 0 69.2%
associate-/l*72.5%
Simplified72.5%
if 1.12000000000000001e-131 < y Initial program 58.5%
remove-double-neg58.5%
distribute-lft-neg-out58.5%
distribute-frac-neg258.5%
distribute-frac-neg58.5%
neg-mul-158.5%
distribute-lft-neg-out58.5%
*-commutative58.5%
distribute-lft-neg-in58.5%
times-frac58.5%
metadata-eval58.5%
metadata-eval58.5%
associate--l+58.5%
fma-define59.4%
Simplified59.4%
Taylor expanded in y around inf 73.2%
pow273.2%
unpow273.2%
difference-of-squares77.2%
Applied egg-rr77.2%
*-commutative77.2%
pow277.2%
times-frac99.8%
Applied egg-rr99.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 5e+265)
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 (* (/ (- x z) y_m) (/ 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 <= 5e+265) {
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 * (((x - z) / y_m) * (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 <= 5e+265) {
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 * (((x - z) / y_m) * (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 <= 5e+265: 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 * (((x - z) / y_m) * (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 <= 5e+265) 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(Float64(x - z) / y_m) * Float64(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 <= 5e+265) 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 * (((x - z) / y_m) * (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, 5e+265], 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[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision] * N[(z / 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 5 \cdot 10^{+265}:\\
\;\;\;\;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{x - z}{y\_m} \cdot \frac{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))) < 5.0000000000000002e265Initial program 85.0%
if 5.0000000000000002e265 < (/.f64 (-.f64 (+.f64 (*.f64 x x) (*.f64 y y)) (*.f64 z z)) (*.f64 y #s(literal 2 binary64))) < +inf.0Initial program 63.4%
remove-double-neg63.4%
distribute-lft-neg-out63.4%
distribute-frac-neg263.4%
distribute-frac-neg63.4%
neg-mul-163.4%
distribute-lft-neg-out63.4%
*-commutative63.4%
distribute-lft-neg-in63.4%
times-frac63.4%
metadata-eval63.4%
metadata-eval63.4%
associate--l+63.4%
fma-define63.4%
Simplified63.4%
Taylor expanded in y around inf 83.1%
pow283.1%
unpow283.1%
difference-of-squares83.1%
Applied egg-rr83.1%
*-commutative83.1%
pow283.1%
times-frac100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf 68.7%
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-define12.5%
Simplified12.5%
Taylor expanded in y around inf 0.0%
pow20.0%
unpow20.0%
difference-of-squares29.2%
Applied egg-rr29.2%
*-commutative29.2%
pow229.2%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 79.7%
Final simplification79.7%
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 z) y_m)))
(*
y_s
(if (<= y_m 1.9e+27)
(* 0.5 (* (+ x z) t_0))
(if (<= y_m 2.35e+148)
(* y_m (+ 0.5 (* 0.5 (* t_0 (/ 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 t_0 = (x - z) / y_m;
double tmp;
if (y_m <= 1.9e+27) {
tmp = 0.5 * ((x + z) * t_0);
} else if (y_m <= 2.35e+148) {
tmp = y_m * (0.5 + (0.5 * (t_0 * (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) :: t_0
real(8) :: tmp
t_0 = (x - z) / y_m
if (y_m <= 1.9d+27) then
tmp = 0.5d0 * ((x + z) * t_0)
else if (y_m <= 2.35d+148) then
tmp = y_m * (0.5d0 + (0.5d0 * (t_0 * (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 t_0 = (x - z) / y_m;
double tmp;
if (y_m <= 1.9e+27) {
tmp = 0.5 * ((x + z) * t_0);
} else if (y_m <= 2.35e+148) {
tmp = y_m * (0.5 + (0.5 * (t_0 * (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): t_0 = (x - z) / y_m tmp = 0 if y_m <= 1.9e+27: tmp = 0.5 * ((x + z) * t_0) elif y_m <= 2.35e+148: tmp = y_m * (0.5 + (0.5 * (t_0 * (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) t_0 = Float64(Float64(x - z) / y_m) tmp = 0.0 if (y_m <= 1.9e+27) tmp = Float64(0.5 * Float64(Float64(x + z) * t_0)); elseif (y_m <= 2.35e+148) tmp = Float64(y_m * Float64(0.5 + Float64(0.5 * Float64(t_0 * Float64(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) t_0 = (x - z) / y_m; tmp = 0.0; if (y_m <= 1.9e+27) tmp = 0.5 * ((x + z) * t_0); elseif (y_m <= 2.35e+148) tmp = y_m * (0.5 + (0.5 * (t_0 * (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_] := Block[{t$95$0 = N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[y$95$m, 1.9e+27], N[(0.5 * N[(N[(x + z), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$95$m, 2.35e+148], N[(y$95$m * N[(0.5 + N[(0.5 * N[(t$95$0 * N[(z / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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)
\\
\begin{array}{l}
t_0 := \frac{x - z}{y\_m}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 1.9 \cdot 10^{+27}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot t\_0\right)\\
\mathbf{elif}\;y\_m \leq 2.35 \cdot 10^{+148}:\\
\;\;\;\;y\_m \cdot \left(0.5 + 0.5 \cdot \left(t\_0 \cdot \frac{z}{y\_m}\right)\right)\\
\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}
\end{array}
if y < 1.90000000000000011e27Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-frac-neg281.5%
distribute-frac-neg81.5%
neg-mul-181.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
distribute-lft-neg-in81.5%
times-frac81.5%
metadata-eval81.5%
metadata-eval81.5%
associate--l+81.5%
fma-define83.1%
Simplified83.1%
Taylor expanded in y around inf 77.1%
pow277.1%
unpow277.1%
difference-of-squares79.8%
Applied egg-rr79.8%
Taylor expanded in y around 0 73.5%
associate-/l*76.2%
Simplified76.2%
if 1.90000000000000011e27 < y < 2.3499999999999999e148Initial program 87.3%
remove-double-neg87.3%
distribute-lft-neg-out87.3%
distribute-frac-neg287.3%
distribute-frac-neg87.3%
neg-mul-187.3%
distribute-lft-neg-out87.3%
*-commutative87.3%
distribute-lft-neg-in87.3%
times-frac87.3%
metadata-eval87.3%
metadata-eval87.3%
associate--l+87.3%
fma-define87.3%
Simplified87.3%
Taylor expanded in y around inf 87.2%
pow287.2%
unpow287.2%
difference-of-squares95.9%
Applied egg-rr95.9%
*-commutative95.9%
pow295.9%
times-frac99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 87.3%
if 2.3499999999999999e148 < y Initial program 12.0%
remove-double-neg12.0%
distribute-lft-neg-out12.0%
distribute-frac-neg212.0%
distribute-frac-neg12.0%
neg-mul-112.0%
distribute-lft-neg-out12.0%
*-commutative12.0%
distribute-lft-neg-in12.0%
times-frac12.0%
metadata-eval12.0%
metadata-eval12.0%
associate--l+12.0%
fma-define12.0%
Simplified12.0%
Taylor expanded in y around inf 47.6%
pow247.6%
unpow247.6%
difference-of-squares47.6%
Applied egg-rr47.6%
*-commutative47.6%
pow247.6%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 88.0%
Final simplification79.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 (<= y_m 4.2e+66)
(* 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 <= 4.2e+66) {
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 <= 4.2d+66) 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 <= 4.2e+66) {
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 <= 4.2e+66: 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 <= 4.2e+66) tmp = Float64(0.5 * Float64(Float64(x + z) * Float64(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 <= 4.2e+66) 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, 4.2e+66], N[(0.5 * N[(N[(x + z), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / y$95$m), $MachinePrecision]), $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 4.2 \cdot 10^{+66}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot \frac{x - z}{y\_m}\right)\\
\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 < 4.20000000000000011e66Initial program 81.4%
remove-double-neg81.4%
distribute-lft-neg-out81.4%
distribute-frac-neg281.4%
distribute-frac-neg81.4%
neg-mul-181.4%
distribute-lft-neg-out81.4%
*-commutative81.4%
distribute-lft-neg-in81.4%
times-frac81.4%
metadata-eval81.4%
metadata-eval81.4%
associate--l+81.4%
fma-define82.9%
Simplified82.9%
Taylor expanded in y around inf 77.2%
pow277.2%
unpow277.2%
difference-of-squares80.2%
Applied egg-rr80.2%
Taylor expanded in y around 0 72.8%
associate-/l*75.9%
Simplified75.9%
if 4.20000000000000011e66 < y Initial program 32.2%
remove-double-neg32.2%
distribute-lft-neg-out32.2%
distribute-frac-neg232.2%
distribute-frac-neg32.2%
neg-mul-132.2%
distribute-lft-neg-out32.2%
*-commutative32.2%
distribute-lft-neg-in32.2%
times-frac32.2%
metadata-eval32.2%
metadata-eval32.2%
associate--l+32.2%
fma-define32.2%
Simplified32.2%
Taylor expanded in y around inf 58.9%
pow258.9%
unpow258.9%
difference-of-squares60.7%
Applied egg-rr60.7%
*-commutative60.7%
pow260.7%
times-frac99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 80.5%
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 1.95e+149) (* 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 <= 1.95e+149) {
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 <= 1.95d+149) 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 <= 1.95e+149) {
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 <= 1.95e+149: 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 <= 1.95e+149) tmp = Float64(0.5 * Float64(Float64(x + z) * Float64(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 <= 1.95e+149) 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, 1.95e+149], N[(0.5 * N[(N[(x + z), $MachinePrecision] * N[(N[(x - z), $MachinePrecision] / 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 1.95 \cdot 10^{+149}:\\
\;\;\;\;0.5 \cdot \left(\left(x + z\right) \cdot \frac{x - z}{y\_m}\right)\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.95e149Initial program 82.1%
remove-double-neg82.1%
distribute-lft-neg-out82.1%
distribute-frac-neg282.1%
distribute-frac-neg82.1%
neg-mul-182.1%
distribute-lft-neg-out82.1%
*-commutative82.1%
distribute-lft-neg-in82.1%
times-frac82.1%
metadata-eval82.1%
metadata-eval82.1%
associate--l+82.1%
fma-define83.5%
Simplified83.5%
Taylor expanded in y around inf 78.2%
pow278.2%
unpow278.2%
difference-of-squares81.5%
Applied egg-rr81.5%
Taylor expanded in y around 0 71.9%
associate-/l*74.8%
Simplified74.8%
if 1.95e149 < y Initial program 12.0%
remove-double-neg12.0%
distribute-lft-neg-out12.0%
distribute-frac-neg212.0%
distribute-frac-neg12.0%
neg-mul-112.0%
distribute-lft-neg-out12.0%
*-commutative12.0%
distribute-lft-neg-in12.0%
times-frac12.0%
metadata-eval12.0%
metadata-eval12.0%
associate--l+12.0%
fma-define12.0%
Simplified12.0%
Taylor expanded in y around inf 68.3%
Final simplification73.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 (if (<= y_m 1.75e+68) (* 0.5 (/ (* 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 <= 1.75e+68) {
tmp = 0.5 * ((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 <= 1.75d+68) then
tmp = 0.5d0 * ((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 <= 1.75e+68) {
tmp = 0.5 * ((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 <= 1.75e+68: tmp = 0.5 * ((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 <= 1.75e+68) tmp = Float64(0.5 * Float64(Float64(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 <= 1.75e+68) tmp = 0.5 * ((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, 1.75e+68], N[(0.5 * N[(N[(z * 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 1.75 \cdot 10^{+68}:\\
\;\;\;\;0.5 \cdot \frac{z \cdot \left(x - z\right)}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 1.74999999999999989e68Initial program 81.4%
remove-double-neg81.4%
distribute-lft-neg-out81.4%
distribute-frac-neg281.4%
distribute-frac-neg81.4%
neg-mul-181.4%
distribute-lft-neg-out81.4%
*-commutative81.4%
distribute-lft-neg-in81.4%
times-frac81.4%
metadata-eval81.4%
metadata-eval81.4%
associate--l+81.4%
fma-define82.9%
Simplified82.9%
Taylor expanded in y around inf 77.2%
pow277.2%
unpow277.2%
difference-of-squares80.2%
Applied egg-rr80.2%
Taylor expanded in y around 0 72.8%
Taylor expanded in x around 0 44.0%
if 1.74999999999999989e68 < y Initial program 32.2%
remove-double-neg32.2%
distribute-lft-neg-out32.2%
distribute-frac-neg232.2%
distribute-frac-neg32.2%
neg-mul-132.2%
distribute-lft-neg-out32.2%
*-commutative32.2%
distribute-lft-neg-in32.2%
times-frac32.2%
metadata-eval32.2%
metadata-eval32.2%
associate--l+32.2%
fma-define32.2%
Simplified32.2%
Taylor expanded in y around inf 62.2%
Final simplification48.0%
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 2.1e+79) (/ 0.5 (/ (/ y_m x) x)) (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.1e+79) {
tmp = 0.5 / ((y_m / x) / x);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.1d+79) then
tmp = 0.5d0 / ((y_m / x) / x)
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.1e+79) {
tmp = 0.5 / ((y_m / x) / x);
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 2.1e+79: tmp = 0.5 / ((y_m / x) / x) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 2.1e+79) tmp = Float64(0.5 / Float64(Float64(y_m / x) / x)); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 2.1e+79) tmp = 0.5 / ((y_m / x) / x); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.1e+79], N[(0.5 / N[(N[(y$95$m / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(y$95$m * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2.1 \cdot 10^{+79}:\\
\;\;\;\;\frac{0.5}{\frac{\frac{y\_m}{x}}{x}}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 2.10000000000000008e79Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-frac-neg281.5%
distribute-frac-neg81.5%
neg-mul-181.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
distribute-lft-neg-in81.5%
times-frac81.5%
metadata-eval81.5%
metadata-eval81.5%
associate--l+81.5%
fma-define83.0%
Simplified83.0%
clear-num82.9%
un-div-inv82.9%
fma-undefine81.4%
associate--l+81.4%
add-sqr-sqrt81.4%
pow281.4%
hypot-define81.4%
pow281.4%
Applied egg-rr81.4%
Taylor expanded in x around inf 35.9%
*-un-lft-identity35.9%
pow235.9%
times-frac37.1%
Applied egg-rr37.1%
associate-*l/37.1%
*-lft-identity37.1%
Simplified37.1%
if 2.10000000000000008e79 < y Initial program 31.0%
remove-double-neg31.0%
distribute-lft-neg-out31.0%
distribute-frac-neg231.0%
distribute-frac-neg31.0%
neg-mul-131.0%
distribute-lft-neg-out31.0%
*-commutative31.0%
distribute-lft-neg-in31.0%
times-frac31.0%
metadata-eval31.0%
metadata-eval31.0%
associate--l+31.0%
fma-define31.0%
Simplified31.0%
Taylor expanded in y around inf 63.2%
Final simplification42.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 (if (<= y_m 2.05e+27) (/ 0.5 (/ y_m (* x x))) (* y_m 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.05e+27) {
tmp = 0.5 / (y_m / (x * x));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y)
y\_s = copysign(1.0d0, y)
real(8) function code(y_s, x, y_m, z)
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2.05d+27) then
tmp = 0.5d0 / (y_m / (x * x))
else
tmp = y_m * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2.05e+27) {
tmp = 0.5 / (y_m / (x * x));
} else {
tmp = y_m * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 2.05e+27: tmp = 0.5 / (y_m / (x * x)) else: tmp = y_m * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 2.05e+27) tmp = Float64(0.5 / Float64(y_m / Float64(x * x))); else tmp = Float64(y_m * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 2.05e+27) tmp = 0.5 / (y_m / (x * x)); else tmp = y_m * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2.05e+27], N[(0.5 / N[(y$95$m / N[(x * x), $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 2.05 \cdot 10^{+27}:\\
\;\;\;\;\frac{0.5}{\frac{y\_m}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot 0.5\\
\end{array}
\end{array}
if y < 2.0500000000000001e27Initial program 81.5%
remove-double-neg81.5%
distribute-lft-neg-out81.5%
distribute-frac-neg281.5%
distribute-frac-neg81.5%
neg-mul-181.5%
distribute-lft-neg-out81.5%
*-commutative81.5%
distribute-lft-neg-in81.5%
times-frac81.5%
metadata-eval81.5%
metadata-eval81.5%
associate--l+81.5%
fma-define83.1%
Simplified83.1%
clear-num83.0%
un-div-inv83.0%
fma-undefine81.5%
associate--l+81.5%
add-sqr-sqrt81.5%
pow281.5%
hypot-define81.5%
pow281.5%
Applied egg-rr81.5%
Taylor expanded in x around inf 36.2%
pow236.2%
Applied egg-rr36.2%
if 2.0500000000000001e27 < y Initial program 38.6%
remove-double-neg38.6%
distribute-lft-neg-out38.6%
distribute-frac-neg238.6%
distribute-frac-neg38.6%
neg-mul-138.6%
distribute-lft-neg-out38.6%
*-commutative38.6%
distribute-lft-neg-in38.6%
times-frac38.6%
metadata-eval38.6%
metadata-eval38.6%
associate--l+38.6%
fma-define38.6%
Simplified38.6%
Taylor expanded in y around inf 56.8%
Final simplification41.4%
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 70.6%
remove-double-neg70.6%
distribute-lft-neg-out70.6%
distribute-frac-neg270.6%
distribute-frac-neg70.6%
neg-mul-170.6%
distribute-lft-neg-out70.6%
*-commutative70.6%
distribute-lft-neg-in70.6%
times-frac70.6%
metadata-eval70.6%
metadata-eval70.6%
associate--l+70.6%
fma-define71.8%
Simplified71.8%
Taylor expanded in y around inf 33.2%
Final simplification33.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 2024181
(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)))