Skip to main content

Questions tagged [numbers]

For questions relating to any data type that is numerical. This may include integers, rational numbers, floating-point, fixed-point, and large numbers.

Filter by
Sorted by
Tagged with
18 votes
7 answers
1k views

What are the advantages and disadvantages of implementing reals as rationals?

(By rationals, I mean fractions. So, 0.5 would be stored as 1/2.) There's only one language I know of which does this. So, what ...
The Thonnu's user avatar
  • 1,508
12 votes
6 answers
421 views

What are the disadvantages of this far-fetched idea: All integers can be treated as boolean arrays?

I do not know of any languages that support this idea but I just thought that since numbers are just bits, why should we not be able to access those bits directly? In most languages such as C or C++, ...
CPlus's user avatar
  • 8,261
11 votes
6 answers
549 views

What are the downsides of having types for floats and integers?

What are the downsides to having different data types for floats and integers instead of just a number data type? I know that having different ones can improve memory usage. But are there any ...
Ethan's user avatar
  • 377
4 votes
1 answer
218 views

Implementing a number to string semantics efficiently in a C-style language?

In C our options for converting numbers to strings and adding them to a string are limited to: Write your own function. sprintf() to a buffer. Either way, one ...
CPlus's user avatar
  • 8,261