-1

Also with double (2 32bits Register), where 11 is for exponent, 1 for sign and 52 for significand, the maximum 2.0 * 10^308?

Le Nguyen
  • 105
  • 2
  • Have a look at how single precision floats are defined, e.g. here: https://en.wikipedia.org/wiki/Single-precision_floating-point_format (The maximum value should be approx 3.4028235*10^38) – chtz Jun 02 '22 at 10:02
  • MIPS uses IEEE-754: [Float and Int Both 4 Bytes? How Come?](https://stackoverflow.com/q/8746443/995714), [Why double.MaxValue is larger than long.MaxValue?](https://stackoverflow.com/q/2639941/995714), [Why do float and int have such different maximum values even though they're the same number of bits?](https://stackoverflow.com/q/11158476/995714), [Understanding the maximum values that can be stored in floats](https://stackoverflow.com/q/46718656/995714), [What is the difference between the float and integer data type when the size is the same?](https://stackoverflow.com/q/4806944/995714) – phuclv Jun 02 '22 at 12:35
  • Does this answer your question? [Float and Int Both 4 Bytes? How Come?](https://stackoverflow.com/questions/8746443/float-and-int-both-4-bytes-how-come) – phuclv Jun 02 '22 at 12:36
  • Technically, the "min value" is about -3.4*10^38, since no other representable number is less that this. – Erik Eidt Jun 02 '22 at 14:13
  • This is a standard floating point format, used broadly by the computing industry and supported by many processors: it is not specific to MIPS. You can find out for yourself what values a representable with an online IEEE calculator: https://babbage.cs.qc.cuny.edu/IEEE-754.old/32bit.html, enter 0x7F7FFFFF, for example, also 0x00000001. – Erik Eidt Jun 02 '22 at 14:14

1 Answers1

1

Using the IEEE-754 binary32 format, the maximum code in the exponent field for a finite number is 254, and this encodes an exponent value of 127. The maximum significand field value is all one bits (23 bits), and this encodes a significand of 2−2−23. With a zero in the sign bit (meaning positive), this encodes a value of +(2−2−23)•2127 = 2128−2104, which is a little over 3.4•1038 (not 2.0•1038).

The smallest positive number that can be represented has exponent code 0, which encodes an exponent value of −126 and also means the leading bit of the significand is zero. The smallest significand field value that gives a non-zero result with this exponent code has a one bit in its least-value position and zeros in all the other bits. This encodes a significand of 2−23, so the combined value represented is +(2−23)•2−126 = 2−149, which is a little more than 1.4•10−45 (not 2.0•10−38).

For IEEE-754 binary64, the maximum finite value is +(2−2−52)•21023 = 21024−2971, and the minimum positive value is +(2−52)•2−1022 = 2−1074.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312