简体   繁体   中英

From fixed point to floating point

As input to my algorithm I get integer values which are scaled by 10. So if I get 10 it is actually 1, if I get 1 it is actually 0.1. I need to convert it to fractional representation for calculations and then convert back for output. I guess if I convert numbers to double there is a risk to loose some accuracy during convertations. What is the right way to solve this problem.

十进制类型为10个基数的计算提供了更高的精度(比浮点数高),这就是我要使用的精度。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM