mirror of
https://github.com/cc65/cc65.git
synced 2024-06-15 17:30:06 +00:00
Test to demonstrate availability of floating point constants, document the possibility.
This commit is contained in:
parent
7ff74b2c47
commit
e3887d7ead
|
@ -805,6 +805,9 @@ and the one defined by the ISO standard:
|
||||||
<itemize>
|
<itemize>
|
||||||
|
|
||||||
<item> The datatypes "float" and "double" are not available.
|
<item> The datatypes "float" and "double" are not available.
|
||||||
|
Floating point constants may be used, though they will have to be
|
||||||
|
converted and stored into integer values.
|
||||||
|
Floating point arithmetic expressions are not supported.
|
||||||
<p>
|
<p>
|
||||||
<item> C Functions may not return structs (or unions), and structs may not
|
<item> C Functions may not return structs (or unions), and structs may not
|
||||||
be passed as parameters by value. However, struct assignment *is*
|
be passed as parameters by value. However, struct assignment *is*
|
||||||
|
|
14
test/val/float-const-convert.c
Normal file
14
test/val/float-const-convert.c
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user