TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Google Calculator Inaccuracies?

1 点作者 matttah超过 12 年前

2 条评论

matttah超过 12 年前
I noticed this today while doing checking some totals for a project. It seems there is definitely something not right. I haven't seen this before.<p>What is also interesting is if you enter the same numbers manually into the on-screen calculator it will give you a different answer of: 7 vs 6.99999999997<p>However if you update it and search for <a href="https://www.google.com/search?q=259680.68+-+37.98+-+259635" rel="nofollow">https://www.google.com/search?q=259680.68+-+37.98+-+259635</a><p>and then enter the same numbers you get 7.70000000001 vs 7.69999999998<p>Any ideas on what is happening?
shenberg超过 12 年前
decimal fractions can't necessarily be represented by a finite amount of bits (just like the fraction 1/3 is 0.333333...). Computers work with finite amounts of bits, so you're losing some accuracy. Other representation methods could be used to store the numbers (e.g. store the nominator and denominator as whole numbers), but you can't get around the fact that an infinite amount of numbers can't be represented with a finite amount of bits (e.g. the square root of two can't be represented accurately as a ratio).