Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > JavaScript does make errors when dealing just with integers

Reply
Thread Tools

JavaScript does make errors when dealing just with integers

 
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
Contrary to what one authority in the JavaScript field says:
JavaScript does make errors when dealing with just with integers.

This authority (Douglas Crockford.) says:
"integer arithmetic in floating point [as JS uses] is exact"

Well, I can prove this is incorrect with this program:
http://mynichecomputing.com/digitallearning/yourOwn.htm

This a program that uses only integers, yet comes up short in its
addition or count
when used. HERE IS HOW TO DO THE EXPERIMENT AND SEE:

Without adding on an arbitrary decimal number less than one (I believe
I use .9) ,
this program will come up short in its count(addition).
So, omit that .9 from the program so the program is relying on the
pure exact
JavaScript addition. NOW, as a step 2: Set up the program
for "inventory scoring" by using some sample answers set using the
procedure
described for doing so for an inventory (see link on the web page I
gave you
the code for, for the directions) -- where an item may count on more
than
one scale and several items score each scale up (set up to do some of
each).
THEN: Use that scoring system
in several runs on sets of client answers (samples you also make
yourself)
and you will find the count coming up SHORT if you omit my + .9 from
the code.

You will find the count short. This would be disasterous in a voting
machine.



 
Reply With Quote
 
 
 
 
Joost Diepenmaat
Guest
Posts: n/a
 
      08-19-2008
lorlarz <(E-Mail Removed)> writes:

> Contrary to what one authority in the JavaScript field says:
> JavaScript does make errors when dealing with just with integers.
>
> This authority (Douglas Crockford.) says:
> "integer arithmetic in floating point [as JS uses] is exact"
>
> Well, I can prove this is incorrect with this program:
> http://mynichecomputing.com/digitallearning/yourOwn.htm
>
> This a program that uses only integers, yet comes up short in its
> addition or count
> when used. HERE IS HOW TO DO THE EXPERIMENT AND SEE:
>
> Without adding on an arbitrary decimal number less than one (I believe
> I use .9) ,
> this program will come up short in its count(addition).
> So, omit that .9 from the program so the program is relying on the
> pure exact
> JavaScript addition. NOW, as a step 2: Set up the program
> for "inventory scoring" by using some sample answers set using the
> procedure
> described for doing so for an inventory (see link on the web page I
> gave you
> the code for, for the directions) -- where an item may count on more
> than
> one scale and several items score each scale up (set up to do some of
> each).
> THEN: Use that scoring system
> in several runs on sets of client answers (samples you also make
> yourself)
> and you will find the count coming up SHORT if you omit my + .9 from
> the code.
>
> You will find the count short. This would be disasterous in a voting
> machine.



Just in case it escaped you: 0.9 is NOT an integer, so you are NOT
working with "just integers". We've done this to death.

See also:

http://docs.sun.com/source/806-3568/ncg_goldberg.html



--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
 
Reply With Quote
 
 
 
 
Stevo
Guest
Posts: n/a
 
      08-19-2008
lorlarz wrote:
> Contrary to what one authority in the JavaScript field says:
> JavaScript does make errors when dealing with just with integers.
> I use .9) ,


Funny looking integer.
 
Reply With Quote
 
Gregor Kofler
Guest
Posts: n/a
 
      08-19-2008
lorlarz meinte:

> This a program that uses only integers, yet comes up short in its
> addition or count
> when used. HERE IS HOW TO DO THE EXPERIMENT AND SEE:
> Without adding on an arbitrary decimal number less than one (I believe
> I use .9)


You're an idiot. Period. Hit the road!




--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
 
Reply With Quote
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
On Aug 19, 2:04*pm, Joost Diepenmaat <(E-Mail Removed)> wrote:

>
> Just in case it escaped you: 0.9 is NOT an integer, so you are NOT
> working with "just integers". We've done this to death.
>


.9 IS A NEEDED CORRECTION FACTOR AND NOT IN THE PROGRAM THE WAY IT
**FAILS**.

The .9 is what has to be added to make the pure integer arithmetic
stop making
errors and coming up short. In the experiment, you take it OUT.

Once you remove the .9, all are integers and the math is supposed to
be exact,
and it is not.
 
Reply With Quote
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
On Aug 19, 2:06*pm, Stevo <(E-Mail Removed)> wrote:
> lorlarz wrote:
> > Contrary to what one authority in the JavaScript field says:
> > JavaScript does make errors when dealing with just with integers.
> > I use .9) ,

>
> Funny looking integer.


