New GitHub issue #101113 from iuriguilherme:<br>
<hr>
<pre>
I made a turtle draw a spiral while rescaling the screen according to the last position of the turtle.
Simple code to reproduce (increasing the speed variable will make it crash sooner):
```python
"""Crash a Turtle with negative infinity canvas scale"""
import turtle
speed = 3
angle = 0
radius = 1
boundaries = {'llx': -1.0, 'lly': -1.0, 'urx': 1.0, 'ury': 1.0}
pen = turtle.Turtle()
pen.speed(10)
pen.getscreen().tracer(1e3)
while True:
print(f"radius {radius}, angle {angle}")
print(f"screen xscale {pen.getscreen().xscale}")
print(f"screen yscale {pen.getscreen().yscale}")
pen.circle(radius, angle)
radius *= speed
angle += 1
pos = pen.pos()
boundaries['llx'] = min(boundaries['llx'], pos[0])
boundaries['lly'] = min(boundaries['lly'], pos[1])
boundaries['urx'] = max(boundaries['urx'], pos[0])
boundaries['ury'] = max(boundaries['ury'], pos[1])
pen.getscreen().setworldcoordinates(**boundaries)
```
This will raise `_tkinter.TclError: expected floating-point number but got "floating"` when x or y scale gets near 1e-306.
But in the code I'm using with a RawTurtle and a TurtleScreen I get `ZeroDivisionError` because somewhere after 6.7e-307 (in my machine) both TurtleScreen's x and y scales becomes 0.0, RawTurtle's position becomes (-inf, -inf) and then this line of code is reached: https://github.com/python/cpython/blob/3ef9f6b508a8524f385cdc9fdd4b4afca0eac59b/Lib/turtle.py#L1105
I had to set this in my code to prevent screen becoming blank (because of scale becoming 0.0), so I could stop drawing before it crashes:
```python
precision: int = 1e-306
while True:
logger.debug(f"""
boundaries = {boundaries}
screen.xscale = {screen.xscale}
screen.yscale = {screen.yscale}
""")
try:
1 / screen.xscale
1 / screen.yscale
except ZeroDivisionError:
logger.warning(f"reached infinity")
break
if precision != min(precision, screen.xscale, screen.yscale):
logger.warning(f"reached floating point precision limit")
break
screen.setworldcoordinates(**boundaries)
## Make screen still without going blank
root.mainloop()
```
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/101113">View on GitHub</a>
<p>Labels: </p>
<p>Assignee: </p>