
(FPCore (x) :precision binary64 :pre TRUE (+ x (* x x)))
double code(double x) {
return x + (x * x);
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x + (x * x)
end function
public static double code(double x) {
return x + (x * x);
}
def code(x): return x + (x * x)
function code(x) return Float64(x + Float64(x * x)) end
function tmp = code(x) tmp = x + (x * x); end
code[x_] := N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = x + (x * x) END code
x + x \cdot x
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 :pre TRUE (+ x (* x x)))
double code(double x) {
return x + (x * x);
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = x + (x * x)
end function
public static double code(double x) {
return x + (x * x);
}
def code(x): return x + (x * x)
function code(x) return Float64(x + Float64(x * x)) end
function tmp = code(x) tmp = x + (x * x); end
code[x_] := N[(x + N[(x * x), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = x + (x * x) END code
x + x \cdot x
(FPCore (x) :precision binary64 :pre TRUE (fma x x x))
double code(double x) {
return fma(x, x, x);
}
function code(x) return fma(x, x, x) end
code[x_] := N[(x * x + x), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = (x * x) + x END code
\mathsf{fma}\left(x, x, x\right)
Initial program 100.0%
Applied rewrites100.0%
herbie shell --seed 2026092
(FPCore (x)
:name "Main:bigenough1 from B"
:precision binary64
(+ x (* x x)))