Ich habe gelernt, dass 0,1 + 0,2! = 0,3 aufgrund der 0,1 und 0,2 nicht genau 0,1 und 0,2 sind. "Richtig"? < /P>
float1 = 1.0/100.0
float2 = 0.1/10.0
print( float1 == float2 )
< /code>
gilt auch für c: < /p>
double slope1 = 1.0 / 100.0;
double slope2 = 0.1 / 10.0;
int main(int argc, const char * argv[]) {
printf( "%d", slope1 == slope2 );
}
< /code>
Was habe ich vermisst oder falsch verstanden? Bitte lehren Sie.
Warum 1,0/100.0 == 0.1/10.0 gilt? ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post