Go语言中的虚构文字(Imaginary Literals)最佳用途是什么?

huangapple go评论69阅读模式
英文:

What are the best uses for Go Imaginary Literals?

问题

如果下面的代码返回true,对我来说也没问题。
既然它没有返回,那么这个特性有什么最佳用途?我错过了什么吗?

a := 10.52i
b := 10i

fmt.Println(a == b)
//false
英文:

It would be fine for me if the code below returned true.
Since it has not, what are the best uses for this feature? What am I missing?

a := 10.52i
b := 10i

fmt.Println(a == b)
//false

答案1

得分: 3

根据@Tashi、@Arkku和@axiac的评论,我意识到我缺乏数学知识来理解这个功能。

英文:

Based on @Tashi, @Arkku and @axiac's comments, I realized that I am missing Math knowledge to understand this feature.

huangapple
  • 本文由 发表于 2017年1月19日 19:35:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/41740826.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定