r.mapcalc: computing using fixed number of decimal places #5365
Answered
by
marisn
dhdeangelis
asked this question in
Q&A
|
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? |
Answered by
marisn
Mar 13, 2025
Replies: 3 comments
|
Have you tried |
0 replies
|
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. |
0 replies
Answer selected by
dhdeangelis
|
Thank you @veroandreo and @marisn. I solved the problem as @marisn describes, that is emulating "fixed-point arithmetic". |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.