• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Programming Expert

Solving All of Your Programming Headaches

  • HTML
  • JavaScript
  • jQuery
  • PHP
  • Python
  • SAS
  • VBA
  • About
You are here: Home / Python / Python max float – What’s the Maximum Float Value in Python?

Python max float – What’s the Maximum Float Value in Python?

February 4, 2022 Leave a Comment

The maximum float value in Python is 1.7976931348623157e+308. To find the max float in Pythoon, we can use the sys module and access the float_info property.

import sys

print(sys.float_info)

#Output:
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

When working with numbers in any programming language, knowing the min and max values can be useful so you don’t raise any errors in your code.

For floating point numbers in Python, the maximum value can be found through the sys module.

We access the float_info property from the sys module and can see the maximum floating point value for Python.

import sys

print(sys.float_info)

#Output:
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

As shown above, the max float value possible in Python is 1.7976931348623157e+308.

The Minimum Float Value in Python

From the float_info property of the sys module, we can also get the minimum float value in Python. As we can see in the code output from above, the minimum float value in Python is 2.2250738585072014e-308.

Hopefully this article has been useful for you to find the maximum float value in Python.

Other Articles You'll Also Like:

  • 1.  Generate Random Float Between 0 and 1 Using Python
  • 2.  Set Widths of Columns in Word Document Table with python-docx
  • 3.  Using Python to Sum Odd Numbers in List
  • 4.  Using if in Python Lambda Expression
  • 5.  How to Check if a String Contains Vowels in Python
  • 6.  Using Python to Remove Last Character from String
  • 7.  Check if Number is Between Two Numbers Using Python
  • 8.  Python isprime – Function for Determining if Number is Prime
  • 9.  pandas percentile – Calculate Percentiles of Series or Columns in DataFrame
  • 10.  Using Python to Get Home Directory

About The Programming Expert

The Programming Expert is a compilation of a programmer’s findings in the world of software development, website creation, and automation of processes.

Programming allows us to create amazing applications which make our work more efficient, repeatable and accurate.

At the end of the day, we want to be able to just push a button and let the code do it’s magic.

You can read more about us on our about page.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

About The Programming Expert

the programming expert main image

The Programming Expert is a compilation of hundreds of code snippets to help you find solutions to your problems in Python, JavaScript, PHP, HTML, SAS, and more.

Search

Learn Coding from Experts on Udemy

Looking to boost your skills and learn how to become a programming expert?

Check out the links below to view Udemy courses for learning to program in the following languages:

Copyright © 2022 · The Programming Expert · About · Privacy Policy