I come from a country where the way we write decimal numbers differs from the other place by whether I use ',' or '.' for decimal separator. Now this is why I by accident wrote somewhere in my c++ program:
while(true){
long double x=0;
//some code that increases the value of x
//by very small amount but it doesn't leave it at 0
if(x>0,000001)break;
}
And this made the program run indefinitely. After wasting quite some time thinking my code was wrong I tried this:
while(true){
long double x=0;
//some code that increases the value of x
//by very small amount but it doesn't leave it at 0
if(x>0.000001)break;
}
Which worked just fine. Later I understood my mistake (I used ',' instead of '.'), but now I am confused as to why doesn't the next code result with compilation error, and how come it's outcome is "greater"
long double g=0.001;
if(g>0,01)cout<<"greater";
else cout<<"smaller";
Edit: When I posted this question I didn't know that the comma is an operator. So the question was marked as duplicate and lead here How does the Comma Operator work . But there I couldn't actually find a comparison between '.' and ',' .