[問題] python 精準度問題

看板Python作者 (sb)時間9年前 (2015/02/11 14:31), 9年前編輯推噓2(202)
留言4則, 3人參與, 最新討論串1/1
因為需要高精度的運算 所以我查到了 decimal 這個物件 可是我照著用 卻沒有效果 不知是什麼問題 @@ http://ppt.cc/sqDa 可以看的到 紅色的部分就不一樣了 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 128.237.139.36 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1423636287.A.132.html

02/11 15:58, , 1F
你輸入的是float,改用string就好
02/11 15:58, 1F

02/11 17:53, , 2F
最近也遇到高精度運算問題~~decimal(str(...))
02/11 17:53, 2F

02/12 19:13, , 3F
x = decimal.Decimal('7.354823617778974389274981374')
02/12 19:13, 3F

02/12 19:13, , 4F
上面那樣的形式才對
02/12 19:13, 4F
謝謝 ※ 編輯: sb710031 (128.237.129.64), 02/13/2015 13:16:15
文章代碼(AID): #1KslS_4o (Python)