Smallest And Largest Floating Point Values In Python

In my production code, I have a function that calculates a/(a+b). That function threw a ZeroDivisionError at me this afternoon, so I decided to change the equation to a/(a+b+sys.minfloat), because I felt that was more elegant than writing a conditional function to check if (a + b) == 0.

Turns out there is no 'minfloat' in the sys module, so I decided to write a function to calculate the smallest float myself.
>>> def minfloat(guess):
while(guess * 0.5 != 0):
guess = guess * 0.5
return guess

>>> minfloat(+1.0) # minimum positive value of a float
4.9406564584124654e-324

>>> minfloat(-1.0) # minimum negative value of a float
-4.9406564584124654e-324


But I couldn't stop there. Now I had to write a function to calculate the largest possible floating point value in Python, just for kicks:
>>> def maxfloat(guess = 1.0):
while(guess * 2 != guess):
guess = guess * 2
return guess

>>> maxfloat(+1.0) # maximum positive value of a float
inf

>>> maxfloat(-1.0) # maximum negative value of a float
-inf


This is interesting. Let's find out more about this "inf" value:
>>> inf

Traceback (most recent call last):
File "", line 1, in
inf
NameError: name 'inf' is not defined
>>> float("inf")
inf

>>> inf = maxfloat()

>>> inf + inf
inf

>>> inf - inf
nan

>>> 1 / inf
0.0

>>> 1/(-inf)
-0.0


Finally, check the relationship between minfloat and maxfloat:
>>> 1 / minfloat(1.0)
inf
>>> 1 / minfloat(-1.0)
-inf

296 comments :: Smallest And Largest Floating Point Values In Python

