# If min is a smallest number, why 1/min is not "infinity"?

Hi,
I am reading "Infinite Powers-Steven Strogatz" and I was able to explain to my 13 year old nephew how to understand infinity. Here is the explanation of Steven Strogatz:

And I wanted to quickly show that in Snap! For that I wrote a program: Snap! 6.9.2 Build Your Own Blocks
Snap program:

Quick output from snap:

To replicate the same thing, if my minimum number is min, and I am able to get "infinity" when I calculate 1/min, that would have served my purpose. But, I see the the approximate minimum(min) in Snap! as 1e-9, so 1/min can never be infinity.
Any thoughts are welcome?
Thanks a lot!
Nisar
PS: This is what python says:

Wouldn't you get ZeroDivisionError there? I don't understand how you're not getting an error. I just realized before is bigger than f, that's why.

Edit:

Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)] on win32
>>> f = 1.0
>>> while f:
before = f
f = f/10.0

>>> before
1e-323
>>> 1/before
inf
>>>


I got the same result as you. But:

>>> 1/0
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
1/0
ZeroDivisionError: division by zero
>>>


I did exactly what you did in Python but in Snap!, and I got , the same result as in Python. And:

But:

Please run the program in the link above and also look at the code...

Here's my code:

And my project: Here

Sorry. I checked it and it is not working as you said...

niscar's program worked fine for me. Could it depend upon the OS and/or browser? Unlikely since JavaScript is pretty standardized these days.

Probably OS. 32-bit, 64-bit etc. I'm on a 64-bit Windows 10, my browser is Chrome.

Another observation:you can see the variable value of "before" on the right but in the script page it is something else...

The "1e-323" is the correct one. Variable watchers round the result.

Thank you very much! I never knew about "variable watchers" rounding and also the other way around(double clicking) to get the value of the variable...

Double clicking? You only need to click once on the variable reporter.

My mistake...Thank you again!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.