Test to demonstrate availability of floating point constants, document the possibility.

This commit is contained in:
bbbradsmith
2023-05-03 00:12:36 -04:00
parent 7ff74b2c47
commit e3887d7ead
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
/* Demonstrates that floating point constants are allowed in a limited way.
Value will be converted to an int, with a warning if precision is lost. */
int a = 3.0;
int b = 23.1;
int c = -5.0;
int main(void)
{
if (a != 3) return 1;
if (b != 23) return 2;
if (c != -5) return 3;
return 0;
}