Skip to content

Calling DoubleToStringConverter::ToShortest with the value 1.80113 generates the string 1.8011300000000001 #84

@troelstm

Description

@troelstm

The produced output 1.8011300000000001 is at least not what I would expect from ToShortest.

This code path doesn't generate a fallback to bignum calculations. I can't fully deduce from the comments whether this is intentionally.

But the net outcome is that this makes ToShortest a no go for our usage.

We have implemented an overlay of ToShortest that takes an additional max_digits input that we can use to solve the problem, but I'm wondering whether there is a better / more general solution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions