0.1+0.2在不同语言中的表现
python
print(0.1+0.2);// output 0.30000000000000004
js
0.2+0.1;//output 0.30000000000000004
golang
package main
import (
"fmt"
)
func main() {
fmt.Println(0.1+0.2)//output 0.3
}
JAVA
public static void main(String[] args) {
System.out.println(0.1+0.2); //output 0.30000000000000004
}
PHP
echo 0.1+0.2;//output 0.3
有疑问加站长微信联系(非本文作者)