Skip to content

Display floating point numbers with high precision #166

@Joe7M

Description

@Joe7M

see: https://www.syntaxbomb.com/smallbasic/rounding-numbers/

The Round() command should be straightforward, but sometimes the program seems to round then add or subtract 0.00000000001 to the number, any idea why?
I compiled this to illustrate. I seem to be getting the same problem with external files. An alternative to round is using an expression like INT(100*number)/100, but it does the same.

FOR n=1 TO 100
a=100*RND
PRINT a, ROUND(a,3)
next n

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions