Menu

#109 Floats default to single precision

wrong answer
closed
nobody
Compiler (23)
5
2007-08-29
2005-01-24
No

XSB seems to use single precision float internally.

See the folloing query and response:
| ?- X = 123456700.0 , Y = 89.0, Z is X + Y.

X = 123456704.0000
Y = 89.0000
Z = 123456768.0000

Z should be 123456789.0
This is a "wrong answer" if you consider that most
other platforms default to double precision float.

XSB version 2.7 on Windows 2000 and Linux (Debian
sarge).

Discussion

  • j_greg_d

    j_greg_d - 2005-03-17

    Logged In: YES
    user_id=1191381

    This limitation makes XSB useless for numerical work.
    Traditional implementations of Prolog on 32-bit hardware
    "box" floating point numbers and large integers.

    A simpler solution would be to have a force-64-bit
    configuration option to allocate 64 bits for integers,
    floats and pointers. This would waste 32 bits for single
    pointers, but would save 32 bits for every value that would
    otherwise need to be boxed. Other key datatypes, such as
    cons cells would fit in one 64-bit double word.

    I tried to modify the sources to force everything to 64-bits
    but apparently there are some subtleties. Would someone who
    understands XSB internals please add such an option?

     
  • Theresa Swift

    Theresa Swift - 2007-08-29
    • status: open --> closed
     
  • Theresa Swift

    Theresa Swift - 2007-08-29

    Logged In: YES
    user_id=13011
    Originator: NO

    Double precision floats were added for 2.7.1 -- so I'm closing this one out.

     
  • Theresa Swift

    Theresa Swift - 2007-08-29

    Logged In: YES
    user_id=13011
    Originator: NO

    Double precision floats were added for 2.7.1 -- so I'm closing this one out.

     
  • Theresa Swift

    Theresa Swift - 2007-08-29

    Logged In: YES
    user_id=13011
    Originator: NO

    Double precision floats were added for 2.7.1 -- so I'm closing this one out.

     

Log in to post a comment.