Will you jokers try to think and read carefully. You take the .9 OUT
to see the program fail. It succeeds with the .9 in there. IT IS A
CORRECTION
FACTOR THAT SUPPOSEDLY ID NOT NEEDED, BUT IT IS.

IT FAILS WHEN DOING PURE INTEGER ARITHMETIC WITHOUT THAT .9 Do the
experiment
and learn. To do the experiment you TAKE OUT THE .9
 
Reply With Quote
 
Joost Diepenmaat
Guest
Posts: n/a
 
      08-19-2008
lorlarz <(E-Mail Removed)> writes:

> On Aug 19, 2:04Â*pm, Joost Diepenmaat <(E-Mail Removed)> wrote:
>
>>
>> Just in case it escaped you: 0.9 is NOT an integer, so you are NOT
>> working with "just integers". We've done this to death.
>>

>
> .9 IS A NEEDED CORRECTION FACTOR AND NOT IN THE PROGRAM THE WAY IT
> **FAILS**.
>
> The .9 is what has to be added to make the pure integer arithmetic
> stop making
> errors and coming up short. In the experiment, you take it OUT.
>
> Once you remove the .9, all are integers and the math is supposed to
> be exact,
> and it is not.


Well. how about you bloody well show us the code that demonstrates the
problem in a concise, well-formatted and clear way. Instead of, you
know, rambling on incoherently.

http://www.catb.org/~esr/faqs/smart-....html#id306810


--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
 
Reply With Quote
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
On Aug 19, 2:18*pm, Gregor Kofler <(E-Mail Removed)> wrote:
> lorlarz meinte:
>
> > This a program that uses only integers, yet comes up short in its
> > addition or count
> > when used. *HERE IS HOW TO DO THE EXPERIMENT AND SEE:
> > Without adding on an arbitrary decimal number less than one (I believe
> > I use .9)

>
> You're an idiot. Period. Hit the road!
>
> --http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com*::: meine JS-Spielwiesehttp://www.image2d.com* ** ::: Bildagentur für den alpinen Raum


No.
 
Reply With Quote
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
On Aug 19, 2:18*pm, Gregor Kofler <(E-Mail Removed)> wrote:
> lorlarz meinte:
>
> > This a program that uses only integers, yet comes up short in its
> > addition or count
> > when used. *HERE IS HOW TO DO THE EXPERIMENT AND SEE:
> > Without adding on an arbitrary decimal number less than one (I believe
> > I use .9)

>
> You're an idiot. Period. Hit the road!
>
> --http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com*::: meine JS-Spielwiesehttp://www.image2d.com* ** ::: Bildagentur für den alpinen Raum


Yours is a most unacceptable response to my revealing how authorities
it
the field of JavaScript ARE WRONG. You should be thanking me, before
your
bank account comes up short.
 
Reply With Quote
 
lorlarz
Guest
Posts: n/a
 
      08-19-2008
On Aug 19, 2:34*pm, Joost Diepenmaat <(E-Mail Removed)> wrote:
> lorlarz <(E-Mail Removed)> writes:
> > On Aug 19, 2:04*pm, Joost Diepenmaat <(E-Mail Removed)> wrote:

>
> >> Just in case it escaped you: 0.9 is NOT an integer, so you are NOT
> >> working with "just integers". We've done this to death.

>
> > .9 IS A NEEDED CORRECTION FACTOR AND NOT IN THE PROGRAM THE WAY IT
> > **FAILS**.

>
> > The .9 is what has to be added to make the pure integer arithmetic
> > stop making
> > errors and coming up short. In the experiment, you take it OUT.

>
> > Once you remove the .9, all are integers and the math is supposed to
> > be exact,
> > and it is not.

>
> Well. how about you bloody well show us the code that demonstrates the
> problem in a concise, well-formatted and clear way. Instead of, you
> know, rambling on incoherently.
>
> http://www.catb.org/~esr/faqs/smart-....html#id306810
>
> --
> Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/- Hide quoted text -
>
> - Show quoted text -


Well, its 100% all mine and I take full responsibility. In contrast:
What team of
script kiddie monkeys did you work with for your ajax fiasco?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to avoid Out of Memory Errors when dealing with a large XML file? Saqib Ali Perl Misc 2 01-14-2011 09:31 PM
Subprocess module - communicate(data) dealing with errors Paul Moore Python 0 11-21-2006 10:51 PM
When exceptions aren't enough: Dealing with runtime errors. Aaron W. LaFramboise C++ 4 07-25-2005 04:58 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM
Tips for Dealing with "Just Taylor's" SPAM Anonymous Computer Support 1 07-14-2003 03:45 PM



Advertisments