(FPCore (g h a) :precision binary64 (+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))
(FPCore (g h a) :precision binary64 (+ (* (cbrt (pow (sqrt (- (hypot g h) g)) 2.0)) (/ (cbrt 0.5) (cbrt a))) (* (cbrt (/ -0.5 a)) (cbrt (+ g (hypot g h))))))
double code(double g, double h, double a) {
return cbrt(((1.0 / (2.0 * a)) * (-g + sqrt(((g * g) - (h * h)))))) + cbrt(((1.0 / (2.0 * a)) * (-g - sqrt(((g * g) - (h * h))))));
}
double code(double g, double h, double a) {
return (cbrt(pow(sqrt((hypot(g, h) - g)), 2.0)) * (cbrt(0.5) / cbrt(a))) + (cbrt((-0.5 / a)) * cbrt((g + hypot(g, h))));
}
public static double code(double g, double h, double a) {
return Math.cbrt(((1.0 / (2.0 * a)) * (-g + Math.sqrt(((g * g) - (h * h)))))) + Math.cbrt(((1.0 / (2.0 * a)) * (-g - Math.sqrt(((g * g) - (h * h))))));
}
public static double code(double g, double h, double a) {
return (Math.cbrt(Math.pow(Math.sqrt((Math.hypot(g, h) - g)), 2.0)) * (Math.cbrt(0.5) / Math.cbrt(a))) + (Math.cbrt((-0.5 / a)) * Math.cbrt((g + Math.hypot(g, h))));
}
function code(g, h, a) return Float64(cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(Float64(-g) + sqrt(Float64(Float64(g * g) - Float64(h * h)))))) + cbrt(Float64(Float64(1.0 / Float64(2.0 * a)) * Float64(Float64(-g) - sqrt(Float64(Float64(g * g) - Float64(h * h))))))) end
function code(g, h, a) return Float64(Float64(cbrt((sqrt(Float64(hypot(g, h) - g)) ^ 2.0)) * Float64(cbrt(0.5) / cbrt(a))) + Float64(cbrt(Float64(-0.5 / a)) * cbrt(Float64(g + hypot(g, h))))) end
code[g_, h_, a_] := N[(N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[((-g) + N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision] + N[Power[N[(N[(1.0 / N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * N[((-g) - N[Sqrt[N[(N[(g * g), $MachinePrecision] - N[(h * h), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
code[g_, h_, a_] := N[(N[(N[Power[N[Power[N[Sqrt[N[(N[Sqrt[g ^ 2 + h ^ 2], $MachinePrecision] - g), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[(N[Power[0.5, 1/3], $MachinePrecision] / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[(-0.5 / a), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(g + N[Sqrt[g ^ 2 + h ^ 2], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) + \sqrt{g \cdot g - h \cdot h}\right)} + \sqrt[3]{\frac{1}{2 \cdot a} \cdot \left(\left(-g\right) - \sqrt{g \cdot g - h \cdot h}\right)}
\sqrt[3]{{\left(\sqrt{\mathsf{hypot}\left(g, h\right) - g}\right)}^{2}} \cdot \frac{\sqrt[3]{0.5}}{\sqrt[3]{a}} + \sqrt[3]{\frac{-0.5}{a}} \cdot \sqrt[3]{g + \mathsf{hypot}\left(g, h\right)}



Bits error versus g



Bits error versus h



Bits error versus a
Results
Initial program 36.4
Simplified36.4
Applied egg-rr34.3
Applied egg-rr3.0
Applied egg-rr3.0
Applied egg-rr3.0
Final simplification3.0
herbie shell --seed 2022148
(FPCore (g h a)
:name "2-ancestry mixing, positive discriminant"
:precision binary64
(+ (cbrt (* (/ 1.0 (* 2.0 a)) (+ (- g) (sqrt (- (* g g) (* h h)))))) (cbrt (* (/ 1.0 (* 2.0 a)) (- (- g) (sqrt (- (* g g) (* h h))))))))