469,592 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

JavaScript does make errors when dealing just with integers

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.

Aug 19 '08 #1
42 1833
lorlarz <lo*****@gmail.comwrites:
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/
Aug 19 '08 #2
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.
Aug 19 '08 #3
On Aug 19, 2:04*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>
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.
Aug 19 '08 #4
On Aug 19, 2:06*pm, Stevo <n...@mail.invalidwrote:
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
Aug 19 '08 #5
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 fr den alpinen Raum
Aug 19 '08 #6
lorlarz <lo*****@gmail.comwrites:
On Aug 19, 2:04*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>>
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/
Aug 19 '08 #7
On Aug 19, 2:18*pm, Gregor Kofler <use...@gregorkofler.atwrote:
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 fr den alpinen Raum
No.
Aug 19 '08 #8
On Aug 19, 2:18*pm, Gregor Kofler <use...@gregorkofler.atwrote:
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 fr 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.
Aug 19 '08 #9
On Aug 19, 2:34*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
On Aug 19, 2:04*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
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?
Aug 19 '08 #10
lorlarz wrote:
On Aug 19, 2:06 pm, Stevo <n...@mail.invalidwrote:
>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.
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.
Aug 19 '08 #11
In article
<13**********************************@c65g2000hsa. googlegroups.com>,
lorlarz <lo*****@gmail.comwrote:
On Aug 19, 2:18*pm, Gregor Kofler <use...@gregorkofler.atwrote:
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 fr den alpinen
Raum

No.
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.
Aug 19 '08 #12
lorlarz <lo*****@gmail.comwrites:
On Aug 19, 2:34*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>lorlarz <lorl...@gmail.comwrites:
On Aug 19, 2:04*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
>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

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.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 19 '08 #13
On Aug 19, 2:50*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
On Aug 19, 2:34*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
On Aug 19, 2:04*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
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
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.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/- Hide quoted text -

- Show quoted text -
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.

Aug 19 '08 #14
"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

--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur fr den alpinen Raum
Aug 19 '08 #15
lorlarz <lo*****@gmail.comwrites:
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-....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.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 19 '08 #16
On Aug 19, 3:00*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
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-....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.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/
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.
Aug 19 '08 #17
On Aug 19, 2:50*pm, Gregor Kofler <use...@gregorkofler.atwrote:
"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

--http://photo.gregorkofler.at::: Landschafts- und Reisefotografiehttp://web.gregorkofler.com*::: meine JS-Spielwiesehttp://www.image2d.com* ** ::: Bildagentur fr 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").
Aug 19 '08 #18
lorlarz <lo*****@gmail.comwrites:
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*

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Aug 19 '08 #19
lorlarz wrote:
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
Aug 19 '08 #20
On Aug 19, 3:10*pm, Stevo <n...@mail.invalidwrote:
lorlarz wrote:
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:javascriptmathinaccuracy
Don't need to do the google. I have already run the experiment I
described
and seen the error many times. I am a righteous scientist and have
proven
my point scientifically. I wonder if Crockford will find time to see
his
error via THE experiment.
Aug 19 '08 #21
What's wrong lorlarz? No further comments?

I would expect more from a righteous *coughtrollcough* scientist.

Aug 19 '08 #22
Doug Gunnoe wrote:
What's wrong lorlarz? No further comments?

I would expect more from a righteous *coughtrollcough* scientist.
He's preparing his nobel prize acceptance speech.
Aug 19 '08 #23
In article
<be**********************************@y38g2000hsy. googlegroups.com>,
lorlarz <lo*****@gmail.comwrote:
On Aug 19, 3:00*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
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-....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.

--
Joost Diepenmaat | blog:http://joost.zeekat.nl/| work:http://zeekat.nl/

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.
No he hasn't. Your "experiment" is crap. As has already been said, you
need to reduce it to a *simple* example.

In all the history of science, all the best experiments have been
*simple*.
Aug 19 '08 #24
On Aug 19, 5:07*pm, Stevo <n...@mail.invalidwrote:
Doug Gunnoe wrote:
What's wrong lorlarz? No further comments?
I would expect more from a righteous *coughtrollcough* scientist.

