Skip to content

fix: float string to number parsing - #276

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

sagikazarmark merged 1 commit into
masterfrom
improve-string-float

Conversation

@sagikazarmark

Copy link
Copy Markdown
Collaborator

Fixes #274

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

@ccoVeille ccoVeille left a comment

Copy link
Copy Markdown

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 thread number.go
Comment on lines +537 to +543
// handle special cases
switch s {
case "-", "+":
s += "0"
case "":
s = "0"
}

Copy link
Copy Markdown

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