---
title: "U2032: A float literal other than zero, or a float range, as a pattern"
url: https://una-lang.org/en/docs/errors/U2032/
release: v0.4.0
source: https://github.com/una-lang/una/blob/v0.4.0/crates/una-explain/explain/U2032.md
---

# U2032: A float literal other than zero, or a float range, as a pattern

A `when` arm or an `is` test does not match an `F64` against a float literal (`spec/29`, ADR 0114). A computed float rarely equals a literal exactly, and the test hides which equality is meant: the identity of `==`, under which `-0.0` and `0.0` differ, or IEEE equality. Compare in an `if`, with `==` for identity or an IEEE method such as `x.ieee_eq(other: 0.5)`.

## The repair at a glance

`src/demo.una`

```diff
  module demo

- pub is_half(x: F64) -> Bool = x is 0.5
+ pub is_half(x: F64) -> Bool = x == 0.5
```

## Failing example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"
```

`src/demo.una`

```una
module demo

pub is_half(x: F64) -> Bool = x is 0.5
```

## Fixed example

`una.toml`

```toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.3"
```

`src/demo.una`

```una
module demo

pub is_half(x: F64) -> Bool = x == 0.5
```