He's preparing his nobel prize acceptance speech.
I seriously just lol for real, Stevo.
Aug 19 '08 #25
On Aug 19, 5:11*pm, Tim Streater <timstrea...@waitrose.comwrote:
In article
<bec68de5-1437-4e61-a9a7-fad171d5e...@y38g2000hsy.googlegroups.com>,

*lorlarz <lorl...@gmail.comwrote:
On Aug 19, 3:00*pm, Joost Diepenmaat <jo...@zeekat.nlwrote:
lorlarz <lorl...@gmail.comwrites:
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-....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.
--
Joost Diepenmaat | blog:http://joost.zeekat.nl/|work:http://zeekat.nl/
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.

No he hasn't. Your "experiment" is crap. As has already been said, you
need to reduce it to a *simple* example.

In all the history of science, all the best experiments have been
*simple*.- Hide quoted text -

- Show quoted text -
The experiment is simple. But, it sometimes takes a bit of time to
setup the simple experiment and you are grumbling just because you
are
lazy, as I see it. Nothing is complicated here. There is just the
FACT OF AN INTEGER PROBLEM or parseInt problem, that I have provided
adequate documentaion on. Please see the new uncorrupted thread,
called
"THE integer (or parseInt) inaccuracy all should know about"
Aug 19 '08 #26
lorlarz wrote:
On Aug 19, 3:53 pm, Lasse Reichstein Nielsen wrote:
<snip>
>Your example is short of reproducible, ...
<snip>
Thanks to Lasse Reichstein Nielsen for making the first serious
cogent response. Thanks to him,
It is a pity that you did not read (or understand) all of what he wrote.
I looked again and accurately
recalled how to alter
http://mynichecomputing.com/digitallearning/yourOwn.htm
to produce the unexplained integer or parseInt error.
There is one.
That is very unlikely.
I invite and encourage him and others to respond in the new
uncorrupted thread, "THE integer (or parseInt) inaccuracy all
should know about"
If you wanted to encourage people to try your code you would have proved
the input data that demonstrated the issue rather than referring people
to an incoherent description of how they were expected to create and
format it for themselves.
I am sorry I did not accurately present the case right away,
You may have already spent your credibility, so maybe it does not
matter.
but notice that as soon as there was a first serious response,
I presented the actual problem asap.
Not yet, not until it is not "short of reproducible", which also means
easily reproduced.

If an issue is real it does not need to be teased out of a mass of
convoluted code; it could be demonstrated in a very simple and direct
way. And a programmer who knows what they are doing would easily be able
to do that.
Perhaps it has happened to you that you think
you recall a situation and do not double check. That is
what happened.
I do again apologize. I hope you understand and can forgive me.
You might want to ease back on calling people "script kiddies" and
making out that you are the only person here who knows anything about
browser scripting if you expect to be forgiven for trying to waste so
much of everyone's time.

Richard.

Aug 20 '08 #27
On Aug 19, 9:58*pm, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
lorlarz wrote:
On Aug 19, 3:53 pm, Lasse Reichstein Nielsen wrote:
<snip>
Your example is short of reproducible, ...
<snip>
Thanks to Lasse Reichstein Nielsen for making the first serious
cogent response. *Thanks to him,

It is a pity that you did not read (or understand) all of what he wrote.
I looked again and accurately
recalled how to alter
http://mynichecomputing.com/digitallearning/yourOwn.htm
to produce the unexplained integer or parseInt error.
There is one.

That is very unlikely.
I invite and encourage him and others to respond in the new
uncorrupted thread, "THE integer (or parseInt) inaccuracy all
should know about"

If you wanted to encourage people to try your code you would have proved
the input data that demonstrated the issue rather than referring people
to an incoherent description of how they were expected to create and
format it for themselves.
*I am sorry I did not accurately present the case right away,

You may have already spent your credibility, so maybe it does not
matter.
but notice that as soon as there was a first serious response,
I presented the actual problem asap.

Not yet, not until it is not "short of reproducible", which also means
easily reproduced.

If an issue is real it does not need to be teased out of a mass of
convoluted code; it could be demonstrated in a very simple and direct
way. And a programmer who knows what they are doing would easily be able
to do that.
Perhaps it has happened to you that you think
you recall a situation and do not double check. *That is
what happened.
I do again apologize. *I hope you understand and can forgive me.

