Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

1.0/0 and 0.0/0 are both defined, but are reported as an error by rcc #442

@jyn514

Description

@jyn514

Expected behavior

1.0 / 0 should be +INF, 0.0 / 0 should be NaN.

Code

<stdin>:1:11 error: invalid program: cannot divide by zero
float f = 1.0 / 0;
          ^^^^^^^
<stdin>:1:11 error: invalid program: cannot divide by zero
float f = 0.0 / 0;
          ^^^^^^^

Annex F: floating point arithmetic (http://port70.net/~nsz/c/c11/n1570.html#F)

1 The C floating types match the IEC 60559 formats as follows:
- The float type matches the IEC 60559 single format.
- The double type matches the IEC 60559 double format.
- The long double type matches an IEC 60559 extended format,357) else a non-IEC 60559 extended format, else the IEC 60559 double format.

We should also define __STDC_IEC_559__, as per 6.10.8.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions