I am wondering if there’s any limit value for the exponent.
Yes, read this: https://stackoverflow.com/questions/7644699/how-are-floating-point-numbers-stored-in-memory
The solution is simple. you are using float
(aka float32) data representation, use double
(float64) instead.