In [1]:

```
a = 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
print(a)
```

Numbers that are potentially not whole (3.14, 5.0, 4.0, 10000.5) there is a number fixed of digits that can be in a `float`

Floats are stored in scientific notation:

$$a\times2^b$$.

For example, $1.2345\times10^7$ is a number writter in scientific notation.

$a$ is called the mantissa, and $b$ is called the exponent. The number of digits that the mantissa and the exponent contain are limited (the equivalent of about 3 digits for the exponent and 17 digits for the mantissa. This limits the precision with which floating-point numbers can be stored and the magnitude of the numbers.

Because the exponent can have only a limited number of digits, a float cannot be arbitrarily large (or arbitrarily close to 0).

Because the matissa can only have a limited number of digits, a `float`

cannot be arbitrarily precise (i.e., basically, it cannot have arbitrarily #many digits after the decimal points).

Here is an example: we cannot store $10^350$ as a `float`

(Python considers the power of 10.0 to always be a `float`

)

In [2]:

```
10.0**350
```

We can store it as an `int`

In [3]:

```
10**350
```

Out[3]:

We can convert between different types of values. For example, the value of `str(3.14)`

is `"3.14"`

(`3.14`

is a `float`

, but `"3.14"`

is a `str`

). The value of `float("3.14")`

is `3.14`

(a `float`

). Here are some examples.

In [4]:

```
"42" + str(42)
```

Out[4]:

In [5]:

```
42 + int(42)
```

Out[5]:

In [6]:

```
'42' + 42
```

The last one didn't work, since we cannot add together a string and an integer.

We can convert between `int`

s and `float`

s:

In [7]:

```
int(3.14)
```

Out[7]:

In [8]:

```
int(4.85)
```

Out[8]:

In [9]:

```
int(-3.7)
```

Out[9]:

In [10]:

```
x = 3.7
int(x + 0.5)
```

Out[10]:

In [11]:

```
x = 3.2
int(x + 0.5)
```

Out[11]:

`round`

:

In [12]:

```
round(3.7)
```

Out[12]:

In [13]:

```
round(-3.2)
```

Out[13]:

Finally, you can convert from strings to `float`

s like this:

In [14]:

```
float("3.14")
```

Out[14]:

This would not work, since 3.14 is not an whole number:

In [15]:

```
int("3.14")
```

However, this works fine:

In [16]:

```
int(float("3.14"))
```

Out[16]:

`float("3.14")`

has the value `3.14`

, which in turn can be converted to `int`

.