# fix large f128 values being incorrectly parsed as inf · gitcafe/zig

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

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

Visibility: public

Requested revision: ff3bf983459c5c58ec0374f6f52627902f13e721

Requested commit: ff3bf983459c5c58ec0374f6f52627902f13e721

Commit: ff3bf983459c5c58ec0374f6f52627902f13e721

Tree: 3bd084aa161643c696dc0441b0b7e04bec836459

Author: Marc Tiehuis

Committer: Andrew Kelley

## Message

```
fix large f128 values being incorrectly parsed as inf

Found while fuzzing. Previously 1.1897314953572317650857593266280070162E4932
was parsed as +inf, which caused issues for round-trip serialization of
floats. Only f128 had issues, but have added other tests for all
floating point large normals.

The max_exponent for f128 was wrong, it is subtly different in the
decimal code-path as it is based on where the decimal digit should go.
This needs to be 2 greater than the max exponent (e.g. 308 or 4932) to
work correctly (greater by 1, then we use a >= comparision).

In addition, I've removed the redundant `optimize` constant which was only
use for testing the slow path locally.

```

## Parents

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

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