London Banter

London Banter (https://www.londonbanter.co.uk/forum.php)
-   London Transport (https://www.londonbanter.co.uk/london-transport/)
-   -   More Oyster Woes ... (https://www.londonbanter.co.uk/london-transport/11343-more-oyster-woes.html)

Dr J R Stockton[_22_] October 29th 10 10:33 PM

More Oyster Woes ...
 
In uk.transport.london message
ernal-september.org, Thu, 28 Oct 2010 17:35:20, Sam Wilson
posted:

In article id,
Dr J R Stockton wrote:


...



In JavaScript, where Numbers are Doubles, one does it by taking the
reciprocal. Plus infinity and minus infinity are easily told apart.
The internal sign of a Number X (that is not NaN) can be determined by
comparing X + 1/X with a zero. Min(Abs(X+1/X)) = 2, at least for real
numbers.


Yeah, but you can't say something like

if (result == +0)
{
...
}
else if (result == -0)
{
...
}

can you?

Sam

and have it operate differently from



In JavaScript, float +0 and -0 are arithmetically equal in value, but
their reciprocals differ. Integer operations are 32-bit 2's complement;
+0 & -0 convert to the same Hex value, 00000000. It's all in ECMA 262
5th Edn, free PDF.

--
(c) John Stockton, nr London UK. IE8 FF3 Op10 Sf5 Cr7
news:comp.lang.javascript FAQ http://www.jibbering.com/faq/index.html.
http://www.merlyn.demon.co.uk/js-index.htm jscr maths, dates, sources.
http://www.merlyn.demon.co.uk/ TP/BP/Delphi/jscr/&c, FAQ items, links.

Steve Dulieu[_3_] November 8th 10 12:10 AM

More Oyster Woes ...
 


"Dr J R Stockton" wrote in message
nvalid...

In uk.transport.london message
ernal-september.org, Thu, 28 Oct 2010 17:35:20, Sam Wilson
posted:

In article id,
Dr J R Stockton wrote:


...



In JavaScript, where Numbers are Doubles, one does it by taking the
reciprocal. Plus infinity and minus infinity are easily told apart.
The internal sign of a Number X (that is not NaN) can be determined by
comparing X + 1/X with a zero. Min(Abs(X+1/X)) = 2, at least for real
numbers.


Yeah, but you can't say something like

if (result == +0)
{
...
}
else if (result == -0)
{
...
}

can you?

Sam

and have it operate differently from



In JavaScript, float +0 and -0 are arithmetically equal in value, but
their reciprocals differ. Integer operations are 32-bit 2's complement;
+0 & -0 convert to the same Hex value, 00000000. It's all in ECMA 262
5th Edn, free PDF.

Yeah, but how does it define N,S,E,W,Up & Down..:-)

--
Cheers, Steve.
To reply, replace the rodent with the unsullied maiden.



All times are GMT. The time now is 04:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2006 LondonBanter.co.uk