Answer the question
In order to leave comments, you need to log in
Is it possible to artificially reduce the precision of real numbers in C++?
Is it possible to artificially reduce the precision of real numbers in C++? For example, so that representations of numbers, as well as all operations, occur with an accuracy of 3 significant digits. To illustrate numerical methods, rounding errors must be created, and they are usually very small. I want to do more than it was clearer and easier.
Answer the question
In order to leave comments, you need to log in
For 3 digits, you can multiply all data by 1000 and store in int64 and process it like this. and then divide by 1000
1. Number to text
2. We cut the tail to the very face
3. Text to number
There is half precision (16 bits), but there are even less.
https://www.johndcook.com/blog/2018/04/14/ieee-vs-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question