I am trying to find a way to slice an arbitrary index of an irrational number, eg. getting a slice of 5 digits of the Euler's number starting at the decimal index 100. This is not a practical task, just a thing I was wondering about.
I was trying to find an answer here
and sliced my number after converting my float into string:
z=str(format(math.e, '.105f'))[-6:-1]
It does work with floats with smaller precision (till around .50f), but with bigger it returns zeros. I was wondering how could I possibly represent and slice long floats.
Python has a package bigfloat for this very high precision arithmetics.
1.4m articles
1.4m replys
5 comments
56.9k users