
(FPCore (x) :precision binary64 (* 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
public static double code(double 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 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]
\begin{array}{l}
\\
x \cdot \left(1 - x \cdot 0.5\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* 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
public static double code(double 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 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]
\begin{array}{l}
\\
x \cdot \left(1 - x \cdot 0.5\right)
\end{array}
(FPCore (x) :precision binary64 (* 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
public static double code(double 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 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]
\begin{array}{l}
\\
x \cdot \left(1 - x \cdot 0.5\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
herbie shell --seed 2023195
(FPCore (x)
:name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, B"
:precision binary64
(* x (- 1.0 (* x 0.5))))