Weird problem ( 3 * 31.9 = 95.69999999999999)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dr John Stockton

    #16
    Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

    JRS: In article <veyvhzw8.fsf@h otpop.com>, dated Mon, 14 Nov 2005
    19:01:43, seen in news:comp.lang. javascript, Lasse Reichstein Nielsen
    <lrn@hotpop.com > posted :
    [color=blue]
    >In Javascript, all numbers are floating point numbers (more preciely
    >64 bit floating point numbers as defined in IEEE-754, the kind typically
    >implemented by the CPU as well). There is no difference between "3" and
    >"3.0" as a number literal.
    >
    >The 64 bit floats can represent all integers up to 2^54 precisely, and
    >do exact integer arithmetic with them.[/color]

    But Math.pow(2, 54) - 1 is even, as is Math.pow(2, 53) + 1 ;
    you mean up to (and including) 2^53 (and down to include -2^53).

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
    Web <URL:http://www.merlyn.demo n.co.uk/> - FAQqish topics, acronyms & links;
    Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
    No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

    Comment

    • Richard Cornford

      #17
      Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

      matty wrote:[color=blue]
      > I read the FAQ. And there was no mention of "Javascript
      > only has one number type and that is a double-precision
      > 64-bit format IEEE 754 floating point number." as of 2
      > days ago in the FAQ. I search for "64" and it was not
      > there and not in the
      > http://www.jibbering.com/faq/faq_not...e_convert.html
      > link either (which I did read).[/color]

      The rate at which it is possible to create accurate additional
      explanation/detail for the FAQ is related to the number of (suitably
      qualified) people willing to do it, and the amount of time they have
      available for the task. the task is much nearer its beginning than its
      end.
      [color=blue]
      > "you have failed to trim the material you quoted down to
      > just that part of it that is sufficient to provide context
      > for your response, as is required by Usenet convention. You
      > have also quoted a 'signature' which is always incorrect."[/color]

      And this time you have failed to provide a context for your first
      response, failed to attribute they quote you have made and failed to use
      a conventional quote indicator.
      [color=blue]
      > I don't understand.[/color]

      What don't you understand? That quoting material that is not pertinent
      to the responses is undesirable? That signatures are almost always
      irrelevant to a response? Or what a signature is?
      [color=blue]
      > I think that even if newbies make mistakes in the
      > way they post or reply,[/color]

      They do, and those mistakes can have serious consequences for the
      outcome of their interactions with the group. Generally everyone gets an
      opportunity to demonstrate a willingness to conform with the
      conventions.
      [color=blue]
      > they should be rewarded for trying to help,[/color]

      And discouraged from doing harm. Which is what anyone who fails to
      follow the post formatting conventions is doing, particularly in
      encouraging newcomers to do likewise.
      [color=blue]
      > and given references on how to properly respond[/color]

      And where would you expect to find that information? Maybe in (and/or
      referenced from) some sort of resource publicly available on the
      Internet, posted to the group at frequent interval and to which posters
      are regularly referred?
      [color=blue]
      > rather than getting arrogant replies that just
      > discourage people from being more active.[/color]

      It is difficult to accurately attribute motivation, attitude or emotion
      from the contents of plain text messages. If you re-read the posts that
      you believe to be arrogant can you really be certain that they are not
      intended as friendly advice, hints in the right direction and justified
      warnings (albeit often terse)?
      [color=blue]
      > Also, I googled "usenet convention" and nothing really clear came up.[/color]

      Why didn't you just read the FAQ when you had it avalable?
      [color=blue]
      > If this is refering to the Netiquette of 1998, be aware that
      > we are in 2005 and that new tools, new ways of discussions
      > have made the newsgroups more accessible and more "affordable "
      > for most of us.[/color]

      The Usenet posting conventions evolved in response to diversity in
      methods of access. Having even more diversity is, if anything grounds
      for more strict adherence to the established conventions. The last thing
      that should be allowed to happen to Usenet is to have it fragment into
      sub groups using different types of newsreader software.
      [color=blue]
      > I will try my best to figure that out and will accept all
      > comments and help as long as they don't violate the "convention " :)[/color]

      You don't need to work it out, the details are available in, and
      through, the FAQ (that is one of the points of its existence).

      Richard.


      Comment

      • VK

        #18
        Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)


        Richard Cornford wrote:[color=blue]
        > "Javascript only has one number type and that is a double-precision
        > 64-bit format IEEE 754 floating point number.[/color]

        One of urban legends originally raised from the bad math / CS skills of
        some ECMA time-share paper wasters (aka tech-writers).

        Windows / Mac / Linux and Co are 32-bit systems - 64 bit systems are
        still rather new bists on the market.

        If the interpreter spots a new number, it will first try reading the
        number as an integer. If that's possible, then it stores the number as
        a 31 bit integer, not as a 64 bit IEEE 754. (Yes, that's 31 bits, not
        32 bits.) If the number cant be read as an integer or it won't fit in
        31 bits, then it is stored in 64 bit IEEE 754. Similar logic applies to
        all calculations.

        Comment

        • RobG

          #19
          Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

          matty wrote:[color=blue]
          > I read the FAQ. And there was no mention of "Javascript only has one
          > number type and that is a double-precision
          > 64-bit format IEEE 754 floating point number."[/color]

          It's in the ECMAScript Language Specification - section 4.3.20:

          "Number Type
          "The type Number is a set of values representing numbers. In
          ECMAScript, the set of values represents double-precision 64-bit
          format IEEE 754 values including the special "Not-a-Number" (NaN)
          values, positive infinity, and negative infinity."


          Not to be confused with Number Object, of course...

          [...]
          [color=blue]
          > Also, I googled "usenet convention" and nothing really clear came up.
          > If this is refering to the Netiquette of 1998, be aware that we are in
          > 2005 and that new tools, new ways of discussions have made the
          > newsgroups more accessible and more "affordable " for most of us.[/color]

          Usenet started in 1979, not everything is 'soooo five minutes ago...'.
          It has a long history and well established conventions that are
          intended to encourage positive and useful participation.

          [color=blue]
          > I will
          > try my best to figure that out and will accept all comments and help as
          > long as they don't violate the "convention " :)[/color]

          See ya round! :-)


          --
          Rob

          Comment

          • rf

            #20
            Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

            VK wrote:
            [color=blue]
            > Richard Cornford wrote:[color=green]
            >> "Javascript only has one number type and that is a double-precision
            >> 64-bit format IEEE 754 floating point number.[/color]
            >
            > One of urban legends originally raised from the bad math / CS skills of
            > some ECMA time-share paper wasters (aka tech-writers).
            >
            > Windows / Mac / Linux and Co are 32-bit systems - 64 bit systems are
            > still rather new bists on the market.[/color]

            64 bit floating point has been around for decades.
            [color=blue]
            > If the interpreter spots a new number, it will first try reading the
            > number as an integer. If that's possible, then it stores the number as
            > a 31 bit integer, not as a 64 bit IEEE 754. (Yes, that's 31 bits, not
            > 32 bits.) If the number cant be read as an integer or it won't fit in
            > 31 bits, then it is stored in 64 bit IEEE 754. Similar logic applies to
            > all calculations.[/color]

            Please provide a referance where these assertions may be verified.

            Here is a reference which I believe refutes what you claim:


            Scroll down a bit to the heading "Number data type", wherein it says
            <quote>
            Internally, JScript represent[sic] all numbers as floating-point values
            </quote>

            I take this source as being authoritative, since they are the blokes who
            wrote JScript, IE's implementation.

            --
            Cheers, Richard.
            If you are reading this using google groups then also read this:
            http://www.safalra.com/special/googlegroupsreply/ if you have not done so
            already. If you reply to this post without correct quoting and attribution,
            as per the above, I, and others, may just totally ignore you.

            Comment

            • matty

              #21
              Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)


              RobG wrote:[color=blue]
              > matty wrote:[color=green]
              > > I read the FAQ. And there was no mention of "Javascript only has one
              > > number type and that is a double-precision
              > > 64-bit format IEEE 754 floating point number."[/color]
              >
              > It's in the ECMAScript Language Specification - section 4.3.20:
              >
              > "Number Type
              > "The type Number is a set of values representing numbers. In
              > ECMAScript, the set of values represents double-precision 64-bit
              > format IEEE 754 values including the special "Not-a-Number" (NaN)
              > values, positive infinity, and negative infinity."
              >[/color]
              So i've spent quite a while today reading about the javascript history
              and ECMA so I wouldn't post stupid replies when trying to help.

              What thing that is very confusing to me is the relation between W3C and
              ECMA. Is ECMA the standard for Javascript? I see things like W3C
              telling me that I should not use "<script language="javas cript"> and
              rather use <script type="text/javascript"> (which will be depracated
              and replaced by <script type="applicati on/javascript"> but ECMA tells
              me the opposite, emphasizing on version numbers (<script
              language="javas cript1.2">) as being important for defining which
              version of the language is supported.

              One thing people need to understand is that there wouldn't be any group
              like this particular group if everyone read and understood the
              javascript language. It is not simple, there are numerous books and
              references and websites about it and it is still a language in the
              works, with multiple versions, conflicting standards, etc. Asking a
              question and not knowing the complete history & different
              implementations about javascript is not a crime.

              Comment

              • Dag Sunde

                #22
                Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                "matty" <unlimitedbro@g mail.com> wrote in message
                news:1132034361 .339841.76960@o 13g2000cwo.goog legroups.com...[color=blue]
                >
                > RobG wrote:[color=green]
                >> matty wrote:[color=darkred]
                >> > I read the FAQ. And there was no mention of "Javascript only has one
                >> > number type and that is a double-precision
                >> > 64-bit format IEEE 754 floating point number."[/color]
                >>
                >> It's in the ECMAScript Language Specification - section 4.3.20:
                >>[/color][/color]
                <snipped/>[color=blue]
                > What thing that is very confusing to me is the relation between W3C and
                > ECMA. Is ECMA the standard for Javascript? I see things like W3C
                > telling me that I should not use "<script language="javas cript"> and
                > rather use <script type="text/javascript"> (which will be depracated
                > and replaced by <script type="applicati on/javascript"> but ECMA tells
                > me the opposite, emphasizing on version numbers (<script
                > language="javas cript1.2">) as being important for defining which
                > version of the language is supported.[/color]

                Its a matter on who's responsible for what.

                The <script> tag is an HTML tag and belong as such to W3C.
                The 'content' of the script-tag (if its type-attribute is set to
                "applicatio n/javascript") is written in JavaScript, and belongs
                to ECMA's domain.
                [color=blue]
                >
                > One thing people need to understand is that there wouldn't be any group
                > like this particular group if everyone read and understood the
                > javascript language. It is not simple, there are numerous books and
                > references and websites about it and it is still a language in the
                > works, with multiple versions, conflicting standards, etc. Asking a
                > question and not knowing the complete history & different
                > implementations about javascript is not a crime.[/color]

                This is very true. I wouldn't put too much weight on the at times
                harsh replies newbies get. Some of those replies are actually well
                meant. Others are kind of a "Power Show", and can safely be ignored.

                Snip things that is out of context, and reply at the bottom of the post,
                Or inline if it falls natural in the context.
                Be polite, even if others aren't.
                Mark flippant comments with some kind of smiley, so people can see the
                "mood".

                These simple guidelines work for me, and I have not been flamed yet... ;-)

                --
                Dag.


                Comment

                • Thomas 'PointedEars' Lahn

                  #23
                  Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                  Dag Sunde wrote:
                  [color=blue]
                  > "matty" <unlimitedbro@g mail.com> wrote [...][color=green]
                  >> RobG wrote:[color=darkred]
                  >>> matty wrote:
                  >>> > I read the FAQ. And there was no mention of "Javascript only has one
                  >>> > number type and that is a double-precision
                  >>> > 64-bit format IEEE 754 floating point number."
                  >>>
                  >>> It's in the ECMAScript Language Specification - section 4.3.20:
                  >>>[/color][/color]
                  > <snipped/>[color=green]
                  >> What thing that is very confusing to me is the relation between W3C and
                  >> ECMA. Is ECMA the standard for Javascript?[/color][/color]

                  ECMAScript is the standard JavaScript 1.5+ and JScript are based on. ECMA
                  (European Computer Manufacturers Association) is the standardization body
                  that published that standard.
                  [color=blue][color=green]
                  >> I see things like W3C telling me that I should not use "<script
                  >> language="javas cript"> and rather use <script type="text/javascript">[/color][/color]

                  No, they refer to the respective Internet Draft by Björn Höhrmann which
                  has been approved as Informational RFC (Request for Comments) by the IETF
                  (Internet Engineering Task Force), another standardization body.
                  [color=blue][color=green]
                  >> (which will be depracated and replaced by <script
                  >> type="applicati on/javascript">[/color][/color]

                  The former will not be deprecated by the latter but is registered and
                  marked in the standards tree as _obsolete_ now (since June 2005).
                  [color=blue][color=green]
                  >> but ECMA tells me the opposite, emphasizing on version numbers (<script
                  >> language="javas cript1.2">) as being important for defining which
                  >> version of the language is supported.[/color][/color]

                  I would like to see proof for that statement.
                  [color=blue]
                  > Its a matter on who's responsible for what.
                  >
                  > The <script> tag is an HTML tag and belong as such to W3C.
                  > The 'content' of the script-tag (if its type-attribute is set to
                  > "applicatio n/javascript") is written in JavaScript, and belongs
                  > to ECMA's domain.[/color]

                  That is not entirely true.

                  1. The `script' _element_ (which consists of its start tag, content
                  and end tag) is specified by the W3C (HTML and XHTML specifications) .

                  2. The content (no need for quotes) of the `script' element, if its
                  `type' attribute is set to `application/javascript', is _JavaScript_
                  code and as such belongs to the domain of the Mozilla Organization,
                  since Netscape (after the AOL/TW takeover) no longer takes care
                  on the language. (See for example JavaScript 1.6 implemented in
                  Mozilla/5.0 since release version 1.8.)

                  The second statement above would have been correct if it referred
                  to the MIME type `application/ecmascript'.


                  PointedEars

                  Comment

                  • Richard Cornford

                    #24
                    Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                    VK wrote:[color=blue]
                    > Richard Cornford wrote:[color=green]
                    >> "Javascript only has one number type and that is a
                    >> double-precision 64-bit format IEEE 754 floating point
                    >> number.[/color]
                    >
                    > One of urban legends originally raised from the bad math /
                    > CS skills of some ECMA time-share paper wasters
                    > (aka tech-writers).
                    >
                    > Windows / Mac / Linux and Co are 32-bit systems - 64 bit
                    > systems are still rather new bists on the market.[/color]

                    LOL. Criticising the CS skills of others and then posting that
                    irrelevance in the following sentence?
                    [color=blue]
                    > If the interpreter spots a new number, it will first try reading
                    > the number as an integer. If that's possible, then it stores the
                    > number as a 31 bit integer, not as a 64 bit IEEE 754. (Yes,
                    > that's 31 bits, not 32 bits.) If the number cant be read as an
                    > integer or it won't fit in 31 bits, then it is stored in 64 bit
                    > IEEE 754. Similar logic applies to all calculations.[/color]

                    You have previously made it clear that you are a spectacularly bad
                    programmer. That you think this is even likely reinforces that
                    impression. You certainly have no evidence (empirical or in
                    documentation) that will support this nonsense.

                    Richard.


                    Comment

                    • VK

                      #25
                      Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)


                      Richard Cornford wrote:[color=blue]
                      > You have previously made it clear that you are a spectacularly bad
                      > programmer. That you think this is even likely reinforces that
                      > impression. You certainly have no evidence (empirical or in
                      > documentation) that will support this nonsense.[/color]

                      "Three Number Formats: JavaScript Number Implementation"
                      <http://www.devx.com/webdev/Article/17215/0/page/3>

                      "Four Values: Warning Numbers You Need to Know"
                      <http://www.devx.com/webdev/Article/17215/0/page/4>

                      Don't ask me why should you take the author as an authority. You should
                      not! But both articles give you enough of data to conduct your own
                      experiments to prove it or to dismiss it. I did experiment and I got a
                      prove, but my testcases are not reliable because they are mine, are
                      they? So why would you not make your own then? Besides it would show
                      what kind of programmer *you* are.

                      Oh, sorry... You already stated several times that empiric results are
                      not reliable in any shell perform form.
                      Keep reading then ECMA (Book Of Definitions, Chapter 4.3.20) and simply
                      don't think about facts.

                      As Dag Sunde suggests - a nice smily at the end:
                      :-)

                      Comment

                      • Jasen Betts

                        #26
                        Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                        On 2005-11-14, baong <baonks@gmail.c om> wrote:[color=blue]
                        > dear all
                        > i have use this line to time in many my web base appl.
                        > but now i found a weird problem
                        > the javascript line is the same
                        > but i use the calculation 2 time
                        > @ the first time, it is ok, 3 * 31.9 = 95.7
                        > @ the second time, 3 * 31.9 = 95.699999999999 99
                        > this is the list number which calculation is NOT correct
                        > 6 * 31.9 = 191.39999999999 998[/color]

                        it looks correct to me.

                        in binary. 1/5 is like 1/3
                        (0.333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 33333...)
                        in binary you can't 1/5 with a binary point and a finite number of digits.

                        as a result numbers like that don't work perfectly in computerso
                        just lik many calculators will give 0.99999999 for 1/3*3 ...

                        either pick how many digits you want and round to that number of digits
                        before displaying the result. or do your calculations in "cents" instead of
                        "dollars"

                        --

                        Bye.
                        Jasen

                        Comment

                        • Dag Sunde

                          #27
                          Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                          "Jasen Betts" <jasen@clunker. homenet> wrote in message
                          news:slrndnj46e .5cc.jasen@clun ker.homenet...[color=blue]
                          > On 2005-11-14, baong <baonks@gmail.c om> wrote:[color=green]
                          >> dear all
                          >> i have use this line to time in many my web base appl.
                          >> but now i found a weird problem
                          >> the javascript line is the same
                          >> but i use the calculation 2 time
                          >> @ the first time, it is ok, 3 * 31.9 = 95.7
                          >> @ the second time, 3 * 31.9 = 95.699999999999 99
                          >> this is the list number which calculation is NOT correct
                          >> 6 * 31.9 = 191.39999999999 998[/color]
                          >
                          > it looks correct to me.
                          >
                          > in binary. 1/5 is like 1/3
                          > (0.333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 333333333333333 33333...)
                          > in binary you can't 1/5 with a binary point and a finite number of digits.
                          >
                          > as a result numbers like that don't work perfectly in computerso
                          > just lik many calculators will give 0.99999999 for 1/3*3 ...
                          >[/color]

                          Bad example... :-D

                          1/5 = 0.2, which is easily expressable as a power of 2...

                          --
                          Dag.


                          Comment

                          • Lasse Reichstein Nielsen

                            #28
                            Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                            "Richard Cornford" <Richard@litote s.demon.co.uk> writes:
                            [color=blue]
                            > matty wrote:[color=green]
                            >> Lasse Reichstein Nielsen wrote:[color=darkred]
                            >>> The 64 bit floats can represent all integers up to
                            >>> 2^54 precisely, and[/color][/color]
                            >
                            > I thought it was two to the power of fifty three (90071992547409 92), but
                            > what is a bit here or there?[/color]

                            It is. I was remembering that 53 bits can only represent up to 2^53-1,
                            but 64 bit floats (with their 53 bit mantissa) can actually represent
                            up to 2^53. I then overcompensated :)

                            ....[color=blue]
                            > As a result some numeric values are represented as approximations. For
                            > example, the largest integer value that can be entered in source code
                            > without its IEEE 754 representation being returned in exponential format
                            > when converted to a string is 999999999999999 934469,[/color]

                            The highest I can get without getting 1e+21 is 999999999999999 934463
                            (Opera 8.5). Generally, this text throws around a lot of, and perhaps
                            too many, long numbers. It feels mostly like "drama digits" :)

                            /L
                            --
                            Lasse Reichstein Nielsen - lrn@hotpop.com
                            DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                            'Faith without judgement merely degrades the spirit divine.'

                            Comment

                            • Dr John Stockton

                              #29
                              Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                              JRS: In article <dlb3rb$pvc$1$8 300dec7@news.de mon.co.uk>, dated Mon, 14
                              Nov 2005 22:41:46, seen in news:comp.lang. javascript, Richard Cornford
                              <Richard@litote s.demon.co.uk> posted :
                              [color=blue]
                              >"Javascript only has one number type and that is a double-precision
                              >64-bit format IEEE 754 floating point number. That type of number is
                              >capable of representing 184377368744548 10627[/color]

                              ISTM better to indicate how that is arrived at. For example, it's
                              clearly 1 + 2 * (Z+1) where the first 1 is for a large number of
                              distinct but indistinguishab le NaNs, the second 1 is for the infinities,
                              the 2 is for the sign bit, and Z is the number of non-negative finite
                              numbers, including a zero.
                              [color=blue]
                              > distinct values including
                              >positive and negative infinity and the special numeric value NaN (Not a
                              >Number). The representable range is +/-1.7976931348623 157×10^308 (with
                              >numbers as small as +/-5×10^-324). The range of precise integer values
                              >is +/-900719925474099 2 (+/-2^53).[/color]

                              Well the range is that, but the count is actually that + 1, since there
                              are two distinct zeroes which are equal for only most purposes.

                              ISTM better to put it as "all integer values in 0 to 900719925474099 2
                              (2^53), with either sign, are represented exactly". Outside that range,
                              only some are.

                              [color=blue]
                              > That leaves 184197224759453 28643
                              >values to represent non-integers and integers outside of that range, and
                              >obviously there are considerably more numbers in the IEEE 754 range than
                              >can be represented by the available distinct values.[/color]


                              ISTM that there are 2^52-1 distinct but indistinguishab le NaNs of each
                              sign, and two Infinities; and 2 * 2^11-1 * 2^52 other Numbers, all
                              distinguishably different though +0 & -0 are less different than any
                              other pair.


                              ISTM worth observing, nearby, that the only decimal fractions which are
                              represented exactly are the multiples of 1/2, 1/4, 1/8, 1/16, ... down
                              to a limit depending on the number of bits needed for the integer part;
                              for example, the only exact numbers of the form ###.## ate ###.00,
                              ###.25. ###/50. & ###.75 .

                              --
                              © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
                              Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
                              Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
                              Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

                              Comment

                              • Lasse Reichstein Nielsen

                                #30
                                Re: Weird problem ( 3 * 31.9 = 95.699999999999 99)

                                "VK" <schools_ring@y ahoo.com> writes:
                                [color=blue]
                                > Richard Cornford wrote:[color=green]
                                >> "Javascript only has one number type and that is a double-precision
                                >> 64-bit format IEEE 754 floating point number.[/color]
                                >
                                > One of urban legends originally raised from the bad math / CS skills of
                                > some ECMA time-share paper wasters (aka tech-writers).[/color]

                                That depends on what you mean by "Javascript ". It is not ECMAScript,
                                because that's a specification of a language, not an implementation.
                                The specification only specifies one number type, the 64 bit IEEE 754
                                floating point number.
                                [color=blue]
                                > If the interpreter spots a new number,[/color]

                                You are saying *the* interpreter. There are lots of interpreters for
                                languages called "Javascript " and compatible with the ECMAScript
                                specification. Some of these implementations might do what you say.
                                Others surely don't (or I'll write one that doesn't :).
                                [color=blue]
                                > it will first try reading the number as an integer. If that's
                                > possible, then it stores the number as a 31 bit integer, not as a 64
                                > bit IEEE 754.[/color]

                                That could be one optimization that an ECMAScript compatible
                                implementation could do.

                                /L
                                --
                                Lasse Reichstein Nielsen - lrn@hotpop.com
                                DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                                'Faith without judgement merely degrades the spirit divine.'

                                Comment

                                Working...