?

Average Error: 0.01% → 0%
Time: 1.5s
Precision: binary64
Cost: 13184

?

\[\sqrt{1 - x \cdot x} \]
\[e^{\mathsf{log1p}\left(-x \cdot x\right) \cdot 0.5} \]
(FPCore (x) :precision binary64 (sqrt (- 1.0 (* x x))))
(FPCore (x) :precision binary64 (exp (* (log1p (- (* x x))) 0.5)))
double code(double x) {
	return sqrt((1.0 - (x * x)));
}
double code(double x) {
	return exp((log1p(-(x * x)) * 0.5));
}
public static double code(double x) {
	return Math.sqrt((1.0 - (x * x)));
}
public static double code(double x) {
	return Math.exp((Math.log1p(-(x * x)) * 0.5));
}
def code(x):
	return math.sqrt((1.0 - (x * x)))
def code(x):
	return math.exp((math.log1p(-(x * x)) * 0.5))
function code(x)
	return sqrt(Float64(1.0 - Float64(x * x)))
end
function code(x)
	return exp(Float64(log1p(Float64(-Float64(x * x))) * 0.5))
end
code[x_] := N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Exp[N[(N[Log[1 + (-N[(x * x), $MachinePrecision])], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]
\sqrt{1 - x \cdot x}
e^{\mathsf{log1p}\left(-x \cdot x\right) \cdot 0.5}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.01

    \[\sqrt{1 - x \cdot x} \]
  2. Applied egg-rr0

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot \left(-x\right)\right) \cdot 0.5}} \]
  3. Final simplification0

    \[\leadsto e^{\mathsf{log1p}\left(-x \cdot x\right) \cdot 0.5} \]

Alternatives

Alternative 1
Error0.01%
Cost6720
\[\sqrt{1 - x \cdot x} \]
Alternative 2
Error0.46%
Cost448
\[1 + \left(x \cdot x\right) \cdot -0.5 \]
Alternative 3
Error1.02%
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x)
  :name "Diagrams.TwoD.Ellipse:ellipse from diagrams-lib-1.3.0.3"
  :precision binary64
  (sqrt (- 1.0 (* x x))))