Need an Ambiguous example

75 Views Asked by At

Suppose I have a floating-point number with $m$ where $(m > 0)$ digits after the decimal point. Now if I want to round it up to $d$ where $(0 ≤ d < m)$ digits after the decimal point, sometimes I need to round up and sometimes I need to round down and sometimes nothing is needed. Sometimes the situation is ambiguous (when rounding up and down causes equal absolute error).

For example

3.141592653589790 is the given number Ambiguous

    3.141592653589790
    3.14159265358979 - no change
    3.1415926535897  - round up
    3.14159265358    - round up
    3.1415926535     - round up
    3.141592653      - round up
    3.14159265       - round down
    3.1415926        - round up
    3.141593         - round up
    3.14159          - round down
    .............

And for some of example the situation will Ambiguous . Can anyone give me such kind of example?

1

There are 1 best solutions below

1
On

Not super experienced with FP, but if you had a number terminating in 50, I imagine that would be ambiguous. Like 1.50 can be rounded to 2. or 3. Is that what you're looking for?