«Oldest   ‹Older   201 – 296 of 296   Newer›   Newest»
  1. רציתי רק לשאול, אפשר לשתף את הפוסט בבלוג שלי?
    מצלמות אבטחה לעסק

  2. Nigerian communication commission should conduct survey with the sims registration agents n Nigeria .

  3. מזל שנתקלתי בכתבה הזאת. בדיוק בזמן
    חברת ניהול מוניטין

  4. How To Start Blogging & Make Over $500 Every Month From It

    https://www.vhighnews.com/2020/01/how-to-start-blogging.html

  5. I really like this, I just found out about this. This was an incredibly wonderful article. Thanks for providing these details.
    Myself Hot and beautiful girl from Mumbai Escorts. I am cute hot and sexy girl looking for erotic fun anytime. I am available 24/7


  6. I have multiple reasons for your unlimited pleasure and satisfaction as We will your beautiful companion on your holiday. Escorts in Mahipalpur If you have any plan for watching recently released movie, We can be your girlfriend to watch movie together. Check our other services...
    Russian Escorts in Delhi
    Call Girls in Aerocity
    Escorts Service in Aerocity
    Female Escorts in Aerocity



  7. Passionate Bangalore escorts agency,Just want to enjoy and fun in their life.We provides our call girls services in different parts of India.you can get deals offers with our call girls,Sexy call girls romantic escorts service in Bangalore,To choose the our escort agency services in Bangalore,you do not need to give extra money to our escorts.ask to get the Russian call girls,VIP escorts service,foreign escorts girls,teenage models etc..,

    Call girls in Bangalore
    Independent call girls in Bangalore
    Independent Bangalore Escorts
    Female Escorts Bangalore
    Bangalore Escorts
    Call girls in Bangalore
    Independent call girls in Bangalore
    Independent Bangalore Escorts
    Female Escorts Bangalore
    Bangalore Escorts
    Bangalore Escorts
    Escorts Bangalore
    Escorts Service in Bangalore
    Escort girls in Bangalore

  8. Cheap Rates call Girl In Gurgaon, we offer the best escorts service in low rate with safety, we provide Female Call Girls with complete satisfaction. Girls Mobile Number In Gurgaon

  9. This is a nice blog. Good clean UI and nice informative blog. I Will Be Coming BackSoon, Thanks for posting Some Great ideas tree care

  10. My name is Mehak Chaudhary, I provide Escorts Services in Mumbai. I am an Independent Mumbai Escorts girl. My services are very well & regarding the personal need of my each customer. I am comfortable to provide my Mumbai Escorts Services at your home or in Hotel. Contact me 24x7 on +91 99156 22743.

  11. Cool

  12. See latest jobs opportunities at gngjobs


    from gngjobs.com.ng

  13. Hello Honey My self Juhi Basu I am Independent Kolkata Escorts girl now stay in Kolkata city of lake.I provide my service only in 5 star hotels only.
    Kolkata Escorts
    Escorts in Kolkata
    Kolkata Call Girls
    Call Girls in kolkata
    Vip Call Girls in Kolkata
    Independent Escorts in Kolkata
    Cheap Call Girls in Kolkata
    High Profile Call Girls in Kolkata
    Russian Escorts in Kolkata



  14. After this brings up its clients get entertained well with its premium services, the Russian Escorts in Mahipalpur is liable to increase the level of fun by its quality services dissimilar to get anywhere. So, let us forget everything and take pleasure in what you wait for a long time. Check our other Services...
    Call Girls in Chanakyapuri
    Escorts in Chanakyapuri
    Escorts Service in Chanakyapuri
    Female Escorts in Chanakyapuri
    Russian Escorts in Chanakyapuri

  15. כתיבה מעולה, אהבתי. אשתף עם העוקבים שלי.
    חברה לקידום אתרים בגוגל

  16. I am a totally wistful, capable, Independent Escort in Mumbai. I am an in the current style female free companion with provocative particularly adapted body, impeccable looks with long hot legs. I have sparkling blue eyes, rich dull hair with exquisite engaging smile and sensitive kissable lips.
    mumbai escorts
    indian big boobs

  17. On Nikita Bansal escorts you can search among hundreds of classified ads which offer beautiful Mumbaicall girls and throughout the rest of India. Do not lose time, browse Nikita Bansal escorts in one click find the most beautiful call girl close to you.

    mumbai escorts
    indian big boobs

  18. סופסוף מישהו שתואם לדעותיי בנושא. תודה.
    שטיח מחוטי טריקו

  19. Hello, Gentlemen! I am Anita from Mumbai. I am19 y. o. I provide the Best full service! I am a very sexy girl with a slim body and amazing curves! Once you contact me you will get the incredible intimate experience !!! I like 69, mutual oral, role-playing, different positions and more..more..more !!! I wish to see u soon my darling!
    Mumbai Escorts||
    Mumbai Escort Service||
    Mumbai Female Escorts||
    Mumbai Escorts Agency||
    Mumbai Call Girls||
    Mumbai Call Girl Number||
    Navi Mumbai Call Girls||

  20. We are project funder as well as financial lender. We have BG/SBLC specifically for BUY/LEASE at a leasing price of 4%+2% of face value Issuance by HSBC London and many other 25 top AA rated Bank in Europe, Middle East or USA. We also secure funding. Also We are into the provision of short term and long term business/personal loans for both small and large scale business funds.

    * FOR LEASING OF BG/SBLC
    MINIMUM FACE VALUE OF BG/SBLC = EUR/USD 1M
    LEASING FEE = 4%+2%

    * FOR PURCHASE OF FRESH CUT BG/SBLC
    PRICE = 32%+2%
    MINIMUM FACE VALUE OF BG/SBLC = EUR/USD 1M

    Kindly contact us for our procedures and be sure that we shall respond within 48hrs maximum.

    Intermediaries/Consultants/Brokers are welcome to bring their clients and are 100% protected. In complete confidence, we will work together for the benefits of all parties involved.
    Contact Name : Blaine Lorcan
    Contact Email: blainelorcan@gmail.com
    Skype:blainelorcan@gmail.com
    WhatsApp: +1(501)420-4128

  21. We are project funder as well as financial lender. We have BG/SBLC specifically for BUY/LEASE at a leasing price of 4%+2% of face value Issuance by HSBC London and many other 25 top AA rated Bank in Europe, Middle East or USA. We also secure funding. Also We are into the provision of short term and long term business/personal loans for both small and large scale business funds.

    * FOR LEASING OF BG/SBLC
    MINIMUM FACE VALUE OF BG/SBLC = EUR/USD 1M
    LEASING FEE = 4%+2%

    * FOR PURCHASE OF FRESH CUT BG/SBLC
    PRICE = 32%+2%
    MINIMUM FACE VALUE OF BG/SBLC = EUR/USD 1M

    Kindly contact us for our procedures and be sure that we shall respond within 48hrs maximum.

    Intermediaries/Consultants/Brokers are welcome to bring their clients and are 100% protected. In complete confidence, we will work together for the benefits of all parties involved.
    Contact Name : Blaine Lorcan
    Contact Email: blainelorcan@gmail.com
    Skype:blainelorcan@gmail.com
    WhatsApp: +1(501)420-4128

  22. Hey, There this is Isha, from Mumbai, I am 24 year old, I live life to the fullest. I enjoy nice dinner date, pubs and movies.

    Mumbai Escorts
    Escorts Mumbai


  23. הייתי חייבת לפרגן, תודה על השיתוף.
    חנויות למכירה


  24. The Mumbai escorts girls especially ours are such ladies who have the capability to refresh even your mind and soul.


    mumbai escorts

    mumbai escorts services

    mumbai escorts call girls

  25. We are providing hot and sexy girls in mumbai There are many people who want to live our life and when i want to make our life better. Thus people would love to make our life better. Its all about a simple moment in which we can laugh and get to know that there must be something for which we can live our life but that is possible with escorts Mumbai.

    Mumbai escorts
    call girl
    mumbai call girls
    hot college girls

  26. Hi, guys My self Liza Minz from Bangalore, Working in Bangalore escorts agency, I have 5 years experience, here my rule is independent call girls. I will do your sexual desire completely.
    Bangalore escorts

    Escorts Bangalore


    Bangalore escorts service


    Female Bangalore escorts


    Bangalore escorts agency

  27. I am Mihika Pal a Bangalore based girl who knows how to make his man happy and satisfied. I am 24 years old hot and sexy girl.
    Bangalore escorts
    Escorts Bangalore
    Female escorts Bangalore
    Bangalore escorts service
    Escorts service Bangalore

  28. I am nikitabansal The Mumbai escorts girls especially ours are such ladies who have the capability to refresh even your mind and soul.
    mumbai escorts
    mumbai escorts services
    mumbai escorts call girls

  29. I Am Ankita Basu. I Am An Independent Mumbai Escort Girl. I Deal In Mumbai Escorts Service. I Am Very Hot And Sexy. Being A Mumbai Escort Girl I Have Five Years’ Experience. That’s Why I Understand the Each Personal Needs of My Every Client. You Can Avail My VIP Mumbai Escorts Service At Your Home Or In Hotel.

    Mumbai Escorts
    Escorts Mumbai
    Female Escorts Mumbai
    Call Girls Mumbai
    Mumbai Call Girls

  30. Hi, guys My self Neha Mari from Bangalore, Working in Bangalore escorts agency, I have 5 years experience, here my rule is independent call girls. I will do your sexual desire completely.
    Bangalore escorts

    Escorts Bangalore


    Bangalore escorts service


    Female Bangalore escorts


    Bangalore escorts agency

  31. כל מילה. תודה על השיתוף, מחכה לעוד פוסטים בנושא.
    בית תוכנה

  32. Our agency is well known for providing high quality customer service ensuring 100% satisfaction every time. We have some of the best profiles of high-level escorts who are charming and are educated in the subtle art of seduction.



    Mumbai escorts
    Escorts Mumbai
    Female escorts Mumbai
    Mumbai escorts service
    Escorts service Mumbai

  33. Wow

  34. Your blog posts are more interesting and informative.
    global asset management korea

  35. My Name is Priya Rawat, an Independent escort in Kolkata. I am expertly a VIP model in Kolkata and give high class partner administrations to VIP people groups. I am an exceptional decision for those searching for an essential Indian escort Agency.
    Sexy Kolkata Escorts
    Kolkata Escorts
    Kolkata Escort service
    Elite Kolkata Escorts
    Escorts in Kolkata
    Independent Escorts in Kolkata
    Kolkata Independent Escorts
    Call Girls in Kolkata
    Kolkata Call Girls

  36. Thank you for sharing.
    global asset management seoul

  37. Elite Bangalore escorts agency,we have to arrange an escorts Bangalore trips. Dating dinner party girls escorts service in Bangalore to choose here.
    Bangalore Escorts
    Escorts Bangalore
    Female escorts Bangalore
    Bangalore call girls
    Bangalore Independent girls

  38. Welcome to Sohna Road Escorts Service. Sohna Road offers you online Kalinga for getting erotic call girls. Call fast at cheap and good rate Escort Service In Gurgaon With Mobile Number

  39. Sexy is a word which everyone cannot afford and we have the solution to get that very easily. We can assure you that our every Escorts Surat is as sexy as hell you can't resist Yourself by looking them twice. Enjoy with Independent girls in Surat any time any where
    Surat escort
    Escort Service Surat
    Call Girls in Surat
    Escort in Surat
    Surat Escort Service
    Escort Service in Surat
    Escort Service in Surat
    Independent Escort Service Surat
    Surat Russian Escorts

  40. great




  41. Each of the women associated with our agency is strictly professional when it comes to rendering her services to her clients.Escorts in Gurgaonhere at our escort agency make sure that their talents are such that they will never fall short of giving the best of services to their clients. Check our other Services...
    Escorts Service in Gurgaon
    Escorts Service in Gurgaon
    Female Escorts in Gurgaon
    Russian Call Girls in Gurgaon
    Russian Escorts in Gurgaon


  42. wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
    Best Data Science training in Mumbai

    Data Science training in Mumbai

  43. MTN mobile cheat is currently blazing

    You can check it here - How to Get 300gb free


  44. Female Bucharest Escorts, get hot and sexy call girls from our escorts agencies and feel exciting moments in a pleasant ambiance. For booking
    bucharest escorts

  45. Just some back links

    Https://9jaHob.Com
    Https://Netvilox.Com/Ref-2n56b-Sign-Up/

  46. https://9jahob.com/

  47. Deluxe Beauties Girls Mumbai escorts agency always ready for you at your doorstep. Beauty Queen provides you high profile independent girl in Mumbai top city.
    mumbai Escorts
    Escort smumbai
    Female escorts mumbai
    mumbai call girls
    Female Escorts Service

  48. תמשיכו בפרסום פוסטים מעניינים כמו זה. תודה.
    הדפסה על קנבס מחיר

  49. Thank you for sharing information.
    אינטרקום למשרד

  50. Hello my self Neha Mari from Bangalore Friends, How are you? Hope you all well. We are the professional Bangalore escorts service providers available 24×7 hours at cheap rates. Our escorts have top-rated models available for casual friendships, dating, and sexual services. We are here to provide you the rich class flavor of escort benefits at an affordable price. If you need a romantic date and want to spend your time with astonishing call girls in Bangalore then call us. Book your dream escort lady with Bangalore Escorts and feel wonderful pleasure in real life.


    Bangalore escorts

    escorts Bangalore

    Bangalore escorts service

    female Bangalore escorts

    Bangalore escorts agency

  51. The content that I normally see is nothing like what you have written. This is very well-thought out and well-planned. You are a unique thinker and bring up great individualized points. Please continue your work.
    SAP training in Kolkata
    SAP training Kolkata
    Best SAP training in Kolkata
    SAP course in Kolkata
    SAP training institute Kolkata

  52. Thanks for sharing with us.
    Garage door repair Pickering

  53. One of the requests that clients ask the women Incorporate the call girls in Goa acting like a girlfriend, kisses and hugs, referring to very simple things, including a film or a favourite book or favourite restaurant, and at times even more personal subjects.
    Goa Escorts
    Goa Escorts,
    Gurgaon Escorts
    Jaipur Escorts

  54. If you spend some time to obtain the best company, you may be called as a wise person and will surely be always in the benefit. Such stipulation is normally provided and lots of the excellent companies of escort service in Nainital provides you with an option to meet them before this day.
    Nainital Escorts
    Haldwani Escorts
    Ramnagar Escorts
    Rudrapur Escorts

  55. If you're staying in Udaipur or neighbouring places to get a business trip, then do not miss the joy of lovemaking with Udaipur escorts. Udaipur escorts offer you beautiful, sexy and curvy girls who will re-live your daily life.
    Udaipur Escorts
    Jodhpur Escorts
    Ahmedabad Escorts
    Hyderabad Escorts

  56. The ingenuity in Dating support is here too intriguing, so that every customer feels happy and joins with our services over and over. The purpose of providing dedicated support to customer is that our trained escorts Dehradun, means that when any escort not ready entirely for sexual support then our seasoned trained them and forwards too.
    Dehradun Escorts
    Mussoorie Escorts
    Haridwar Escorts
    Rishikesh Escorts
    Nainital escorts
    Rudrapur Escorts
    Ramnagar Escorts

  57. Pune escorts introduces the most lovable and erotic independent pune escorts services to provide you memorable intimacy with call girls in pune.
    Pune Escorts
    Escorts In Pune
    Pune Escort
    Escorts Service In Pune
    Escort Service Pune
    Escorts Service
    Escort Service
    Escort
    Escorts
    Female Escorts Service Pune

  58. You can book now high profile independent call girls in Bangalore, hot female escorts in Bangalore, and high profile models escorts in Bangalore for escort service in 3 star and 5 star hotels.

    https://nikithabangaloreescorts.com/

  59. You can spend your valuable time with the hot Bangalore call girls for sensitive desires and sensual satisfaction 100%. Bangalore escorts agency offering best escorts girl offerings in cheap priced.

    https://www.bedpari.com/bangalore-escorts.html
    https://www.divyagoal.com/
    https://www.payalsingh.com/bangalore-escorts-agency.php
    https://www.bangaloreescortsonline.com/
    Bangalore Escorts
    Bangalore escorts
    https://www.deepikarai.com/bangalore-escorts.php

  60. great.
    UFABET

  61. *Staying Safe Solution*

    Only for Ibadan Resident

    *SUPPORT THE FIGHT AGAINST COVID 19 SHOP FOR YOUR FOOD ITEMS ONLINE*

    With a call, message and click get all your household Agric Produce contactless and cashless

    Join any of our Products Pages

    https://www.facebook.com/daydoneng

    Join one of the link, visit https://www.daydone.com.ng or call 08174993336 to get your Agric Produce directly from the farm. Fast, Easy, Better and Time Saving

    With payment (transfer) on doorstep delivery also available, check for your household item on WhatsApp Catalogue and on the website above.
    JOIN, SHARE WITH OTHERS AND STAY SAFE

  62. *Staying Safe Solution*

    Only for Ibadan Resident

    *SUPPORT THE FIGHT AGAINST COVID 19 SHOP FOR YOUR FOOD ITEMS ONLINE*

    With a call, message and click get all your household Agric Produce contactless and cashless

    Join any of our Products Pages

    https://www.facebook.com/daydoneng

    Join one of the link, visit https://www.daydone.com.ng or call 08174993336 to get your Agric Produce directly from the farm. Fast, Easy, Better and Time Saving

    With payment (transfer) on doorstep delivery also available, check for your household item on WhatsApp Catalogue and on the website above.
    JOIN, SHARE WITH OTHERS AND STAY SAFE

  63. Welcome to famous escort agency in Hyderabad (HyderabadEscortsAgency.co.in). In this section you find independent escorts, escort agencies and strip clubs from Hyderabad. https://bit.ly/2MYDkNZ
    Hyderabad Escorts
    Escorts in Hyderabad
    Hyderabad Escorts Service
    Hyderabad Escorts Agency
    Escort Hyderabad
    Hyderabad Escort
    Hyderabad Call Girls
    Independent Hyderabad Escorts
    Escorts Service Hyderabad
    Sexy Hyderabad Escorts
    Hyderabad Escorts Girls
    Cheap Hyderabad Escorts

  64. Hello Guys, www.sejalkaur.com, offering high class Pune escorts service with Russian call girls in Pune at affordable rates. She is fun loving escorts in Pune.
    Pune Escorts
    Pune Call Girls
    Pune Call Girls Service
    Call Girls in Pune
    Vip Call Girls in Pune
    Independent VIP Escorts in Pune
    Cheap Call Girls in Pune
    High Profile Call Girls in Pune
    Russian Call Girls in Pune

  65. I am Nikitha From Bangalore Escorts Agency. I am a very hot and Sexy Independent Escort in J P Nagar Bangalore I am providing many types of escort Services such as Models, College girl, Housewives, Air Hostess etc. So if you want to have Real life fun with J P Nagar Bangalore Escorts then Call 7022789089 Meet the Nikitha J P Nagar Call Girls and full-fill your sexual Desire and passion.
    J P Nagar Escorts
    Bangalore Escorts
    Koramangala Escorts
    Teen Age Escorts in Bangalore
    Professional Escorts in Bangalore
    Adult Massage Service in Bangalore
    Payal Singh Bangalore Escorts
    Divyagoal Bangalore Escorts

  66. Thank you for sharing information.
    stratford management Japan

  67. You're so talented in writing. God is truly utilizing you in tremendous ways.


    Bastion Balance Seoul

  68. Enter your comment...Sir I want you to guide on online business and programming language

  69. Great blog you have here - market is very slow - Hopefully things will begin picking back up


    Stratford Management Japan

«Oldest ‹Older   201 – 296 of 296   Newer› Newest»

Post a Comment