Skip to content

casting a floating-point number to an integer #64

Open
@rschumi0

Description

@rschumi0

There seems to be an issue when a cast is performed from a floating-point number that is larger than the maximum Integer to an Integer. In this case, the value should just be the largest Integer as documented in Section 5.1.3 of the JLS.
However, K-Java performs this cast in the same way as a long to int cast as illustrated by the following example.

System.out.println(((int)2147483648L));
System.out.println(((int)2147483648.0)); // should be 2147483647

The same issue also occurs for a cast to other data types when floating-point numbers are involved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions