Average Error: 0.1 → 0.1
Time: 1.6s
Precision: binary64
\[\frac{x \cdot x - 3}{6} \]
\[-0.5 + \frac{x}{\frac{6}{x}} \]
(FPCore (x) :precision binary64 (/ (- (* x x) 3.0) 6.0))
(FPCore (x) :precision binary64 (+ -0.5 (/ x (/ 6.0 x))))
double code(double x) {
	return ((x * x) - 3.0) / 6.0;
}
double code(double x) {
	return -0.5 + (x / (6.0 / x));
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x * x) - 3.0d0) / 6.0d0
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (-0.5d0) + (x / (6.0d0 / x))
end function
public static double code(double x) {
	return ((x * x) - 3.0) / 6.0;
}
public static double code(double x) {
	return -0.5 + (x / (6.0 / x));
}
def code(x):
	return ((x * x) - 3.0) / 6.0
def code(x):
	return -0.5 + (x / (6.0 / x))
function code(x)
	return Float64(Float64(Float64(x * x) - 3.0) / 6.0)
end
function code(x)
	return Float64(-0.5 + Float64(x / Float64(6.0 / x)))
end
function tmp = code(x)
	tmp = ((x * x) - 3.0) / 6.0;
end
function tmp = code(x)
	tmp = -0.5 + (x / (6.0 / x));
end
code[x_] := N[(N[(N[(x * x), $MachinePrecision] - 3.0), $MachinePrecision] / 6.0), $MachinePrecision]
code[x_] := N[(-0.5 + N[(x / N[(6.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot x - 3}{6}
-0.5 + \frac{x}{\frac{6}{x}}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[\frac{x \cdot x - 3}{6} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{x}{6}, x, -0.5\right)} \]
  3. Applied egg-rr0.1

    \[\leadsto \color{blue}{-0.5 + \frac{x}{\frac{6}{x}}} \]
  4. Final simplification0.1

    \[\leadsto -0.5 + \frac{x}{\frac{6}{x}} \]

Reproduce

herbie shell --seed 2022162 
(FPCore (x)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, H"
  :precision binary64
  (/ (- (* x x) 3.0) 6.0))