Breaking Math With Python - MAX Function

Veröffentlicht am: 08 Mai 2024
auf dem Kanal: The Code City
98
1

When using python max function, try doing max(-0.0, 0.0).
What do you think the results will be?

Most computers, including those running Python, adhere to the IEEE 754 standard for representing floating-point numbers (numbers with decimals). This standard defines how numbers are stored in memory using bits.
The standard includes both positive zero (+0.0) and negative zero (-0.0). They have the same numerical value (zero), but differ in their sign bit.

☕Buy me a coffee: https://www.buymeacoffee.com/thecodecity
🌐Connect with me:
TikTok: tiktok.com/@thecodecity
Twitter:   / thecodecity  
Instagram:   / thecodecity  
Website: https://thecodecity.com

According to python max function, if both values are the same, the max function returns the first value as the max, hence max(-0.0,0.0) returns -1 in python.

#python #pythonmath #pythontricks


Auf dieser Seite können Sie das Online-Video Breaking Math With Python - MAX Function mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer The Code City 08 Mai 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 98 Mal angesehen und es wurde von 1 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!