You might want to ease back on calling people "script kiddies" and
making out that you are the only person here who knows anything about
browser scripting if you expect to be forgiven for trying to waste so
much of everyone's time.

Richard.
Richard, You lazy bunch of negative pompous lazy windbags will be glad
to see I did
all the work for you.
See the fourth post in the new thread, "THE integer (or parseInt)
inaccuracy all
should know about"

Take five minutes to see the proof.

And, Your're welcome in advance.
Aug 20 '08 #28
On Aug 19, 9:58*pm, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
lorlarz wrote:
On Aug 19, 3:53 pm, Lasse Reichstein Nielsen wrote:
<snip>
Your example is short of reproducible, ...
<snip>
Thanks to Lasse Reichstein Nielsen for making the first serious
cogent response. *Thanks to him,

It is a pity that you did not read (or understand) all of what he wrote.
Lasse actually did not point to what was wrong. I corrected his
particular
worry early on in the new thread.

BUT, looking into the first possibly valid concern of the
first serious responder, I DID recall when and the integer error did
in fact
occur.

I inconvenienced this miserable newsgroup only for as long as it took
for there
to be the first credible brain fart.
[snip]
>
Richard.
Aug 20 '08 #29
On Aug 19, 9:58*pm, "Richard Cornford" <Rich...@litotes.demon.co.uk>
wrote:
lorlarz wrote:
On Aug 19, 3:53 pm, Lasse Reichstein Nielsen wrote:
<snip>
Your example is short of reproducible, ...
<snip>
Thanks to Lasse Reichstein Nielsen for making the first serious
cogent response. *Thanks to him,

It is a pity that you did not read (or understand) all of what he wrote.
Lasse actually did not point to specifically what was wrong.
I corrected his
specific worry early on in the new thread,
"THE integer (or parseInt) inaccuracy all should know about".
Lasse did indicate
the kind of thing that would make my demo invalid and that helped.

Looking into the first possibly valid concern of the
first serious responder, I DID recall when and how the integer error
did
in fact occur and that I had done two things to counter it. Fixing
the
demo to go back to the original version, where I really had the
integer
problem, I realized that *indeed* NOTHING BUT INTEGERS WHERE INVOLVED
in
this version of the program and what I was talking about IS indeed a
problem.

I inconvenienced this miserable newsgroup only for as long as it took
for there to be the first credible activity.

I missed nothing in what Lasse said. You can pretend to make
yourself
feel big. But, that is pathetic.

Main thing is, you all have the proof now in that new thread,
"THE integer (or parseInt) inaccuracy all should know about" , fourth
post.

Maybe something other than a quip or a minor brain fart can now be
triggered.


[snip]
>
Richard.
Aug 20 '08 #30
lorlarz wrote:
Without adding on an arbitrary decimal number less than one (I believe
I use .9) ,
Computers use binary. Would you tell us the *precise* value of 0.9 in
binary, please?

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Aug 20 '08 #31
On Tue, 19 Aug 2008 15:30:35 -0700, lorlarz2 wrote:
[...]
The problem presently is this line:
tempx = parseInt(parseFloat(((fpssArray[i]
[j]).toString()).substring((m*3),(m*3)+3)) + .9);
I'd suggest to read (and try to understand) the docs of "parseInt()"
especially the meaning (and consequence) of the second (radix) argument.

--
Matthias
/"\
\ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
X - AGAINST M$ ATTACHMENTS
/ \
Aug 20 '08 #32
Stevo 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.
Yeah, I thought that too...
Aug 20 '08 #33
On Aug 20, 2:11*am, Matthias Watermann <li...@mwat.dewrote:
On Tue, 19 Aug 2008 15:30:35 -0700, lorlarz2 wrote:
[...]
The problem presently is this line:
tempx = parseInt(parseFloat(((fpssArray[i]
[j]).toString()).substring((m*3),(m*3)+3)) + .9);

I'd suggest to read (and try to understand) the docs of "parseInt()"
especially the meaning (and consequence) of the second (radix) argument.

