| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 320 |
\[\frac{1}{x \cdot x}
\]
(FPCore (x) :precision binary64 (/ 1.0 (* x x)))
(FPCore (x) :precision binary64 (/ (/ 1.0 x) x))
double code(double x) {
return 1.0 / (x * x);
}
double code(double x) {
return (1.0 / x) / x;
}
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 = (1.0d0 / x) / x
end function
public static double code(double x) {
return 1.0 / (x * x);
}
public static double code(double x) {
return (1.0 / x) / x;
}
def code(x): return 1.0 / (x * x)
def code(x): return (1.0 / x) / x
function code(x) return Float64(1.0 / Float64(x * x)) end
function code(x) return Float64(Float64(1.0 / x) / x) end
function tmp = code(x) tmp = 1.0 / (x * x); end
function tmp = code(x) tmp = (1.0 / x) / x; end
code[x_] := N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(1.0 / x), $MachinePrecision] / x), $MachinePrecision]
\frac{1}{x \cdot x}
\frac{\frac{1}{x}}{x}
Results
| Original | 0.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
Initial program 0.6
Simplified0.2
[Start]0.6 | \[ \frac{1}{x \cdot x}
\] |
|---|---|
rational.json-simplify-46 [=>]0.2 | \[ \color{blue}{\frac{\frac{1}{x}}{x}}
\] |
Final simplification0.2
| Alternative 1 | |
|---|---|
| Error | 0.6 |
| Cost | 320 |
herbie shell --seed 2023074
(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)))