# Tag Info

Accepted

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

Floating-point vs rational representation Advantages of rational representation: Precision: rational numbers are exact. 1/7 prints as ...
• 3,779

### What are the drawbacks of allowing implicit boolean/integer conversions?

The main drawback of allowing implicit boolean/integer conversions is, it makes it impossible to prevent errors that result from confusion of a boolean and an integer. Next time you confuse the order ...
• 1,676
Accepted

### What are some advantages/disadvantages of having built-in syntax to represent numbers in non-decimal bases?

One advantage is bitwise arithmetic. Bitwise arithmetic is much easier to understand in bases with a power of 2 radix such as hexadecimal. Here it is fairly clear that I am masking out every other ...
• 8,251
Accepted

### What are the drawbacks of allowing implicit boolean/integer conversions?

There is a particular drawback of allowing implicit conversions (aka coercions*) from bool to int in dynamic languages such as ...
• 18.8k

### What are some advantages/disadvantages of having built-in syntax to represent numbers in non-decimal bases?

In a domain where a specific base is used, it is clearer if the code can reflect this and still be efficient. For example, airplane transponders use base 8, and colours are often represented in base ...
• 3,138

### What are the disadvantages of not handling big numbers?

Applications of "big numbers" The last paragraph of my answer to Did the 2019 discovery of O(N log(N)) multiplication have a practical outcome? gives some examples of cases in which large ...
• 825
Accepted

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

I wouldn't store them as arrays, but you can certainly implement such a syntax efficiently. If you translate x[0] to x & 1 ...
• 146

### What are the disadvantages of not handling big numbers?

The question asks a double negative, so I'll answer the simpler question of what advantages there are to supporting big numbers. To me, the main benefit is peace of mind ─ sure, my auto-incrementing ...
• 18.8k

### What are some advantages/disadvantages of having built-in syntax to represent numbers in non-decimal bases?

The other answers so far have exclusively focused on advantages. There are two disadvantages I can think of, though neither is really a strong enough reason to exclude this feature from a language. ...
• 18.8k

### What are the pros and cons of fixed-point arithmetics vs floating-point arithmetics?

The main upside of floating-point arithmetic is that it allows for reprensenting a wider range of magnitudes than a fixed-point number using the same number of bits, while also allowing for more ...
• 18.8k

### What are the drawbacks of allowing implicit boolean/integer conversions?

Booleans may not just be 1 or 0 Much of this depends on the underlying representation of the value. My particular experience of this is with C. Before C99, there was no boolean type, only integers ...
• 281

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

It would encourage inefficient code 90% of the time when you're doing individual bit lookups on an int, you're doing something "wrong". E.g., this would encourage those who don't feel ...
• 4,342

### What are the disadvantages of not handling big numbers?

"Super common" is a relative thing; I don't often use large numbers in my code, but I know people who do. It mostly depends on what your language is meant to be used for; tiny esoteric ...
• 2,619

### What are the disadvantages of not handling big numbers?

Actual high-magnitude numbers aren't usually needed, but precision is much more often an issue, and the two often go together. For example, using 64-bit floats to represent money amounts can quickly ...
• 3,138

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

I am implementing a language that uses rationals by default. Let me tell you why. The other answers are correct that performance and memory use are worse with rationals. My rationals are 32 bytes ...
• 2,608

### What are the drawbacks of allowing implicit boolean/integer conversions?

In addition to all the other fine answers, Boolean coercions are not consistent across languages: Zero (0) is considered falsy in Python and JavaScript, but truthy ...
• 181

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

Why not both? That is, make your “real” type a variant that can store either an exact rational or an approximate floating point value. You could make rational the “default”, in that literal ...
• 1,879

### What are some advantages/disadvantages of having built-in syntax to represent numbers in non-decimal bases?

Runtime safety With syntax like 0x1A50 instead of parseInt("1A50",16) you can make sure at compile time that ...
• 1,359

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

Strictly speaking, an "array" is a specific kind of data structure where elements are stored at contiguous, equally-spaced memory addresses. The smallest addressable unit of memory is ...
• 18.8k

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

The main advantage of having a number type is simplicity and ease of use. Many versions of BASIC just had floating point numbers, which reduced the size of the code (given that the first home computer,...
• 361
Accepted

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

It's not a common case, but integral data types (sometimes known as shorts and longs) allow for integer overflow, which may be used by clever programmers (if the programming language allows it). E.g. ...
• 1,493

### What are the disadvantages of not handling big numbers?

Almost none Most major programming languages, like C#, Java and as you mentioned, JavaScript, don't support arbitrary large integers in their default namespaces/packages/... However, for all of those ...
• 1,493

### What are the pros and cons of fixed-point arithmetics vs floating-point arithmetics?

Fixed point arithmetic is more consistent Adding 0.128 to a number will always add 0.128 to the number until you reach the limit. In floating point arithmetic the steps get more inconsistent the ...
• 8,219

### What are the pros and cons of fixed-point arithmetics vs floating-point arithmetics?

Firstly, consider fixed-point decimal arithmetic vs. fixed of floating point binary: the former is suitable for precise representation of monetary values, while the latter shall never be used for such....
• 1,310

### How could fixed-point be implemented?

Fixed-point is an integer with a statically-known decimal (or more generally, statically-known divisor). You can represent a fixed-point datatype as an "representation" integer type and &...
• 3,779

### What are the drawbacks of allowing implicit boolean/integer conversions?

One particularly bad issue with int to bool conversions is that if you have an expression based language, the assignment x=7 will typically return ...
• 371

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

The problem with having only a single number type is: which number type do you pick? For a good example of what not to do, you have to look no further than the most widely-used (depending on ...

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

Advantages Rationals can exactly represent a much wider range of numbers. One-third would be finitely representable. Floating point errors would be unheard of. Disadvantages It is computationally ...
• 2,663