How many decimal places can double-Type Floating-point numbers be precise ?, Double POINT
Question 2:How many decimal places can double-Type Floating-point numbers be precise? Or is this question worth discussing?
Since double is a floating point, its decimal point positionIs floatingSo it is hard to say that the double type can be precise to the number of digits after the decimal point. Generally, this issue about precision is represented by the number of digits that can be expressed by the valid number (decimal. The 8-byte (64-bit) double that follows the IEEE Standard can represent the number of valid digits: 15 ~ 16
Test one:
#include <stdio.h>int main(){ printf("%.20lf",1.0/3.0);}
Result:
It can be seen that the number at the decimal point (valid number) is distorted, so it should be 16 digits.
Question 3:What are the maximum and minimum positive values of double Floating Point Numbers? (Not necessarily accurate)
This method is almost unknown:
#include <stdio.h>int main(){ double a = 0, b = 0; while(a<=b){ a = b; b++; } printf("%f",a);}
Question 4:Logical operator no. "&", "|", "! "What is the relative priority?
#include <stdio.h>int main(){ int a = 0, b = 1, c = 1; printf("%d",a&&b||c);}
The output value is 1, which is visible.
#include <stdio.h>int main(){ int a = 0, b = 0; printf("%d",!a&&b);}
The output is 0, visible!> &&
To sum up!> &> |
Note that the logical operators in C language are short-circuit operators. Once the value of the entire expression can be determined, the computation will not continue.
The number of decimal places that can be precise to a double floating point number.
6 digits
Float and double types are precise to decimal places
Single precision float 32 bit approx +-(E-38 ~ E38)
Double 64 bit approx +-(E-308 ~ E308)