r.mapcalc: computing using fixed number of decimal places #5365
-
I need to perform computations and report results from r.mapcalc using a fixed number of decimal places. Is there any way of doing this using built-in functions? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Have you tried |
Beta Was this translation helpful? Give feedback.
-
No. r.mapcalc only supports integers, floats and doubles. One way out would be multiply all values by constant (e.g. 1000) and then cast to integers. Perform all calculations with integers and then go back to floats. |
Beta Was this translation helpful? Give feedback.
-
Thank you @veroandreo and @marisn. I solved the problem as @marisn describes, that is emulating "fixed-point arithmetic". |
Beta Was this translation helpful? Give feedback.
No. r.mapcalc only supports integers, floats and doubles. One way out would be multiply all values by constant (e.g. 1000) and then cast to integers. Perform all calculations with integers and then go back to floats.