Average Error: 0.6 → 0.0
Time: 1.5s
Precision: binary64
Cost: 6528
\[\frac{1}{x \cdot x} \]
\[{x}^{-2} \]
(FPCore (x) :precision binary64 (/ 1.0 (* x x)))
(FPCore (x) :precision binary64 (pow x -2.0))
double code(double x) {
	return 1.0 / (x * x);
}
double code(double x) {
	return pow(x, -2.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0 / (x * x)
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = x ** (-2.0d0)
end function
public static double code(double x) {
	return 1.0 / (x * x);
}
public static double code(double x) {
	return Math.pow(x, -2.0);
}
def code(x):
	return 1.0 / (x * x)
def code(x):
	return math.pow(x, -2.0)
function code(x)
	return Float64(1.0 / Float64(x * x))
end
function code(x)
	return x ^ -2.0
end
function tmp = code(x)
	tmp = 1.0 / (x * x);
end
function tmp = code(x)
	tmp = x ^ -2.0;
end
code[x_] := N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]
code[x_] := N[Power[x, -2.0], $MachinePrecision]
\frac{1}{x \cdot x}
{x}^{-2}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.6
Target0.2
Herbie0.0
\[\frac{\frac{1}{x}}{x} \]

Derivation

  1. Initial program 0.6

    \[\frac{1}{x \cdot x} \]
  2. Taylor expanded in x around 0 0.6

    \[\leadsto \color{blue}{\frac{1}{{x}^{2}}} \]
  3. Simplified0.0

    \[\leadsto \color{blue}{{x}^{-2}} \]
    Proof
    (pow.f64 x -2): 0 points increase in error, 0 points decrease in error
    (pow.f64 x (Rewrite<= metadata-eval (*.f64 2 -1))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= pow-sqr_binary64 (*.f64 (pow.f64 x -1) (pow.f64 x -1))): 83 points increase in error, 0 points decrease in error
    (*.f64 (Rewrite=> unpow-1_binary64 (/.f64 1 x)) (pow.f64 x -1)): 0 points increase in error, 0 points decrease in error
    (*.f64 (/.f64 1 x) (Rewrite=> unpow-1_binary64 (/.f64 1 x))): 0 points increase in error, 0 points decrease in error
    (Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (/.f64 1 x) 1) x)): 0 points increase in error, 43 points decrease in error
    (/.f64 (Rewrite=> *-rgt-identity_binary64 (/.f64 1 x)) x): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-/r*_binary64 (/.f64 1 (*.f64 x x))): 44 points increase in error, 32 points decrease in error
    (/.f64 1 (Rewrite<= unpow2_binary64 (pow.f64 x 2))): 0 points increase in error, 0 points decrease in error
  4. Final simplification0.0

    \[\leadsto {x}^{-2} \]

Alternatives

Alternative 1
Error0.6
Cost320
\[\frac{1}{x \cdot x} \]
Alternative 2
Error0.2
Cost320
\[\frac{\frac{1}{x}}{x} \]

Error

Reproduce

herbie shell --seed 2022325 
(FPCore (x)
  :name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ 1.0 x) x)

  (/ 1.0 (* x x)))