Results 1 to 4 of 4

Thread: Float data type

  1. #1
    Join Date
    Dec 2002
    Posts
    5

    Unanswered: Float data type

    Dear members,

    I'm inserting a record in a table having data type as float. When i try to insert record having value as say 123.45 for a float data type, after insertion the value that is present in a database is something like 123.44999999999. Can anybody tell me why so happens?

    Thanks in advance.

    Vandana (vandanapjoshi@yahoo.com)

  2. #2
    Join Date
    Jun 2002
    Location
    Argentina
    Posts
    78
    This is an error from binary convertion to decimal.
    There is two classes of number in Sybase:
    - Exact numeric datatypes like "integer" or "numeric (p, s)"
    - Approximate numeric datatypes like float

    From The Reference Manual:
    "Any time a floating-point number is printed or displayed, the
    printed representation is not quite the same as the stored number,
    and the stored number is not quite the same as the number that the
    user entered."

    If you don't accept this error try to uses numeric or decimal.
    Bye Bye

    Sebastian

  3. #3
    Join Date
    Jan 2003
    Posts
    62

    Re: Float data type

    Originally posted by Vandana
    Dear members,

    I'm inserting a record in a table having data type as float. When i try to insert record having value as say 123.45 for a float data type, after insertion the value that is present in a database is something like 123.44999999999. Can anybody tell me why so happens?

    Thanks in advance.

    Vandana (vandanapjoshi@yahoo.com)
    Obviously, I 'guess' Sybase is not using the OS vendor's routine to make conversion to float i.e. atof() for reason(s) I'm not aware of. This is the case especially on NT, but I see that on ver 12.5, I'm getting 123.450000

  4. #4
    Join Date
    Sep 2002
    Location
    Hong Kong
    Posts
    159

    Re: Float data type

    Originally posted by tezza_chen
    Obviously, I 'guess' Sybase is not using the OS vendor's routine to make conversion to float i.e. atof() for reason(s) I'm not aware of. This is the case especially on NT, but I see that on ver 12.5, I'm getting 123.450000
    Ver 12.5.0.1 on Solaris and NT works fine, I get 123.450000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •