I hava a number too large and when i plus it with another number the result is showed in exponential notation on my screen.
how to not leave the javascript do that?
Thanks
how to not leave the javascript do that?
Thanks
Number.prototype.todigits= function(){
var tem='', z, d, s= this.toString(),
x= s.match(/^(\d+)\.(\d+)[eE]([-+]?)(\d+)$/);
if(x){
d= x[2];
z= (x[3]== '-')? x[4]-1: x[4]-d.length;
while(z--)tem+='0';
if(x[3]== '-'){
return '0.'+tem+x[1]+d;
}
return x[1]+d+tem;
}
return s;
}
//TEST var n= 0.00000000009284476546528123456781, n2= 9284476546528123456781; alert(n+'\n'+n.todigits()+'\n'+ n2+'\n'+n2.todigits()) returned value: (String): 9.284476546528124e-11 0.00000000009284476546528124 9.284476546528124e+21 9284476546528124000000
Comment