JRS: In article <4c**************************@posting.google.com >, seen
in news:comp.lang.javascript, chirs <ym*@kicon.com> posted at Sat, 4 Oct
2003 12:38:24 :-
What is the maximum number in JavaScript? I tried a large number like
0xff...ff with 30 fs, it still gives me a number, not an infinity. I
use IE6.
The maximum value of an object of type Number, etc., is about 1.7E308,
as the native number representation is as an IEEE Double.
But a programmer is free to construct entities using a different
notation, and to do arithmetic differently :
function BigFac(J) { var L = 0, k
for ( k=1 ; k<=J ; k++ ) L += Math.log(k)
L *= Math.LOG10E
return Math.exp((L%1)/Math.LOG10E) + 'E' + Math.floor(L) }
function TryBig() {
document.write('Thus<tt> 3333! = ', BigFac(3333), '<\/tt>') }
gives : Thus 3333! = 1.8497400355653586E10296
All integers up to and including 2^53 = 9007199254740992, and their
negatives, can be represented exactly.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.