Whenever I write a long number I get something like this 7.03398e+008 . Yea sure it's a condensed version, I get that but what if I wanted to actually just write a long number?
Thank you. This has been bugging me for so long now.
ID:154948
Oct 29 2011, 9:31 pm
|
|
Oct 29 2011, 9:34 pm
|
|
use the num2text proc
|
The funny part being, the number they give you is quite a bit bigger than the actual one.
|
As ZOMGbies said, use the num2text proc, however I would first recommend trying the search function on the forum, as this question has arrived and been solved many times before.
|
In response to El Wookie
|
|
Okay, thanks.
|
In response to Moonlight Memento
|
|
What do you mean? It's not changing any numbers.
|
In response to Warlord Fred
|
|
When numbers are in the millions, byond outputs them as though a calculator would when youve made a number too wide for the screen.
To combat this you transform the numbers into text and byond treats them like a sentence |
In response to Saucepan Man
|
|
It's scientific notation. e means 10, and e+008 would be 10^8, or 100000000. 7.03398e+008 is 703398000.
|
In response to Warlord Fred
|
|
It's also a bigger number in text.
1,250,000 is smaller than 1,250,0e+007. Why does BYOND default to the e+thousands of numbers, anyway? I can't think of a single person who'd actually want that for any form of project. |
In response to Moonlight Memento
|
|
Because,
1,250,000,000,000,000,000,000,000,000,000,000 is not shorter than 1,250,0e+034 |
In response to Moonlight Memento
|
|
By default, if the number of significant figures exceeds 6, the number will be in scientific notation. If you don't like that, use num2text(1250000,9) so that it won't output a scientific notation unless the number of significant figures exceeds 9.
|
In response to El Wookie
|
|
El Wookie wrote:
Because, That's actually a number, though. I doubt aside from people who took programming classes (which is where I assume you'd see this) would know 1,781,0e+08 actually means something. |
In response to Jemai1
|
|
I don't get why it does it at all. No other thing does this, and it's not like it'd really be helpful for anything that I can think of.
Only reason I can think of as to why they can't just default it to an actual number, is that it might break old games. |
In response to Moonlight Memento
|
|
It's probably got something to do with the amount of bytes you can contain within an int that BYOND handles. Hence it uses an algebraic formula to reduce the byte size.
I have no clue if this is correct, but it seems logical. |
In response to Moonlight Memento
|
|
It's for memory purposes. Once a variable reaches a certain point of taking up too many bytes, BYOND condenses it so that it doesn't use up as much memory.
You could easily work around this problem with a datum and datum mathematical functions. |