| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
\[x \cdot \left(1 - x \cdot 0.5\right)
\]
(FPCore (x) :precision binary64 (* x (- 1.0 (* x 0.5))))
(FPCore (x) :precision binary64 (+ (* (* x x) -0.5) x))
double code(double x) {
return x * (1.0 - (x * 0.5));
}
double code(double x) {
return ((x * x) * -0.5) + x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * (1.0d0 - (x * 0.5d0))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = ((x * x) * (-0.5d0)) + x
end function
public static double code(double x) {
return x * (1.0 - (x * 0.5));
}
public static double code(double x) {
return ((x * x) * -0.5) + x;
}
def code(x): return x * (1.0 - (x * 0.5))
def code(x): return ((x * x) * -0.5) + x
function code(x) return Float64(x * Float64(1.0 - Float64(x * 0.5))) end
function code(x) return Float64(Float64(Float64(x * x) * -0.5) + x) end
function tmp = code(x) tmp = x * (1.0 - (x * 0.5)); end
function tmp = code(x) tmp = ((x * x) * -0.5) + x; end
code[x_] := N[(x * N[(1.0 - N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision] + x), $MachinePrecision]
x \cdot \left(1 - x \cdot 0.5\right)
\left(x \cdot x\right) \cdot -0.5 + x
Results
Initial program 0.0
Applied egg-rr0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
| Alternative 2 | |
|---|---|
| Error | 21.5 |
| Cost | 64 |
herbie shell --seed 2023010
(FPCore (x)
:name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
:precision binary64
(* x (- 1.0 (* x 0.5))))