c++ - Retrieve the string “0.1” from after assignment to a double variable -


i have naive question high-precision number conversion (in c++ here).

suppose user assigns 0.1 double variable x_d statement,

x_d = 0.1 

it known x_d obtained no more 0.1, due inevitable machine rounding.

i wonder whether still have way original highly precise string “0.1”, double variable x_d? clearly, useless use std::to_string (x_d) here. high precision library boost::multiprecision or mpfr seem helpless. example, std::to_string(boost:cpp_dec_float_10000(x_d) ) cannot recover lost precision.

so question is, can retrieve string “0.1” double x_d assigned using statement x_d = 0.1?

let's assume during assignment, decimal number 0.1 rounded double value x not equal decimal number 0.1. now, assume other computation results in valuex, without being rounded. in order distinguish two, have store origin somewhere. that, there no place in double (assuming common implementations), answer question "no".


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -