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