how JavaScript treats zeros?

S

SteveYoungTbird

Hopefully to put this off-topic "discussion" to a quick end:


Ad-hominem/genetic fallacy.

Thank you Thomas for the explanations and this is definitely my last
word on the subject but I would like to know what you think is
ad-hominem about my comment above. Flatland is a famous novel written in
1884 about life in a two-dimensional world,
http://en.wikipedia.org/wiki/Flatland
 
E

Evertjan.

Lasse Reichstein Nielsen wrote on 04 jun 2011 in comp.lang.javascript:
He's probably talking about an extension of the real plance, e.g.,
http://en.wikipedia.org/wiki/Line_at_infinity
as if it's the only possible model.

You can make mathematical models that have the properties that was
given - but it's not the only possible models.

But for you mixing of "he" and "you" and incomplete quoting, I agree.

I was talking about my model.

Because mathematics is just a simplfied model of the world,
any model-definition is possible.

Any number model that includes "infinity" is flawed in the sense,
that "infinity" is not part of the tangible, if you wish "real", world,
UNLESS such "infinity" is defined as an approachable limit.

The same goes for +0 and -0.

If you assume tha latter, there can also be a difference between
"7 approximated to a limit from below 7"
and
"7 approximated to a limit from over 7".

If you take that in your model,
then +0 and -0 are not special at all.

However 0 and even more 7 are very tangible as compared to infinity.

Does that mean it is very practical to include those models into
Javascript, like those having +0 and -0?

Methinks NOT, not without direct access to the binary floating value.
 
T

Thomas 'PointedEars' Lahn

SteveYoungTbird said:
Thank you Thomas for the explanations and this is definitely my last
word on the subject but I would like to know what you think is
ad-hominem about my comment above. Flatland is a famous novel written in
1884 about life in a two-dimensional world,
http://en.wikipedia.org/wiki/Flatland

Ah, sorry, I misinterpreted that to be a reference to the Netherlands where
your opponent appears to live. Thank your for the clarifiction, I will add
that book to my to-read list :)


PointedEars
 
T

Thomas 'PointedEars' Lahn

Jukka said:
The way to put off-topic "discussions" to an end is to stop posting
off-topic "comments". But you seem to have chosed to keep posting long

_chosen_ (no, I have not)
off-topic "comments", in a manner that has apparently been crafted to
provoke further "discussion".

It appears that you hold me responsible for your failings. It does not work
that way. (Pot, kettle, black.)

I had watched this "discussion" going on in my scorefile long enough to see
that it is not going to lead anywhere and probably would not end
(successfully) without some intervention of a third party, because none of
the participants had been able or willing to provide a sound argument (just
look at the number of fallacies). As expected, my well-considered
intervention has been considered useful. So you really have nothing to
complain about.
F'ups set.

No, you did not. In your off-topic ad-hominem reply (in brief, trolling),
you have confused Reply-To (which accepts a mailbox) with Followup-To (which
accepts a comma-separated list of newsgroups, or "poster"), which makes it
impossible (at least it requires more effort that I am willing to invest
here) to reply via e-mail only. Here is how it is done.


F'up2 poster

PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>
Dr J R Stockton wrote on 02 jun 2011 in comp.lang.javascript:


See my posting, I said "my interpretation is".

On which Stephan said I was wrong, which is nonsense,
because at least I was right in stating what my interpretation was and is.

The implementation of Javascript storing +0 and -0,
but not being able to recall the difference but by devious means,
such as 0/-0, seems a serious implementation and specification flaw.

If we had a direct conversion from stored value to binary content of that
value, then perhaps my view would be different.

We have such a conversion, in
<http://www.merlyn.demon.co.uk/js-exact.htm>.


I wouldn't call infinity a number.

btw, what about:
in a 2-dimensional world 2 straight lines always interconnect,
2 parallel straight lines do so at infinity,
as a 2-dimensional world is not an infinite square.

You are assuming the 2D world to be equivalent to a plane section of an
infinite Euclidean 3-D space;
<http://www.merlyn.demon.co.uk/quotings.htm#Alfonso>.
 
