Printing numbers in python

Viewed 43685

I have a script that generates some numbers (specifically times in epoch form).

Everytime it generates a number, I append the number to an array (called VALUES) and print both the array and that number. However, the number does not contain as many places after the decimal as the number in the array.

For example, a sample output will look like this (after 3 iterations):

VALUES = [733948.45278935181, 733948.45280092594, 733948.45280092594]
Number = 733948.452801

The third number in the array corresponds to the value in Number.

How come they contain different number of positions after the decimal?

Off-topic: What are the numbers after the decimal called? I thought there was some mathematical term for them I just can't remember what it is.

Note: Code was in python.

4 Answers

The part of the number to the right of the decimal point (or more generally, the radix point) is called the fractional part of the number (as opposed to integer part). For the decimal system it can be called the decimal part. In binary I've seen that part of the number referred to as the fractional bits.

From time to time an author will use the term mantissa when referring to that part of a number, but I believe that usage is considered wrong by many, as mantissa -- in my experience -- is most often often used as a synonym to significand.

Related