Skip to content

Int.Parse("3.00") throws an error #48604

@pgovind

Description

@pgovind

I introduced this inadvertently in #47666.

47666 also broke round-tripping of decimal->string.

The bug occurs because of this line:

number.DigitsCount = digEnd - numberOfTrailingZeros;
digEnd is 1 and numberOfTrailingZeros = 2, so we end up with -1. The correct value here should be number.DigitsCount = 1. I'll consider a careful fix for this locally and put a PR up.

Currently, this bug only affects Int.Parse calls with an input that has trailing zeros => 1.0, 1.00, 1.000, 1.0000 etc are broken

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions