CodePudding user response:
# include
# include
# include
using namespace std;
Int main ()
{
Double t=0.00000001;
Cout & lt; <(fabs (t) & lt; 1 e - 6) & lt;Cout & lt; <(t & lt; 0.0) & lt; return 0;
}
Please refer to,
CodePudding user response:
Thanks, the double is not directly write a variable==0, whyCodePudding user response:
Storage form of floating point Numbers, determines its no absolute zero, all want to use a tiny tend to zero value is 0CodePudding user response:
What is the storage form?CodePudding user response:
Float is 32-bit, valid number is 6 ~ 7, for float type can fabs is less than 1 e - 6Double is 64, the valid number is 12 ~ 13, for type double can fabs is less than 1 e - 12
Floating point comparisons, you can see my earlier blog https://blog.csdn.net/happy__888/article/details/280627
CodePudding user response: