# Sema: comptime float negation supports negative zero · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/b33c8b0b06dd6a24d89efb278eeb833db93b2f9b)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: b33c8b0b06dd6a24d89efb278eeb833db93b2f9b

Requested commit: b33c8b0b06dd6a24d89efb278eeb833db93b2f9b

Commit: b33c8b0b06dd6a24d89efb278eeb833db93b2f9b

Tree: 6b5c91beeae7563c581279f8d08d553e08c40d3f

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: comptime float negation supports negative zero

When handling the `negate` ZIR instruction, Zig now checks for a
comptime operand and handles it as a special case rather than lowering
it as `0 - x` so that the expression `-x` where `x` is a floating point
value known at compile-time, will get the negative zero bitwise
representation.

```

## Parents

- [f5edf78eea403c14635a05e1729672cfb50aca89](https://git.cafe/gitcafe/zig/commit/f5edf78eea403c14635a05e1729672cfb50aca89?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/b33c8b0b06dd6a24d89efb278eeb833db93b2f9b?format=markdown)
