Very small numbers

I am writing a Mandelbrot viewer. Everything works, except when you get to a very large magnification, the image begins to shade by about 10 Β° (- 14). I guess because I don't have enough memory in my double vars. What can I use, will it allow me to use very small numbers?

I need to use the java.lang.Math class, and I don't think it supports bigdecimal

+6
source share
5 answers

I don’t know anything about how you do this, but if you can do your calculations in the log space, you can deal with small numbers much better (since they become large negative numbers).

+1
source

If you really need arbitrary precision, your best bet is probably BigDecimal .

If you are concerned about efficiency, I suspect you would be better off trying to scale your values ​​and keep them in a neighborhood of 1.0.

+5
source
+2
source

You can use Java BigDecimal .

+1
source

Source: https://habr.com/ru/post/889656/


All Articles