Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly does '3.4E +/- 38 (7 digits)' mean? [closed]

Tags:

c++

math

numbers

I'm trying to understand the range of data types. For non-floating point numbers it's easy enough, but then for float and double the ranges are listed as:

float: 3.4E +/- 38 (7 digits)

double: 1.7E +/- 308 (15 digits)

But in layman, what exactly does that mean, and how can I make use of that information?

like image 653
Tez Avatar asked Apr 16 '13 05:04

Tez


2 Answers

The

3.4E +/- 38

means that:

  • the largest positive value that a float can represent is about 3.4e38;
  • the smallest positive value is about 3.4e-38.

Similarly, the range of negative values is from -3.4e38 to about -3.4e-38.

Here, MeE denotes M multiplied by 10 to the E'th power.

The

(7 digits)

means that a float can represent approximately seven significant decimal digits.

The reason of these values are approximate is that they are exact in binary, and there's a fractional number of decimal digits for each binary digits.

like image 171
NPE Avatar answered Sep 21 '22 21:09

NPE


float: Range is from 3.4E-38 to 3.4E38 (positive or negative), with 7 significant digits of precision.

double: Range is from 1.7E-308 to 1.7E308 (positive or negative), with 15 significant digits of precision.

They also include 0.

mEe is computer notation for m times 10 to the e power.

like image 39
Barmar Avatar answered Sep 22 '22 21:09

Barmar