-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Hi @stencillogic,
Is there a way to determine how close two BigFloats are to each other in terms of number of representable values, given a certain precision? I need it for an application in which I want to gradually increase precision and discover automatically whether or not it's time to increase precision as the algorithm zooms in further.
Some background: As a practice project to take some first steps in the Rust language, I'm building a small application that allows you to explore the Mandelbrot fractal. It allows the user to zoom in further and further into an area in the complex plane and I'm enlarging smaller and smaller parts of the fractal to render them on screen. Currently I'm using f64 to represent the complex coordinates, but that allows you to zoom in only so far. I would like to switch to BigFloat and to increase the precision automatically when necessary. I'm looking for a way to judge whether the current precision still suffices.
Is there a way to do something like this: n = representable_values_between(x, y, p) with n being an integer representing the number of floating point values that can be represented at precision p, that are larger or equal than x and smaller than y?
Let me know if the issue is clear. If not, I can explain further.