
(FPCore (x) :precision binary64 (- 1.0 (* x (+ 0.253 (* x 0.12)))))
double code(double x) {
return 1.0 - (x * (0.253 + (x * 0.12)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 - (x * (0.253d0 + (x * 0.12d0)))
end function
public static double code(double x) {
return 1.0 - (x * (0.253 + (x * 0.12)));
}
def code(x): return 1.0 - (x * (0.253 + (x * 0.12)))
function code(x) return Float64(1.0 - Float64(x * Float64(0.253 + Float64(x * 0.12)))) end
function tmp = code(x) tmp = 1.0 - (x * (0.253 + (x * 0.12))); end
code[x_] := N[(1.0 - N[(x * N[(0.253 + N[(x * 0.12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - x \cdot \left(0.253 + x \cdot 0.12\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- 1.0 (* x (+ 0.253 (* x 0.12)))))
double code(double x) {
return 1.0 - (x * (0.253 + (x * 0.12)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 - (x * (0.253d0 + (x * 0.12d0)))
end function
public static double code(double x) {
return 1.0 - (x * (0.253 + (x * 0.12)));
}
def code(x): return 1.0 - (x * (0.253 + (x * 0.12)))
function code(x) return Float64(1.0 - Float64(x * Float64(0.253 + Float64(x * 0.12)))) end
function tmp = code(x) tmp = 1.0 - (x * (0.253 + (x * 0.12))); end
code[x_] := N[(1.0 - N[(x * N[(0.253 + N[(x * 0.12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - x \cdot \left(0.253 + x \cdot 0.12\right)
\end{array}
(FPCore (x) :precision binary64 (- 1.0 (* (+ (* 0.12 x) 0.253) x)))
double code(double x) {
return 1.0 - (((0.12 * x) + 0.253) * x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 - (((0.12d0 * x) + 0.253d0) * x)
end function
public static double code(double x) {
return 1.0 - (((0.12 * x) + 0.253) * x);
}
def code(x): return 1.0 - (((0.12 * x) + 0.253) * x)
function code(x) return Float64(1.0 - Float64(Float64(Float64(0.12 * x) + 0.253) * x)) end
function tmp = code(x) tmp = 1.0 - (((0.12 * x) + 0.253) * x); end
code[x_] := N[(1.0 - N[(N[(N[(0.12 * x), $MachinePrecision] + 0.253), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 - \left(0.12 \cdot x + 0.253\right) \cdot x
\end{array}
Initial program 99.9%
Final simplification99.9%
herbie shell --seed 2024341
(FPCore (x)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, A"
:precision binary64
(- 1.0 (* x (+ 0.253 (* x 0.12)))))