Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strconv: issues in strconv package #23347

Closed
tgg-manish opened this issue Jan 5, 2018 · 4 comments
Closed

strconv: issues in strconv package #23347

tgg-manish opened this issue Jan 5, 2018 · 4 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@tgg-manish
Copy link

package main

import (
"fmt"
"strconv"

)

func main() {

Count := 5.5
fmt.Println(strconv.FormatFloat(Count , 'f', 0, 64))
}
//=====================================================

for Count calue 6.5, 7.5
and see the result

@mvdan
Copy link
Member

mvdan commented Jan 5, 2018

Please use the entire bug report template and provide a play.golang.org link.

@mvdan mvdan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 5, 2018
@ghost
Copy link

ghost commented Jan 5, 2018

I believe what @tgg-manish is reporting is that 5.5 rounds to 6, 6.5 rounds to 6, and 7.5 rounds to 8.

@tgg-manish
Copy link
Author

tgg-manish commented Jan 5, 2018 via email

@dominikh
Copy link
Member

dominikh commented Jan 5, 2018

This is working as intended and due to how IEEE 754 floating point numbers work. See #21714 for a related issue and http://floating-point-gui.de/ for an explanation.

@dominikh dominikh closed this as completed Jan 5, 2018
@mikioh mikioh changed the title issues in strconv package strconv: issues in strconv package Jan 7, 2018
@golang golang locked and limited conversation to collaborators Jan 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants