# D004 float_not_finite

URL: /docs/errors/D004
Markdown: /docs/errors/D004.md

> Float.round or a float-to-int conversion was given NaN or ±∞.

A runtime defect: the running program stops with it; no compile phase reports it, and `try` cannot catch it. `sakura explain D004` prints this explanation offline.

`Float.round` or a float-to-int conversion was given NaN or ±∞. Check the value before
converting it; NaN and infinities come from dividing by zero or from overflowing arithmetic on
`Float`.

Runtime defects come from running programs, so `compiler/tests/ui` has no fixture for them; the explanation above names the repair.
