Skip to content

Stage2 can't negate a NaN at runtime #11853

Description

@Vexu

In the AIR negation is implemented as 0 - val which means that a NaN cannot be negated using the - operator. I'm not sure how desirable negative NaNs are but the behavior should be consistent at comptime and runtime.

test {
    std.debug.print("{d}\n", .{-math.nan(f32)}); // nan
    std.debug.print("{d}\n", .{-comptime math.nan(f32)}); // -nan
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backend-llvmThe LLVM backend outputs an LLVM IR Module.frontendTokenization, parsing, AstGen, Sema, and Liveness.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions