---
title: "zero-integer-division"
description: "Detect literal integer division that truncates to zero."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# zero-integer-division

**Default severity:** `error`

Dividing two integer literals uses integer arithmetic. A fraction such as
`2 / 3` therefore truncates to zero, even when it is later converted or assigned
to a floating-point value.

Named constants are accepted to avoid warning on deliberate integer formulas.

## Bad

```go
ratio := 2 / 3
```

## Good

```go
ratio := 2.0 / 3.0
```

Source: https://strider.gempir.com/lints/zero-integer-division/index.mdx
