Python Floating-Point Numbers - Scientific Notation - Overflow Error - Programming Examples

Veröffentlicht am: 27 August 2021
auf dem Kanal: Appficial
3,439
27

A floating-point number is a number with a decimal. Ex: 3.14, or -123.5. float is a data type for floating-point numbers.

A floating-point literal is the number being used in your python code. Ex: weight = 145.2

Use scientific notation for huge numbers such as 1.87x1045. Ex: 1.87e45. The e stands for exponent.

The value range for floating-point numbers is from 2.3x10-308 to 1.8x10308. range. Assigning a variable outside this range causes an OverflowError. Overflow happens when a value is too large to be stored in the memory allocated by the interpreter.

When printing floating-point numbers, use f string formatting to specify the number of decimals to print out.
Ex: print(f’{math.pi:.3f}')

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!


Auf dieser Seite können Sie das Online-Video Python Floating-Point Numbers - Scientific Notation - Overflow Error - Programming Examples mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Appficial 27 August 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 3,439 Mal angesehen und es wurde von 27 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!