Average Error: 0.0 → 0.0
Time: 1.7s
Precision: binary64
Cost: 448
\[x \cdot \left(1 - x \cdot 0.5\right) \]
\[x \cdot \left(1 + x \cdot -0.5\right) \]
(FPCore (x) :precision binary64 (* x (- 1.0 (* x 0.5))))
(FPCore (x) :precision binary64 (* x (+ 1.0 (* x -0.5))))
double code(double x) {
	return x * (1.0 - (x * 0.5));
}
double code(double x) {
	return x * (1.0 + (x * -0.5));
}
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 * (1.0d0 + (x * (-0.5d0)))
end function
public static double code(double x) {
	return x * (1.0 - (x * 0.5));
}
public static double code(double x) {
	return x * (1.0 + (x * -0.5));
}
def code(x):
	return x * (1.0 - (x * 0.5))
def code(x):
	return x * (1.0 + (x * -0.5))
function code(x)
	return Float64(x * Float64(1.0 - Float64(x * 0.5)))
end
function code(x)
	return Float64(x * Float64(1.0 + Float64(x * -0.5)))
end
function tmp = code(x)
	tmp = x * (1.0 - (x * 0.5));
end
function tmp = code(x)
	tmp = x * (1.0 + (x * -0.5));
end
code[x_] := N[(x * N[(1.0 - N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(x * N[(1.0 + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x \cdot \left(1 - x \cdot 0.5\right)
x \cdot \left(1 + x \cdot -0.5\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[x \cdot \left(1 - x \cdot 0.5\right) \]
  2. Final simplification0.0

    \[\leadsto x \cdot \left(1 + x \cdot -0.5\right) \]

Alternatives

Alternative 1
Error2.1
Cost584
\[\begin{array}{l} t_0 := x \cdot \left(x \cdot -0.5\right)\\ \mathbf{if}\;x \leq -861073.7899806314:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \leq 7.135383061402566 \cdot 10^{-9}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.0
Cost448
\[x + x \cdot \left(x \cdot -0.5\right) \]
Alternative 3
Error21.7
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022317 
(FPCore (x)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (- 1.0 (* x 0.5))))