# manual-signum

Prefer signum over equivalent sign branching

Branching between `-1`, `0`, and `1` from integer comparisons manually computes a sign value.
Instead, you SHOULD call `.signum()` on the compared integer.

- Category: style
- Level: warning
- Fix: automatic
- Scope: module

## Reported

```ds title="main.ds"
function sign(value: int32): int32 {
    return value > 0 ? 1 : value < 0 ? -1 : 0;
}
```

## Accepted

```ds title="main.ds"
function sign(value: int32): int32 {
    return value.signum();
}
```

[language/linter/src/rules/style/manual_signum.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/manual_signum.rs#L8)