E

Evertjan.

Dr J R Stockton wrote on 04 jun 2011 in comp.lang.javascript:

".. direct ..", meaning Javascript internal/standard functions.

With scripted functions, you can implement anything within reason.
You are assuming the 2D world to be equivalent to a plane section of an
infinite Euclidean 3-D space;
<http://www.merlyn.demon.co.uk/quotings.htm#Alfonso>.

Indeed Euclidian, other mathematical models should not apply in standard
Javascript mathematics.

If you enter other dimensions in any mathematical modell,
you get more strange phenomena than only my assunmption [for this
discussion only] that infinite is just the opposite of the 1D coordinate
0, or of the 2D coordinates 0,0 if we talk about parallel lines.

Then you could have 1D with tunneling, with zero length tunnels, between
every two even integers, as with an intricate folding in an external 2nd
dimension having no depth at all, so tha the shortest distance between
two places in that world can never be more than 1, while distances like
107.53 and infinite distance certainly exist. In such a world there are a
varialbe number of straight line connections between two points, only one
or sometimes two being the shortest ones.

This could simply be implemented by Javascript scripting functions and
even useful in complex situations.
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
Hence my asking, because the statement above would be false then (it is a
common misconception that Number.MIN_VALUE was -Number.MAX_VALUE.)


That does not appear to have anything to do with Jukka's statement, though.

It was in response to what you wrote. It takes a (one-bit) number J,
and repeatedly reduces it until it has vanished. J's previous value K
is 5e-324 which matches that in ECMA 5 15.7.3.3.
 
E

Evertjan.

Stefan Weiss wrote on 05 jun 2011 in comp.lang.javascript:
The affine number system adds +Infinity and -Infinity to the set of
real numbers; the projective system adds only (unsigned) Infinity.
Unless we specify which number system we refer to, statements like
"positive and negative infinity are the same" or the reply "you
couldn't be more wrong" are pointless. In my defense, I had only
intended to make a harmless mathematical pun, which predictably
backfired.

Neither of these number systems are used in JS, where +Infinity,
-Infinity, and even NaN are _numbers_. No mathemetical system (that I
know of) calls infinity a number, and certainly none of them calls
"not-a-number" a number. These values, like the signed zero, are
merely artifacts of the programming language we use.

Regarding Steve Young's question about how parallel lines can "meet"
in infinity - this is hard to grasp intuitively, but it's a logical
consequence of the concept of infinity. Here is one way to look at it:
imagine two straight lines in a cartesian coordinate system; one for
y = 2 and one for y = 4. If you draw the graphs for -10 < x < 10, the
distance between the lines is quite noticeable. The graphs for
-1000 < x < 1000 would show them very close to each other. The further
you go on the x axis, the less important the distance between the
lines becomes, until the distance 2 becomes completely meaningless
when compared to an infinite x. With the distance between the lines
gone, the can be said to "meet in infinity".
In number systems which include infinity, finite values can drop out
of arithmetic expressions:

∞ + 5 = ∞ ∞ - 5 = ∞
∞ * 5 = ∞ ∞ / 5 = ∞

The results of some types of expressions are usually left undefined,
like ∞ * 0, ∞ - ∞, or ∞ / ∞. In JS, the result for these
three is NaN. On the other hand, in JS, the result of 5 / 0 is
Infinity, where it could just as well have been defined as NaN. In
conclusion, JS and mathematics don't always mix well - which, I think,
sums up this thread rather nicely :)

Well summarized, Stefan.
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:

The most intelligent move to make that more likely would be to abstain
from further participation.

The records prove you wrong.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Dr said:
Thomas 'PointedEars' Lahn posted:

It was in response to what you wrote.

No, it was not.
It takes a (one-bit) number J,
and repeatedly reduces it until it has vanished. J's previous value K
is 5e-324 which matches that in ECMA 5 15.7.3.3.

*I* know the value of *Number.MIN_VALUE*.


PointedEars
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top