--
* * * * Matthias
* * /"\
* * \ / * *ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
* * *X * * * * * * * * * * * * * - AGAINST M$ ATTACHMENTS
* * / \
True. Adding the "optional" radix (base) argument fixes the problem:
In
http://mynichecomputing.com/testIntProb/testNew.html
change
tempx = parseInt(((fpssArray[i][j]).toString()).substring((m*3),
(m*3)+3)); TO

tempx = parseInt(((fpssArray[i][j]).toString()).substring((m*3),
(m*3)+3),10);

and the problem seems fixed without the workaround I previously used.

This is verified by Cornford in the other thread on this.

The base is NOT optional because of "features" of the parseInt
function,
seeing things as octal if they begin with zero and then not
recognizing the
digits 8 and 9.

Thanks.
Aug 20 '08 #34
In comp.lang.javascript message <609f1ed2-0820-4676-ba2b-505d2ab4d8b6@s5
0g2000hsb.googlegroups.com>, Tue, 19 Aug 2008 15:30:35,
lo******@gmail.com posted:
>Again, THE real problem IS (and I had forgotten) is that THIS,
tempx = parseInt(((fpssArray[i][j]).toString()).substring((m*3),
(m*3)+3));
does NOT work.

When claiming that something does not work, state which versions of
which browsers you are using, and what if anything their debug
facilities gave you. If you mean that it gave a "wrong" answer, say
what the data and the "incorrect" and hoped-for answers were. If it
gave an error message, say what that was.

For a helpful demonstration, include code to set i j fpssArray[i][j] and
m to known values, and state what you expect and what you actually get.
Use copy'n'paste to ensure faithfulness. When coding, omit superfluous
parentheses and indent in two-space units to show the intended logical
structure. My js-quick.htm will give a first approximation to rational
indentation.

And give your real name and whereabouts when posting, unless you want to
make people think that you are ashamed of your work. And follow other
traditional Usenet conventions too - see sig.

Re your original line
tempx = parseInt(parseFloat(((fpssArray[i][j]).toString()).
substring((m*3),(m*3)+3)) + .9);

One should never use a decimal point without at least one digit on each
side. When reading it, the computer will read it reliably; a human may
not.

