Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Is 012345678999 a valid decimal number in computer?
If yes then how if decimal number system can contain only ten digits. How to calculate it and find the result?

What I have tried:

Is 012345678999 a valid decimal number in computer?
Posted
Updated 15-Apr-22 0:39am
Comments
Graeme_Grant 15-Apr-22 5:29am    
Can you give some context ... what programming language are you using?
Richard MacCutchan 15-Apr-22 6:03am    
Depending on the context, it may not be a valid decimal number as it has a leading zero. But since you have not given us any useful information we cannot say more.

It depends on a whole load of factors, including the language and / or compiler you are using.

And of course, on the data types they support.

"standard" integers, can't hold it: a signed 32 bit value can only get up to 2147483647 before it runs out of space.
But a 64 bit integer (called a long in many languages) can hold all the values between -9223372036854775808 and 9223372036854775807 without problems, and a floating point (float or double) can hold values from -1.7976931348623157E+308 to 1.7976931348623157E+308, though you may lose some precision once the "digits count" gets too big.

But even then, some languages provide an "unlimited" integer. For example .NET has the BigInteger Struct (System.Numerics) | Microsoft Docs[^] which can hold pretty much as many digits as your computer has free memory!

So there isn't a simple "one answer" which fits your question - there are way too many variables involved to do that!
 
Share this answer
 
Quote:
Is 012345678999 a valid decimal number in computer?

There is no reason it wouldn't be valid.
You just have to use correct datasize (large enough to handle the number).
Quote:
If yes then how if decimal number system can contain only ten digits.

A 64 bits integers have no problem to handle your number.
Computer libraries can also handle infiite integers or floats (with decimals).
The GNU MP Bignum Library[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900