TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

print(4 // 0.4) == 9.0

7 pointsby rococodealmost 6 years ago

3 comments

ksajalmost 6 years ago
In Lisp, this comes out to 10 with 0 remainder.<p><pre><code> &gt; (floor 4 0.4) 10 0.0 </code></pre> Doesn&#x27;t python return the remainder? It would be interesting to see what happened to give an answer of 9. If it is because of floating point (which is silly when dealing with such low numbers and producing such off-the-wall results) then maybe it is incorrectly getting 9.9999... for the division, and not returning the remaining .9999...
评论 #20768167 未加载
eesmithalmost 6 years ago
If it&#x27;s of any help, &quot;&#x2F;&#x2F;&quot; is &quot;floor division&quot;, not &quot;division&quot;.
Gibbon1almost 6 years ago
IEEE 754 found harmful.