Whatever that line is meant to do (assuming toString() is needed), it
does seem to convert a Number to a Number. That can more effectively be
done by purely numeric operations. parseInt should not be used instead
of Math.floor or |0. To convert a decimal digit string to a Number,
unary + is most effective.
--
(c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike 6.05.
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html-Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm: about usage of News.
No Encoding. Quotes precede replies. Snip well. Write clearly. Mail no News.
Aug 20 '08 #35
In comp.lang.javascript message <2ee706d9-336c-4c5c-b375-a750c37b5658@i7
6g2000hsf.googlegroups.com>, Wed, 20 Aug 2008 05:23:46, lorlarz
<lo*****@gmail.composted:
>On Aug 20, 2:11*am, Matthias Watermann <li...@mwat.dewrote:
>On Tue, 19 Aug 2008 15:30:35 -0700, lorlarz2 wrote:
[...]
The problem presently is this line:
tempx = parseInt(parseFloat(((fpssArray[i]
[j]).toString()).substring((m*3),(m*3)+3)) + .9);

I'd suggest to read (and try to understand) the docs of "parseInt()"
especially the meaning (and consequence) of the second (radix) argument.

--
* * * * Matthias
...
Signatures should not be quoted, unless being discussed.
>True. Adding the "optional" radix (base) argument fixes the problem:
If you had read the newsgroup FAQ before posting, as FAQ 2.3 enjoins,
you would have seen in FAQ 4.12 both that and why a second parameter
should ALWAYS be considered for parseInt. You would also have realised
that almost all of us here already knew that, whether by reading the FAQ
or otherwise.

And if you had read FAQ 4.21, you might have realised not only that a
second parameter for parseInt is often needed, but that unary + will
serve in most cases including AFAICS yours.

One of the purposes of a newsgroup FAQ is to pre-empt unnecessary posts
from the more intelligent ignorami.

Of course, any serious JavaScript programmer should be reasonably
familiar with the content of ISO/IEC 16262:2002(E) /* or ...(?) */;
Section 15.1.2.2 refers.

Nevertheless, I still believe that, if the array holds Number values,
then you^H^H^Hone could extract the desired Number value more
effectively by arithmetic. If it holds only Strings, .toString() is
superfluous.
By the way, any recommendation of "Crockford's Book" should
include a warning against going into the better sort of bookshop
and just asking for "Crockford". Outside the present context,
John's book is more widely known than Doug's, as any Vicar
should be able to confirm.

Opera is 9.52.

--
(c) John Stockton, nr London UK. ??*@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Check boilerplate spelling -- error is a public sign of incompetence.
Never fully trust an article from a poster who gives no full real name.
Aug 20 '08 #36
On Aug 20, 5:35*pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <2ee706d9-336c-4c5c-b375-a750c37b5658@i7
6g2000hsf.googlegroups.com>, Wed, 20 Aug 2008 05:23:46, lorlarz
<lorl...@gmail.composted:
On Aug 20, 2:11*am, Matthias Watermann <li...@mwat.dewrote:
On Tue, 19 Aug 2008 15:30:35 -0700, lorlarz2 wrote:
[...]
The problem presently is this line:
tempx = parseInt(parseFloat(((fpssArray[i]
[j]).toString()).substring((m*3),(m*3)+3)) + .9);
I'd suggest to read (and try to understand) the docs of "parseInt()"
especially the meaning (and consequence) of the second (radix) argument.
--
* * * * Matthias
...

Signatures should not be quoted, unless being discussed.
True. *Adding the "optional" radix (base) argument fixes the problem:

If you had read the newsgroup FAQ before posting, as FAQ 2.3 enjoins,
you would have seen in FAQ 4.12 both that and why a second parameter
should ALWAYS be considered for parseInt. *You would also have realised
that almost all of us here already knew that, whether by reading the FAQ
or otherwise.

And if you had read FAQ 4.21, you might have realised not only that a
second parameter for parseInt is often needed, but that unary + will
serve in most cases including AFAICS yours.

One of the purposes of a newsgroup FAQ is to pre-empt unnecessary posts
from the more intelligent ignorami.

Of course, any serious JavaScript programmer should be reasonably
familiar with the content of ISO/IEC 16262:2002(E) /* or ...(?) */;
Section 15.1.2.2 refers.

Nevertheless, I still believe that, if the array holds Number values,
then you^H^H^Hone could extract the desired Number value more
effectively by arithmetic. *If it holds only Strings, .toString() is
superfluous.

* * * * By the way, any recommendation of "Crockford's Book" should
* * * * include a warning against going into the better sort of bookshop
* * * * and just asking for "Crockford". *Outside the present context,
* * * * John's book is more widely known than Doug's, as any Vicar
* * * * should be able to confirm.

Opera is 9.52.

--
(c) John Stockton, nr London UK. *?...@merlyn.demon.co.uk *Turnpike v6.05 *MIME.
*Web *<URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms,& links.
* * *Check boilerplate spelling -- error is a public sign of incompetence.
* * Never fully trust an article from a poster who gives no full realname.
Sorry I didn't read everything. Not too sorry, though.

You are also correct that the toString is superfluous since the
fpssArray element does
hold a string.
I did not do everything perfectly correctly 4 years ago, when the
program was written.
(Of course I do now.)

But, I suspect I do some things few others in this newsgroup do
nowadays and I do them
well, as well.
Aug 21 '08 #37
On Aug 20, 7:08*pm, lorlarz <lorl...@gmail.comwrote:
On Aug 20, 5:35*pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <2ee706d9-336c-4c5c-b375-a750c37b5658@i7
6g2000hsf.googlegroups.com>, Wed, 20 Aug 2008 05:23:46, lorlarz
<lorl...@gmail.composted:
>On Aug 20, 2:11*am, Matthias Watermann <li...@mwat.dewrote:
>On Tue, 19 Aug 2008 15:30:35 -0700, lorlarz2 wrote:
[...]
The problem presently is this line:
tempx = parseInt(parseFloat(((fpssArray[i]
[j]).toString()).substring((m*3),(m*3)+3)) + .9);
>I'd suggest to read (and try to understand) the docs of "parseInt()"
>especially the meaning (and consequence) of the second (radix) argument.
>--
>* * * * Matthias
>...
Signatures should not be quoted, unless being discussed.
>True. *Adding the "optional" radix (base) argument fixes the problem:
If you had read the newsgroup FAQ before posting, as FAQ 2.3 enjoins,
you would have seen in FAQ 4.12 both that and why a second parameter
should ALWAYS be considered for parseInt. *You would also have realised
that almost all of us here already knew that, whether by reading the FAQ
or otherwise.
And if you had read FAQ 4.21, you might have realised not only that a
second parameter for parseInt is often needed, but that unary + will
serve in most cases including AFAICS yours.
One of the purposes of a newsgroup FAQ is to pre-empt unnecessary posts
from the more intelligent ignorami.
Of course, any serious JavaScript programmer should be reasonably
familiar with the content of ISO/IEC 16262:2002(E) /* or ...(?) */;
Section 15.1.2.2 refers.
Nevertheless, I still believe that, if the array holds Number values,
then you^H^H^Hone could extract the desired Number value more
effectively by arithmetic. *If it holds only Strings, .toString() is
superfluous.
* * * * By the way, any recommendation of "Crockford's Book" should
* * * * include a warning against going into the better sort ofbookshop
* * * * and just asking for "Crockford". *Outside the presentcontext,
* * * * John's book is more widely known than Doug's, as any Vicar
* * * * should be able to confirm.
Opera is 9.52.
--
(c) John Stockton, nr London UK. *?...@merlyn.demon.co.uk *Turnpikev6.05 *MIME.
*Web *<URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
* * *Check boilerplate spelling -- error is a public sign of incompetence.
* * Never fully trust an article from a poster who gives no full real name.

Sorry I didn't read everything. *Not too sorry, though.

You are also correct that the toString is superfluous since the
fpssArray element does
hold a string.
I did not do everything perfectly correctly 4 years ago, when the
program was written.
(Of course I do now.)

But, I suspect I do some things few others in this newsgroup do
nowadays and I do them
well, as well.
Dr J R Stockton

Actually, I wrote the JS scorer 5 years ago, I just checked. No
wonder I did not
recall the details of my troubles. Still, I should have refreshed
better and
looked at the details and given a bit more thought, and I could likely
have
caught the parseInt problem (actually my problem in the way I used
parseInt)
myself. I am more sorry for that than not reading the FAQ of this
newsgroup.
Here's why:

Frankly, there are quite a few ".9 people" (if you know
what I mean) HERE who never seem to read, look, or think
clearly. They like to try to pounce or pile on, usually failing.
And, their complaints
seem so vague they seem to be more due to their confusion and
ignorance and inability to understand than their supposed concerns
with "clarity" or "quality".

In short, contrary to what you indicate, this newsgroup
did (and does) not appear to be as sophisticated a newsgroup
as you say. Probably just wishful thinking, on your part.
I would have guessed the FAQ would have been less.

Let me say a bit more:
The frustration these ".9ers" have with my fine JavaScript
Applications (PROGRAMS) seems to relate not only to the
fact they have never done one (and perhaps never seen one)
but to this lack of sophistication (and knowledge).
Those things and jealousy, of course.

When more can show their programs, I will shut up and
learn from such. Believe me. I get busy when I have
something to be busy with. I would love to have
something better to do than just read drivel here.
Aug 21 '08 #38
lorlarz wrote:
....
When more can show their programs, I will shut up and
learn from such. Believe me. I get busy when I have
something to be busy with. I would love to have
something better to do than just read drivel here.
I have been wondering also whether the active posters here really have
written 'long programs' (e.g. at least some hundreds of lines), which they
are proud of and which would be appreciated here by the experts of the
newsgroup. It is easy to complain about everything what Microsoft and others
have done, but it might be difficult to show 'Here is a long javascript
program , which in our opinion is a good example for any javascript newbie
to learn about.'

I downloaded 'Fork', written by Peter Michaux. Fork resembles Yahoo and
Mootools (according to Peter as far as I can remember). Opinions about this
framework? (a new thread can be started about this.
Aug 21 '08 #39
On Aug 21, 3:04*am, "optimistx" <optimistxPoi...@poistahotmail.com>
wrote:
lorlarz wrote:

...
When more can show their programs, I will shut up and
learn from such. *Believe me. *I get busy when I have
something to be busy with. *I would love to have
something better to do than just read drivel here.

I have been wondering also whether the active posters here really have
written 'long programs' (e.g. at least some hundreds of lines), which they
are proud of and which would be appreciated here by the experts of the
newsgroup. It is easy to complain about everything what Microsoft and others
have done, but it might be difficult to show 'Here is a long javascript
program *, which in our opinion is a good example for any javascript newbie
to learn about.'

I downloaded 'Fork', written by Peter Michaux. Fork resembles Yahoo and
Mootools (according to Peter as far as I can remember). Opinions about this
framework? (a new thread can be started about this.
I am glad someone else is wondering. I can tell you that I would
love
to hear about and examine other peoples' good full javascript
programs (applications). I have processed ALL of them that has
ever been in a book written in English 1999- the present.
But, good large neat examples
of applications seems to have dried up.
Aug 21 '08 #40
On Aug 21, 3:04*am, "optimistx" <optimistxPoi...@poistahotmail.com>
wrote:
lorlarz wrote:

...
When more can show their programs, I will shut up and
learn from such. *Believe me. *I get busy when I have
something to be busy with. *I would love to have
something better to do than just read drivel here.

I have been wondering also whether the active posters here really have
written 'long programs' (e.g. at least some hundreds of lines), which they
are proud of and which would be appreciated here by the experts of the
newsgroup. It is easy to complain about everything what Microsoft and others
have done, but it might be difficult to show 'Here is a long javascript
program *, which in our opinion is a good example for any javascript newbie
to learn about.'

I downloaded 'Fork', written by Peter Michaux. Fork resembles Yahoo and
Mootools (according to Peter as far as I can remember). Opinions about this
framework? (a new thread can be started about this.
About Peter's framework: I have not looked at it. I really have
only
learned jQuery and liked it for some things. The truth is, having
done JavaScript from scratch with no libraries for a whole decade,
I rarely use any library, if I already know routines. (There really
is very little one has to do to develop one's own mini-mini-library
to
take care of all DOM and browser and platform incompatibilities --
though admittedly some of those routines I got from others). In all
my
applications, I have used a library only once -- for it greatly
simplified doing callbacks on a sort of custom event and I did not
want
to have to do all that from scratch. JQuery made doing this complex
drag-and-drop builder program easy (did it in a couple of days; by
myself
perhaps weeks would have been involved.
Aug 21 '08 #41
In comp.lang.javascript message <2d695a73-eb79-43f1-9897-9dfe9b4eebef@k1
3g2000hse.googlegroups.com>, Wed, 20 Aug 2008 17:38:21, lorlarz
<lo*****@gmail.composted:
>
Frankly, there are quite a few ".9 people" (if you know
what I mean) HERE who never seem to read, look, or think
clearly.
Agreed. You are clearly one of them.

--
(c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike 6.05.
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html-Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm: about usage of News.
No Encoding. Quotes precede replies. Snip well. Write clearly. Mail no News.
Aug 21 '08 #42
Dr J R Stockton wrote:
In comp.lang.javascript message
<2d695a73-eb79-43f1-9897-9dfe9b4eebef@k1 3g2000hse.googlegroups.com>,
Wed, 20 Aug 2008 17:38:21, lorlarz <lo*****@gmail.composted:
>>
Frankly, there are quite a few ".9 people" (if you know
what I mean) HERE who never seem to read, look, or think
clearly.

Agreed. You are clearly one of them.
In your signature there are good and interesting links e.g. to prof. Timo
Salmi's pages

http://lipas.uwasa.fi/~ts/http/police.html

and somebody there is asking:

"Timo, given the abuse by some users, I don't know why you are still so
friendly to the people on the Usenet news and point them to the right
directions."

and he answers

"Thank you. Truthfully, however, I do not always manage to moderate my tone,
even if I should. However, when I do it is based on a long-time experience
on the Usenet news. Given the great number of readers in the international
newsgroups there are bound to also be abusive reactions to any advice one
gives. Nothing is gained by getting excessively upset about such cases.

...."


Aug 21 '08 #43

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.