(FPCore (a b) :precision binary64 (sqrt (fabs (/ (- (* a a) (* b b)) (* a a)))))
(FPCore (a b) :precision binary64 (let* ((t_0 (pow (/ b a) 2.0)) (t_1 (+ t_0 1.0))) (sqrt (fabs (* t_1 (+ -1.0 (exp (log1p (/ (+ t_0 -1.0) t_1)))))))))
double code(double a, double b) {
return sqrt(fabs((((a * a) - (b * b)) / (a * a))));
}
double code(double a, double b) {
double t_0 = pow((b / a), 2.0);
double t_1 = t_0 + 1.0;
return sqrt(fabs((t_1 * (-1.0 + exp(log1p(((t_0 + -1.0) / t_1)))))));
}
public static double code(double a, double b) {
return Math.sqrt(Math.abs((((a * a) - (b * b)) / (a * a))));
}
public static double code(double a, double b) {
double t_0 = Math.pow((b / a), 2.0);
double t_1 = t_0 + 1.0;
return Math.sqrt(Math.abs((t_1 * (-1.0 + Math.exp(Math.log1p(((t_0 + -1.0) / t_1)))))));
}
def code(a, b): return math.sqrt(math.fabs((((a * a) - (b * b)) / (a * a))))
def code(a, b): t_0 = math.pow((b / a), 2.0) t_1 = t_0 + 1.0 return math.sqrt(math.fabs((t_1 * (-1.0 + math.exp(math.log1p(((t_0 + -1.0) / t_1)))))))
function code(a, b) return sqrt(abs(Float64(Float64(Float64(a * a) - Float64(b * b)) / Float64(a * a)))) end
function code(a, b) t_0 = Float64(b / a) ^ 2.0 t_1 = Float64(t_0 + 1.0) return sqrt(abs(Float64(t_1 * Float64(-1.0 + exp(log1p(Float64(Float64(t_0 + -1.0) / t_1))))))) end
code[a_, b_] := N[Sqrt[N[Abs[N[(N[(N[(a * a), $MachinePrecision] - N[(b * b), $MachinePrecision]), $MachinePrecision] / N[(a * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
code[a_, b_] := Block[{t$95$0 = N[Power[N[(b / a), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + 1.0), $MachinePrecision]}, N[Sqrt[N[Abs[N[(t$95$1 * N[(-1.0 + N[Exp[N[Log[1 + N[(N[(t$95$0 + -1.0), $MachinePrecision] / t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\sqrt{\left|\frac{a \cdot a - b \cdot b}{a \cdot a}\right|}
\begin{array}{l}
t_0 := {\left(\frac{b}{a}\right)}^{2}\\
t_1 := t_0 + 1\\
\sqrt{\left|t_1 \cdot \left(-1 + e^{\mathsf{log1p}\left(\frac{t_0 + -1}{t_1}\right)}\right)\right|}
\end{array}
Results
Initial program 13.8
Simplified13.8
Applied egg-rr0.0
Applied egg-rr0.0
Applied egg-rr0.0
Applied egg-rr0.0
Final simplification0.0
herbie shell --seed 2022209
(FPCore (a b)
:name "Eccentricity of an ellipse"
:precision binary64
:pre (and (and (<= 0.0 b) (<= b a)) (<= a 1.0))
(sqrt (fabs (/ (- (* a a) (* b b)) (* a a)))))