JavaScript does make errors when dealing just with integers

L

lorlarz

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.
 
J

Joost Diepenmaat

lorlarz said:
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
 
S

Stevo

lorlarz said:
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.
 
G

Gregor Kofler

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!
 
L

lorlarz

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.
 
L

lorlarz

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
 
J

Joost Diepenmaat

lorlarz said:
.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-questions.html#id306810
 
L

lorlarz

lorlarz meinte:


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.
 
L

lorlarz

lorlarz meinte:


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.
 
S

Stevo

lorlarz said:
Will you jokers try to think and read carefully.

I usually stop reading when things start being in capitals - it hurts my
ears when you shout.

To be honest though, I don't really care. I'm not going to create a
voting machine with a scripting language initially designed to tweak web
pages to make them more interesting.
 
T

Tim Streater

lorlarz said:

Well, your example and its accompanying doc was too complex and boring
for me to want to examine it. You need to reduce its complexity.
 
G

Gregor Kofler

"lorlarz" the JS deity thusly spoke:
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.

I'm humbled. Next time you'll tell thy disciples how floats and integers
*really* work.

BTW isn't "lorlarz" the name of an orc or perhaps a (yikes!) *troll* in
some Tolkien book? How appropriate.

Gregor
 
J

Joost Diepenmaat

lorlarz said:
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?

I take it that this means you in fact cannot demonstrate the problem
in any clear fashion.

Thanks for playing.
 
L

lorlarz

I take it that this means you in fact cannot demonstrate the problem
in any clear fashion.

Thanks for playing.

Since I laid down the challenge and it was clear and it was not any
more
or less than any scientist would want, I assume this means you bow to
my
expertise and opinion (by the default of being too lazy to conduct a
test).

Until further notice all should assume integer addition in Javascript
my need
a slight rounding up to be exact.
 
J

Joost Diepenmaat

lorlarz said:
Since I laid down the challenge and it was clear and it was not any
more
or less than any scientist would want, I assume this means you bow to
my
expertise and opinion (by the default of being too lazy to conduct a
test).

See (again):

http://www.catb.org/~esr/faqs/smart-questions.html#id306810
Until further notice all should assume integer addition in Javascript
my need
a slight rounding up to be exact.

That's the stupidest conclusion I've seen you draw all day. You really
should spend less time messing about with the DOM and more time
learning about actual programming.
 
L

lorlarz

See (again):

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


That's the stupidest conclusion I've seen you draw all day. You really
should spend less time messing about with the DOM and more time
learning about actual programming.

Well, if my "colleagues" are unwilling to replicate a clear
experiment, the cautious
Javasripter (who knows not enough to know otherwise) should believe ME
and that:
Until further notice all should assume integer addition in Javascript
may need a slight rounding up to be exact.

Good conclusion. By the way, Crockford has been informed of his
serious
factual error on the basics. I am sure that must sting. He knows he
has
been held to account here.
 
S

Stevo

lorlarz said:
Since I laid down the challenge and it was clear

Maybe it was clear in your mind, and looking at that mess of code, it's
a messy mind. If that's your attempt at stripping the problem down to a
simple clear example, it falls way short. It shouldn't need lots of
instructions on what to do.

Try googling: javascript math inaccuracy
 
L

lorlarz

"lorlarz" the JS deity thusly spoke:


I'm humbled. Next time you'll tell thy disciples how floats and integers
*really* work.

BTW isn't "lorlarz" the name of an orc or perhaps a (yikes!) *troll* in
some Tolkien book? How appropriate.

Gregor

--http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com ::: meine JS-Spielwiesehttp://www.image2d.com     ::: Bildagentur für den alpinen Raum

Hard to really label a person a troll who is talking about a
particular claim
about a particular experiment in computer science (but that seems to
escape
your "sensibilities").
 
J

Joost Diepenmaat

lorlarz said:
Hard to really label a person a troll who is talking about a
particular claim
about a particular experiment in computer science (but that seems to
escape
your "sensibilities").

It's not: you're a troll.

*plonk*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top