1 Star 0 Fork 0

小甄加速内卷 / go-parent

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
demo9_DataTypeConversion.go 329 Bytes
一键复制 编辑 原始数据 按行查看 历史
小甄加速内卷 提交于 2023-05-08 17:47 . go demo
package main
import "fmt"
// 数据类型转换
func main() {
a := 5.0 // float
b := int(a) // 转int
fmt.Printf("%T,%f\n", a, a)
fmt.Printf("%T,%d\n", b, b)
c := 63.98988888888888888888888888888
d := float32(c)
fmt.Printf("%T,%f\n", d, d) // 精度丢失
e := bool(a)
fmt.Printf("%T\n", e) // 精度丢失
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhenzicheng/go-parent.git
git@gitee.com:zhenzicheng/go-parent.git
zhenzicheng
go-parent
go-parent
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891