Open exoriente opened 4 months ago
Hi,
Thanks for raising the issue. There is no such or in some way similar function in the library. You may want to implement it yourself.
Thanks for your quick response. Do you plan on implementing a feature like next_up
and next_down
for BigFloat? See: https://doc.rust-lang.org/std/primitive.f64.html#method.next_up . That would give some hand holds to do it manually, like here: https://stackoverflow.com/questions/55049251/how-many-values-can-be-represented-in-a-given-range-by-a-float.
Good idea! Created a new issue for it: #30 Thanks.
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)
withn
being an integer representing the number of floating point values that can be represented at precisionp
, that are larger or equal thanx
and smaller thany
?Let me know if the issue is clear. If not, I can explain further.