ID:149314
 
How do I convert a number out of scientific notation. I tried using num2text. Like...
var/n = rand(1,10000000)
n = num2text(n)

or
var/n = num2text(rand(1,10000000))

But it just gives me a number when printed like
6.28906e+006
instead of.(I think)
6289060
There is a second argument for text2num() that lets you set the signifigant digits. For rand(1,10000000) you will probably want to set it to 8. So text2num(n,8) would get rid of that scientific notation for you.
In response to Loduwijk
Thank you.
So I would do.
var/x = rand(1,10000000)
x = text2num(x,8))
x = num2text(x) //assuming I want it in text format.

Widh I could have a denotate procedure... built in
Making one may be easy though.
proc/Denotate(x)
//Is there a way to find the size of a number in digits?.
s = numbersize(x)
return text2num(x,s)
In response to Exadv1
Exadv1 wrote:
Thank you.
So I would do.
var/x = rand(1,10000000)
x = text2num(x,8))
x = num2text(x) //assuming I want it in text format.

Widh I could have a denotate procedure... built in
Making one may be easy though.
proc/Denotate(x)
//Is there a way to find the size of a number in digits?.
s = numbersize(x)
return text2num(x,s)

It would just be easier to try

return text2num( round(x,1), 20)

20 sig-figs ought to work for anything.

Note that I round off the number -- this gets rid of decimals, which will look very ugly with lots of sig-figs.
In response to Spuzzum
This won't make a number like 1 turn into a number like 10000000. Right?
In response to Exadv1
Exadv1 wrote:
This won't make a number like 1 turn into a number like 10000000. Right?

1 with 20 significant figures is just 1. Any significant figures beyond that which the number actually has are just ignored. =)

I.e -- if you had a number like 37526000000, that only has 5 sig-figs. The other six zeroes that follow it are just placeholders.

Generally, it's almost impossible to reach 20 sig-figs in anything.

Heck:

23,456,789,012,345,678,901

That's 20 sig-figs. I doubt you'll be working with sextillions, much less in the 10s of sextillions. =)

Note: any number above 4 billion is likely not to be completely accurate, due to rounding error.
In response to Spuzzum
What I can't go higher than that!?!?!?!?!?!
LoL I probably shouldn't need to.
The number is for a unique identification system.
It is not text2num it is num2text with the sig-figs.