• Numeric Interpretation of Strings

    From Sidney Reilley@21:1/5 to All on Sat Oct 30 18:49:30 2021
    Using Okane mumps!

    don't understand how

    +"123.45e4"

    becomes 1.2345e+06

    The scientific notation needs to be quoted! a numeric operator needs
    to be present. Okay so far, but I don't grok how we go from 123.45e4
    to 1.2345e+06.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ed de moel@21:1/5 to All on Sat Oct 30 18:52:11 2021
    I would expect +"123.45e4" to return 1234500
    The unary + operator should return a canonic number.
    (even if it happens to be numerically the same as 1.2345E6...)

    Ed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From ed de moel@21:1/5 to All on Sat Oct 30 18:54:47 2021
    Or, actually, it should return 123.45, because (in the standard) lowercase "e" is not recognized as "exponential notation".
    But many implementations treat "E" and "e" the same in this context.

    Ed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 4dmonster@21:1/5 to All on Sun Oct 31 11:02:40 2021
    I suppose this happens because 1.2345e+06 is normalized representation of 123.45e4 and floating numbers are stored in that way. When you force type conversation it understands you have floating number. If you want canonical integer you should do
    explicit convert to integer.

    воскресенье, 31 октября 2021 г. в 04:54:47 UTC+3, ed de moel:
    Or, actually, it should return 123.45, because (in the standard) lowercase "e" is not recognized as "exponential notation".
    But many implementations treat "E" and "e" the same in this context.

    Ed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sidney Reilley@21:1/5 to 4dmonster@gmail.com on Sun Oct 31 20:21:06 2021
    On 2021-10-31, 4dmonster <4dmonster@gmail.com> wrote:
    I suppose this happens because 1.2345e+06 is normalized
    representation of 123.45e4 and floating numbers are stored
    in that way. When you force type conversation it understands
    you have floating number. If you want canonical integer you
    should do explicit convert to integer.

    воскресенье, 31 октября 2021 г. в 04:54:47 UTC+3, ed de moel:
    Or, actually, it should return 123.45, because (in the
    standard) lowercase "e" is not recognized as "exponential
    notation".
    But many implementations treat "E" and "e" the same in this
    context.

    It appears that I need a refresher mini-tut about scientific
    notation! Thx for all the input.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)