Skip to content

fix: float string to number parsing#276

Merged
sagikazarmark merged 1 commit intomasterfrom
improve-string-float
Jun 2, 2025
Merged

fix: float string to number parsing#276
sagikazarmark merged 1 commit intomasterfrom
improve-string-float

Conversation

@sagikazarmark
Copy link
Collaborator

Fixes #274

Signed-off-by: Mark Sagi-Kazar <mark.sagikazar@gmail.com>
@sagikazarmark sagikazarmark merged commit 40e8e07 into master Jun 2, 2025
15 checks passed
@sagikazarmark sagikazarmark deleted the improve-string-float branch June 2, 2025 13:37
Copy link

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apparently forgot to press send ... 🤦‍♂️

Comment on lines +537 to +543
// handle special cases
switch s {
case "-", "+":
s += "0"
case "":
s = "0"
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should explain these cases here, as it's not obvious

Suggested change
// handle special cases
switch s {
case "-", "+":
s += "0"
case "":
s = "0"
}
// handle special cases
switch s {
case "-", "+": // like -.25 or +.25
s += "0"
case "": // like .25
s = "0"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

String to float regression

2 participants