# std.fmt: Fix incorrect behavior with large floating point integers\. · gitcafe/zig

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

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

Visibility: public

Requested revision: b4bf3bdf7eac05c5e4ff887294385946f4dd5f3f

Requested commit: b4bf3bdf7eac05c5e4ff887294385946f4dd5f3f

Commit: b4bf3bdf7eac05c5e4ff887294385946f4dd5f3f

Tree: 714937345eadfd8ccb5332ae87179083260e4029

Author: Evan Haas

Committer: Andrew Kelley

## Message

```
std.fmt: Fix incorrect behavior with large floating point integers.

I consider this an interim workaround/hack until #1299 is finished.

There is a bug in the original C implementation of the errol3 (and errol4)
algorithm that can result in undefined behavior or an obviously incorrect
result (leading ':' in the output)

This change checks for those two problems and uses a slower fallback
path if they occur. I can't guarantee that this will always produce
the correct result, but since the workaround is only used if the original
algorithm is guaranteed to fail, it should never turn a previously-correct
result into an incorrect one.

Fixes #11283

```

## Parents

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

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