JRS: In article <11*********************@f14g2000cwb.googlegroups. com>,
dated Wed, 10 Aug 2005 05:45:37, seen in news:comp.lang.javascript,
tozeina <to*****@gmail.com> posted :
Can any one help in this please.
I'm using eval function in JavaScript, But when the eval method return
a big big number the result will be a number with "E"
for example :
Eval(1000000000000000000000) will result 1e+21
I need to get the number as it is . can i ??
No doubt you should not in fact be using eval - see newsgroup FAQ 4.40.
In javascript, Numbers are stored as IEEE Doubles, a binary floating-
point format. If you want to see that, which you don't, consider
<URL:http://www.merlyn.demon.co.uk/js-misc0.htm#IEEE>.
If you really do need to express a large number in fixed-point, you will
need to accept rounding errors (though it may be possible to mask the
obvious ones) - see BigStrOfMN in
<URL:http://www.merlyn.demon.co.uk/js-round.htm#CAI>.
Alternatively, if you want results accurate past one part in about 1e15,
you can implement your own arithmetic using arrays of digits to
represent numbers. I've done it, for Pascal/Delphi integer work, in
<URL:http://www.merlyn.demon.co.uk/programs/longcalc.pas>.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.