@Nyaa Limited memory is one reason, especially if you want large arrays of them.

Another reason is that working with floats is faster than working with doubles if the computer has no floating point hardware. (As recently as the 80386, many mainstream PCs hadn't. Some smaller computers still haven't.)

A more modern reason is that vector instructions (such as Intel's AVX) can work on twice as many floats at once as they can doubles.

@Nyaa BTW, these are not your only choices. IBM mainframes (still a thriving market) often use a proprietary format with greater precision (more mantissa bits) and less range (fewer exponent bits). The exponent is expressed in base 16 (not base 2, as with the IEEE-754 you're used to), so precision is surprisingly variable. NaNs are underdeveloped and there are no infinities. But, boy, is it fast!

Writing portable numerics is a challenge.

Sign in to participate in the conversation

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.