Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 192 |
\[x \cdot 0.05
\]
(FPCore (x) :precision binary64 (/ (* 50.0 x) 1000.0))
(FPCore (x) :precision binary64 (/ x 20.0))
double code(double x) { return (50.0 * x) / 1000.0; }
double code(double x) { return x / 20.0; }
real(8) function code(x) real(8), intent (in) :: x code = (50.0d0 * x) / 1000.0d0 end function
real(8) function code(x) real(8), intent (in) :: x code = x / 20.0d0 end function
public static double code(double x) { return (50.0 * x) / 1000.0; }
public static double code(double x) { return x / 20.0; }
def code(x): return (50.0 * x) / 1000.0
def code(x): return x / 20.0
function code(x) return Float64(Float64(50.0 * x) / 1000.0) end
function code(x) return Float64(x / 20.0) end
function tmp = code(x) tmp = (50.0 * x) / 1000.0; end
function tmp = code(x) tmp = x / 20.0; end
code[x_] := N[(N[(50.0 * x), $MachinePrecision] / 1000.0), $MachinePrecision]
code[x_] := N[(x / 20.0), $MachinePrecision]
\frac{50 \cdot x}{1000}
\frac{x}{20}
Results
Initial program 0.2
Applied egg-rr0.3
Applied egg-rr0
Final simplification0
Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 192 |
herbie shell --seed 1
(FPCore (x)
:name "50 * x / 1000"
:precision binary64
:pre (and (<= 1.0 x) (<= x 10000.0))
(/ (* 50.0 x) 1000.0))