Visual c++ 为什么C++;是不准确的,失去了精确性?

Visual c++ 为什么C++;是不准确的,失去了精确性?,visual-c++,double,precision,Visual C++,Double,Precision,我使用的是VS 2015,cpprestsdk版本是2.10.16,我试图用cpprestsdk发送Json数组,当我试图将字符串解析为Json时出现问题,它们失去了精度 wstring postclinicdetailjsonwstr; charstarconvertwstr(post_clinic_detail, postclinicdetailjsonwstr);//convert std::string to wstring utility::stringstream_

我使用的是VS 2015,cpprestsdk版本是2.10.16,我试图用cpprestsdk发送Json数组,当我试图将字符串解析为Json时出现问题,它们失去了精度

   wstring postclinicdetailjsonwstr;
   charstarconvertwstr(post_clinic_detail, postclinicdetailjsonwstr);//convert std::string to wstring
   utility::stringstream_t s;
   s << postclinicdetailjsonwstr;
   web::json::value diseinfoarr = json::value::parse(s);
   dataitem[L"feedetail"] = json::value(diseinfoarr);
   wstring jsonwstrtosend=dataitem.serialize();
后来我尝试将这个json值添加到antoher json中,并尝试序列化它,猜猜看,它失去了精度

   wstring postclinicdetailjsonwstr;
   charstarconvertwstr(post_clinic_detail, postclinicdetailjsonwstr);//convert std::string to wstring
   utility::stringstream_t s;
   s << postclinicdetailjsonwstr;
   web::json::value diseinfoarr = json::value::parse(s);
   dataitem[L"feedetail"] = json::value(diseinfoarr);
   wstring jsonwstrtosend=dataitem.serialize();
jsonwstrtosend的内容是


您知道如何处理此类问题吗?

21.38
在IEEE-754浮点格式中没有精确的表示形式。存储在变量中的是最接近的可表示值,即。如果您需要将最初读取的精确值进行往返,请使用字符串而不是浮点。@dxiv ok,ty