1013 .1 + .2 is not equal to .3

ph
이동: 둘러보기, 검색

http://0.30000000000000004.com
여기보니까, Go는 답이 정말 희한하다.

아래를 실행시키면,

<shl lang=Go> package main import "fmt" func main() {

 fmt.Println(.1 + .2)
 var a float64 = .1
 var b float64 = .2
 fmt.Println(a + b)
 fmt.Printf("%.54f\n", .1 + .2)

}

</shl>

답이 \(0.299999999999999988897769753748434595763683319091796875\) 라고 한다.
뭐지도대체 이건.

이런것도 있다고. ㅎㅎ http://www.smbc-comics.com/?id=2999

blog comments powered by Disqus