浮點數計算

 二進制和十進制轉換過程中,產生的誤差範例:

  • 0.1 + 0.2 = 0.30000000000000004
  • 100 / 3     = 33.333333333333336
    1/3 * 100 = 33.33333333333333

相關參考資料:

Comments

Popular posts from this blog

JavaScript/ HTML/ CSS 工具資源

TCP/ IP 通訊協定

用 Math.random 隨機產生整數時,為什麼通常是用 Math.floor 而不是 Math.ceil