• 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
  • Ruby
  • 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.  Truncate String in Python with String Slicing
  • 2.  How to Get the Size of a List in Python Using len() Function
  • 3.  pandas percentile – Calculate Percentiles of Series or Columns in DataFrame
  • 4.  Find Median of List in Python
  • 5.  Using Python to Print Degree Symbol
  • 6.  Get Current Datetime in Python
  • 7.  Python tostring method – Convert an Object to String with str() Function
  • 8.  Changing Python Turtle Speed with speed() Function
  • 9.  Python Indicator Function – Apply Indicator Function to List of Numbers
  • 10.  Using Python to Check if String Contains Only Letters

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

Welcome to The Programming Expert. We are a group of US-based programming professionals who have helped companies build, maintain, and improve everything from simple websites to large-scale projects.

We built The Programming Expert to help you solve your programming problems with useful coding methods and functions in various programming languages.

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 © 2023 · The Programming Expert · About · Privacy Policy

x