Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(guide): Edited formatting #32583

Merged
merged 3 commits into from May 24, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,10 +1,13 @@
---
title: Python Floating Point Numbers
---
# Python Floating Point Numbers

Some general information about floating point numbers and how they work in Python, can be found <a href='https://docs.python.org/3/tutorial/floatingpoint.html' target='_blank' rel='nofollow'>here</a>.

Nearly all implementations of Python follow the IEEE 754 specification: Standard for Binary Floating-Point Arithmetic. More information found on the <a href='http://grouper.ieee.org/groups/754/' target='_blank' rel='nofollow'>IEEE site</a>.

## Float objects using floating point literals
Float objects can be created using using <a href='https://docs.python.org/3/reference/lexical_analysis.html#floating-point-literals' target='_blank' rel='nofollow'>floating point literals</a>:

>>> 3.14
Expand Down Expand Up @@ -47,6 +50,7 @@ Note that leading and trailing zero(s) are valid for floating point literals
>>> 001e0010 # Same as 1e10
10000000000.0

## Float objects using float constructors
The <a href='https://docs.python.org/3/library/functions.html#float' target='_blank' rel='nofollow'>`float` constructor</a> is another way to create `float` objects.

Creating `float` objects with floating point literals is preferred when possible:
Expand Down Expand Up @@ -105,4 +109,4 @@ The `float` constructor can also be used to make numeric representation of `NaN`
>>> float('infinity')
inf
>>> float('-infinity')
-inf
-inf