8

I realized the other day that most common lisp had 128-bit "long-floats". As a result, the most positive long float is:

8.8080652584198167656 * 10^646456992

while the most positive double float is 1.7976931348623157 * 10^308, which is pretty big already.

I wanted to know whether anyone had ever needed a number bigger than 1.7976931348623157 * 10^308, and if so, in which condition?

Do you feel it is useful to have by default in a programming language?

Is the precision of a 64-bit double float not enough in some circumstances? I would love to hear use-cases.

phuclv
  • 37,963
  • 15
  • 156
  • 475
Thaddee Tyl
  • 1,126
  • 1
  • 12
  • 17
  • 1
    It seems that your binary128 range is too large, see [Wikipedia](http://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format). Wikipedia claims a range to 0x7ffe_ffff_ffff_ffff_ffff_ffff_ffff_ffff≈1.189731495357231765085759326628007×10^4932 – Janus Troelsen Jul 30 '12 at 14:45
  • you can try entering that value here too: http://babbage.cs.qc.cuny.edu/IEEE-754/ – Janus Troelsen Jul 30 '12 at 14:48
  • @ThaddeeTyl I would need `128bit float` to code current x,y,zoom position for http://areallybigpage.com/ If only it was available on JS – Basj Jan 06 '15 at 18:02

2 Answers2

6

I guess the advantage of long floats is not only that they can span huge ranges, which may or may not be useful, they probably also have a much larger mantissa (I refuse to use the word "significand" for this) than a double, which gives your numbers a higher precision.

But as someone said, scientists love those types. Probably for the above reason. Note that the libraries are often called arbitrary precision libraries.

Rudy Velthuis
  • 28,387
  • 5
  • 46
  • 94
  • 1
    Why do you "refuse to use the word significand"? "Mantissa" is the fractional part of the base-10 logarithm. "Significand" is the preferred term in the IEEE-754 standard. – Stephen Canon Jul 26 '11 at 07:16
  • Significand literally means "which is to be signified", which simply sounds silly, IMO. And the term mantissa has been in use for this for ages already. No need to throw away a good term. – Rudy Velthuis Jul 26 '11 at 09:44
  • 1
    Mantissa is literally "an unimportant addition", which is no less silly (probably more). Mantissa used for nearly a century as the fractional part of the logarithm before floating-point was a gleam in Zuse's eye. The use of "mantissa" is admittedly widespread, but everyone who I would consider an authority in the field prefers the term "significand". – Stephen Canon Jul 26 '11 at 15:55
  • The etymology of mantissa is, IMO, unimportant. Fact is that someone decided to coin a new term, probably to improve on mantissa, but significand, a badly constructed neologism, was simply a bad choice. As long as they don't come with something better, I prefer the one that was in wide use before that. FWIW, I don't see the need to improve on mantissa. It was and is a good, well understood term. – Rudy Velthuis Jul 26 '11 at 17:02
  • 1
    "It was and is a good, well understood term" ... unless the reader has any familiarity with the original mathematical meaning of the term "mantissa", in which case it's a terrible, highly ambiguous term. "significand" has the virtue of being unambiguous. Disambiguation trumps style in a technical context. (Sorry to derail the actual question here, but I find people's love of "mantissa" fascinating). – Stephen Canon Jul 26 '11 at 17:17
  • Even those who have any familiarity with the original term, if they program and are familiar with floating point, they will know that the term means something different in that context. It is not uncommon for terms to have different meanings in different contexts. That doesn't take away that the construction "significand" is a terrible one. And that is why I won't use it. FWIW, this is totally irrelevant to the question, (IOW, it is off-topic, IMO) so let's agree to disagree. – Rudy Velthuis Jul 26 '11 at 17:30
  • FWIW, it is not love for "mantissa", it is simply abhorrence for the term "significand". – Rudy Velthuis Jul 26 '11 at 17:31
  • Good lord. What a pathetic argument. Use whichever word you are comfortable with, provided the person you're talking to understands what you mean. And if you understand what someone else is saying, don't tell them they're wrong to use a certain word. As long as the right meaning is conveyed, words can be absolutely anything you like. – Luke Mar 01 '13 at 11:32
  • @Luke: I use whichever word I'm comfortable with, indeed. I am not telling others what they should use, just why *I* don't use "significand". You may find that pathetic, but well, I don't really care. – Rudy Velthuis Mar 01 '13 at 19:56
3

Scientists use this kind of stuff - and occasionally arbitrarily sized integers/floats/decimals.

For you, 32-bit or 64-bit is usually enough.


See also:

http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic

Denis de Bernardy
  • 75,850
  • 13
  • 131
  • 154