YOUR AD GOES HERE

Python math: fsum fixes 0.1, isqrt, gcd, trunc vs floor | CodeGurukul #205

Published 29, Oct 2026

CodeGurukul


Description:
Exact math beyond operators - verified on Python 3.10.12:
- math.isqrt(10)=3 exact int root; math.gcd(12,18)=6; math.lcm(4,6)=12
- math.factorial(5)=120; math.prod([2,3,4])=24
- math.ceil(2.1)=3, floor(2.9)=2; trunc(-2.9)=-2 toward zero, floor(-2.9)=-3
- math.fsum([0.1]*10)=1.0 exactly (sum gives 0.9999999999999999)
- pi/tau/e constants; nan never equals itself (use math.isnan); inf beats any finite
- math.dist((0,0),(3,4))=5.0 = math.hypot(3,4)

#Shorts #Python #CodeGurukul #math #Programming

Releted More Videos

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE