(FPCore (x)
:precision binary64
(*
(* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x))))
(+
(+
(+
(/ 1.0 (fabs x))
(*
(/ 1.0 2.0)
(* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))
(*
(/ 3.0 4.0)
(*
(*
(* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))))
(*
(/ 15.0 8.0)
(*
(*
(*
(*
(* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))
(/ 1.0 (fabs x)))))))(FPCore (x) :precision binary64 (* (/ (pow (exp x) x) (pow (pow PI 0.25) 2.0)) (+ (/ (+ 1.0 (/ 0.5 (* x x))) (fabs x)) (log1p (expm1 (* (pow x -5.0) (+ 0.75 (* 1.875 (pow x -2.0)))))))))
double code(double x) {
return ((1.0 / sqrt(((double) M_PI))) * exp((fabs(x) * fabs(x)))) * ((((1.0 / fabs(x)) + ((1.0 / 2.0) * (((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))))) + ((3.0 / 4.0) * (((((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))))) + ((15.0 / 8.0) * (((((((1.0 / fabs(x)) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x))) * (1.0 / fabs(x)))));
}
double code(double x) {
return (pow(exp(x), x) / pow(pow(((double) M_PI), 0.25), 2.0)) * (((1.0 + (0.5 / (x * x))) / fabs(x)) + log1p(expm1((pow(x, -5.0) * (0.75 + (1.875 * pow(x, -2.0)))))));
}
public static double code(double x) {
return ((1.0 / Math.sqrt(Math.PI)) * Math.exp((Math.abs(x) * Math.abs(x)))) * ((((1.0 / Math.abs(x)) + ((1.0 / 2.0) * (((1.0 / Math.abs(x)) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))))) + ((3.0 / 4.0) * (((((1.0 / Math.abs(x)) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))))) + ((15.0 / 8.0) * (((((((1.0 / Math.abs(x)) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x))) * (1.0 / Math.abs(x)))));
}
public static double code(double x) {
return (Math.pow(Math.exp(x), x) / Math.pow(Math.pow(Math.PI, 0.25), 2.0)) * (((1.0 + (0.5 / (x * x))) / Math.abs(x)) + Math.log1p(Math.expm1((Math.pow(x, -5.0) * (0.75 + (1.875 * Math.pow(x, -2.0)))))));
}
def code(x): return ((1.0 / math.sqrt(math.pi)) * math.exp((math.fabs(x) * math.fabs(x)))) * ((((1.0 / math.fabs(x)) + ((1.0 / 2.0) * (((1.0 / math.fabs(x)) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))))) + ((3.0 / 4.0) * (((((1.0 / math.fabs(x)) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))))) + ((15.0 / 8.0) * (((((((1.0 / math.fabs(x)) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x))) * (1.0 / math.fabs(x)))))
def code(x): return (math.pow(math.exp(x), x) / math.pow(math.pow(math.pi, 0.25), 2.0)) * (((1.0 + (0.5 / (x * x))) / math.fabs(x)) + math.log1p(math.expm1((math.pow(x, -5.0) * (0.75 + (1.875 * math.pow(x, -2.0)))))))
function code(x) return Float64(Float64(Float64(1.0 / sqrt(pi)) * exp(Float64(abs(x) * abs(x)))) * Float64(Float64(Float64(Float64(1.0 / abs(x)) + Float64(Float64(1.0 / 2.0) * Float64(Float64(Float64(1.0 / abs(x)) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))))) + Float64(Float64(3.0 / 4.0) * Float64(Float64(Float64(Float64(Float64(1.0 / abs(x)) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))))) + Float64(Float64(15.0 / 8.0) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(1.0 / abs(x)) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x))) * Float64(1.0 / abs(x)))))) end
function code(x) return Float64(Float64((exp(x) ^ x) / ((pi ^ 0.25) ^ 2.0)) * Float64(Float64(Float64(1.0 + Float64(0.5 / Float64(x * x))) / abs(x)) + log1p(expm1(Float64((x ^ -5.0) * Float64(0.75 + Float64(1.875 * (x ^ -2.0)))))))) end
code[x_] := N[(N[(N[(1.0 / N[Sqrt[Pi], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / 2.0), $MachinePrecision] * N[(N[(N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(3.0 / 4.0), $MachinePrecision] * N[(N[(N[(N[(N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(15.0 / 8.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision] / N[Power[N[Power[Pi, 0.25], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 + N[(0.5 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision] + N[Log[1 + N[(Exp[N[(N[Power[x, -5.0], $MachinePrecision] * N[(0.75 + N[(1.875 * N[Power[x, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\frac{1}{\sqrt{\pi}} \cdot e^{\left|x\right| \cdot \left|x\right|}\right) \cdot \left(\left(\left(\frac{1}{\left|x\right|} + \frac{1}{2} \cdot \left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{3}{4} \cdot \left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right) + \frac{15}{8} \cdot \left(\left(\left(\left(\left(\left(\frac{1}{\left|x\right|} \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right) \cdot \frac{1}{\left|x\right|}\right)\right)
\frac{{\left(e^{x}\right)}^{x}}{{\left({\pi}^{0.25}\right)}^{2}} \cdot \left(\frac{1 + \frac{0.5}{x \cdot x}}{\left|x\right|} + \mathsf{log1p}\left(\mathsf{expm1}\left({x}^{-5} \cdot \left(0.75 + 1.875 \cdot {x}^{-2}\right)\right)\right)\right)



Bits error versus x
Results
Initial program 2.8
Simplified1.3
Applied egg-rr1.3
Applied egg-rr1.2
Final simplification1.2
herbie shell --seed 2022165
(FPCore (x)
:name "Jmat.Real.erfi, branch x greater than or equal to 5"
:precision binary64
:pre (>= x 0.5)
(* (* (/ 1.0 (sqrt PI)) (exp (* (fabs x) (fabs x)))) (+ (+ (+ (/ 1.0 (fabs x)) (* (/ 1.0 2.0) (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 3.0 4.0) (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))))) (* (/ 15.0 8.0) (* (* (* (* (* (* (/ 1.0 (fabs x)) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))))