double ld = 0.299999999999999990009;
It turns out truncated to 0.29999999999999999
0.29999999999999999
How to get more precision from float type?
Is there a class that wraps more meaning?
The Gnu MP library obviously has support for arbitrary dimensional floating-point arithmetic. I would recommend trying it, as GMP is one of the fastest general-purpose arithmetic libraries of any size. It is very stable, has complex C interfaces, as well as C ++ wrappers and binaries compiled for many compilers.
GNU MPFR GMP , .
long double, MSVS, , double ( ).
long double
double
, . HPA.
, . , GMP ( LGPL)
double (1×10^−37 → 1×10^37),
1×10^−37 → 1×10^37
I think it is truncated because you did not set the precision of std :: cout
#include <iomanip> float yourfloat; cout << fixed << setprecision(lengthoftheprecision) << yourfloat;
Source: https://habr.com/ru/post/1792642/More articles:Regex replace [something] KeepThisPart - phpSorry, we are unable to access the page you requested:https://fooobar.com/questions/1792638/mvc-3-rtm-allowhtml-doesnt-work-when-using-formcollectionWhere can I find the msi parser - parsingSSIS 2008 R2 - dynamically changing connections at runtime - sql-serverhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1792641/best-practices-to-apply-in-domain-driven-design-principles&usg=ALkJrhjYgEJiihLE3LkJB25BDpy6I7tX4AGWT RequestFactory: interface inheritance in RequestContext - gwtGroovy XmlSlurper and insert child nodes - xmlAsp.net application requests stuck in SendResponse state - asp.net80386 real mode simulator - assemblyHide main C # form at startup - c #All Articles
https://fooobar.com/questions/1792638/mvc-3-rtm-allowhtml-doesnt-work-when-using-formcollection