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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

“A calculator app? Anyone could make that”

1821 点作者 pie_flavor3 个月前

80 条评论

rustybolt3 个月前
Nice story. An even more powerful way to express numbers is as a continued fraction (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Continued_fraction" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Continued_fraction</a>). You can express both real and rational numbers efficiently using a continued fraction representation.<p>As a fun fact, I have a not-that-old math textbook (from a famous number theorist) that says that it is most likely that algorithms for adding&#x2F;multiplying continued fractions do not exist. Then in 1972 Bill Gosper came along and proved that (in his own words) &quot;Continued fractions are not only perfectly amenable to arithmetic, they are amenable to perfect arithmetic.&quot;, see <a href="https:&#x2F;&#x2F;perl.plover.com&#x2F;yak&#x2F;cftalk&#x2F;INFO&#x2F;gosper.txt" rel="nofollow">https:&#x2F;&#x2F;perl.plover.com&#x2F;yak&#x2F;cftalk&#x2F;INFO&#x2F;gosper.txt</a>.<p>I have been working on a Python library called reals (<a href="https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;reals">https:&#x2F;&#x2F;github.com&#x2F;rubenvannieuwpoort&#x2F;reals</a>). The idea is that you should be able to use it as a drop-in replacement for the Decimal or Fraction type, and it should &quot;just work&quot; (it&#x27;s very much a work-in-progress, though). It works by using the techniques described by Bill Gosper to manipulate continued fractions. I ran into the problems described on this page, and a lot more. Fun times.
评论 #43068892 未加载
评论 #43070848 未加载
评论 #43080935 未加载
评论 #43069630 未加载
评论 #43074009 未加载
coder5433 个月前
The link at the end is both shortened (for tracking purposes?) <i>and</i> unclickable… so that’s unfortunate. Here is the real link to the paper, in a clickable format: <a href="https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3385412.3386037" rel="nofollow">https:&#x2F;&#x2F;dl.acm.org&#x2F;doi&#x2F;pdf&#x2F;10.1145&#x2F;3385412.3386037</a>
评论 #43072345 未加载
nagonago3 个月前
Unrelated to the article, but this reminds me of being an intrepid but naive 12-year-old trying to learn programming. I had already taught myself a bit using books, including following a tutorial to make a simple calculator complete with a GUI in C++. However I wasn&#x27;t sure how to improve further without help, so my mom found me an IT school.<p>The sales lady gave us a hard sell on their &quot;complete package&quot; which had basic C programming but also included a bunch of unnecessary topics like Microsoft Excel, etc. When I tried to ask if I could skip all that and just skip to more advanced programming topics, she was adamant that this wasn&#x27;t an option; she downplayed my achievements trying to say I basically knew nothing and needed to start from the beginning.<p>Most of all, I recall her saying something like &quot;So what, you made a calculator? That&#x27;s so simple, anybody could make that!&quot;<p>However in the end I was naive, she was good at sales, and I was desperate for knowledge, so we signed up. However sure enough the curriculum was mostly focused on learning basic Microsoft Office products, and the programming sections barely scraped the surface of computer science; in retrospect, I doubt there was anybody there qualified to teach it at all. The only real lesson I learned was not to trust salespeople.<p>Thank god it&#x27;s a lot easier for kids to just teach themselves programming these days online.
评论 #43074911 未加载
评论 #43077476 未加载
评论 #43078684 未加载
评论 #43079017 未加载
mynegation3 个月前
As soon as I read the title, I chuckled, because coming from the computational mathematics background I already knew what it roughly is going to be about. IEEE 754 is like democracy in a sense that it is the worst, except for all the others. Immediately when I saw the example I thought: it is either going to be either a Kahan summation or full-scale computer algebra system. It turned out to be some subset of the latter and I have to admit I have never heard of Recursive Real Arithmetic (I knew of Real Analysis though).<p>If anything that was a great insight about one of my early C++ heroes, and what they did in their professional life outside of the things they are known for. But most importantly it was a reminder how deep seemingly simple things can be.
评论 #43070154 未加载
评论 #43069573 未加载
评论 #43073805 未加载
评论 #43069661 未加载
kevinpacheco3 个月前
The NYC subway fare is $2.90. I was using PCalc on iOS to step through remaining MetroCard values per swipe and discovered that AC, 8.7, m+, 2.9, m-, m-, m- evaluates to -8.881784197E-16 instead of zero. This doesn&#x27;t happen when using Apple&#x27;s calculator. I wrote to the developer and he replied, &quot;Apple has now got their own private maths library which isn&#x27;t available to developers, which they&#x27;re using in their own calculator. What I need to do is replace the Apple libraries with something else - that&#x27;s on my list!&quot;
评论 #43071756 未加载
评论 #43071537 未加载
评论 #43082163 未加载
Shorel3 个月前
Almost no one has done that calculator app, properly. When I mean properly, I mean a complete calculator, like the TI-89.<p>I am using, in Android, and emulator for the TI-89 calculator.<p>Because no Android app has half the features, and works as well.
评论 #43067873 未加载
评论 #43067927 未加载
评论 #43069243 未加载
评论 #43068590 未加载
评论 #43069560 未加载
评论 #43067996 未加载
评论 #43068438 未加载
评论 #43068011 未加载
评论 #43073382 未加载
评论 #43070237 未加载
评论 #43075982 未加载
评论 #43068248 未加载
评论 #43067875 未加载
评论 #43073126 未加载
评论 #43067865 未加载
roenxi3 个月前
&gt; And almost all numbers cannot be expressed in IEEE floating points.<p>It is a bit stronger than that. Almost all numbers cannot be practically expressed and it may even be that the probability of a random number being theoretically indescribable is about 100%. Depending on what a number is.<p>&gt; Some problems can be avoided if you use bignums.<p>Or that. My momentary existential angst has been assuaged. Thanks bignums.
评论 #43067757 未加载
评论 #43067842 未加载
评论 #43068991 未加载
评论 #43080727 未加载
评论 #43071077 未加载
semolinapudding3 个月前
That&#x27;s pretty cool, but the downsides of switching to RRA are not only about user experience. When the result is 0.0000000..., the calculator cannot decide whether it&#x27;s fine to compute the inverse of that number.<p>For instance, 1&#x2F;(atan(1&#x2F;5)-atan(1&#x2F;239)-pi&#x2F;4) outputs &quot;Can&#x27;t calculate&quot;.<p>Well alright, this is a division by zero. But then you can try 1&#x2F;(atan(1&#x2F;5)-atan(1&#x2F;239)-pi&#x2F;4+10^(-100000)), and the output is still &quot;Can&#x27;t calculate&quot; even though it should really be 10^100000.
评论 #43072907 未加载
SloopJon3 个月前
I played around with the calculator source code from the Android Open Source Project after a previous submission[1]. I think Google moved it from AOSP to the Google Play Services several years ago, but the old source is still available.<p>It does solve some real problems that I&#x27;d love to have available in a library. The discussion on the previous article links to some libraries, but my recollection is that the calculator code is more accessible to an innumerate person like myself.<p>Edit: the previous article under discussion doesn&#x27;t seem to be available, but it&#x27;s on archive.org[2].<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24700705">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24700705</a><p>[2] <a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20250126130328&#x2F;https:&#x2F;&#x2F;blog.acolyer.org&#x2F;2020&#x2F;10&#x2F;02&#x2F;toward-an-api-for-the-real-numbers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20250126130328&#x2F;https:&#x2F;&#x2F;blog.acol...</a>
评论 #43070008 未加载
adamddev13 个月前
The way this article talks about using &quot;recursive real arithmetic&quot; (RRA) reminds me of an excellent discussion with Conal Elliot on the Type Theory For All podcast. He talked about moving from representing things discretely to representing things continually (and therefore more accurately). For instance, before, people represented fonts as blocks of pixels, (discrete.) They were rough approximations of what the font really was. But then they started to be recognized as lines&#x2F;vectors (continual), no matter the size, they represented exactly what a font was.<p>Conal gave a beautiful case for how comp sci should be about pursuing truth like that, and not just learning the latest commercial tool. I see the same dogged pursuit of true, accurate representation in this beatiful story.<p>- <a href="https:&#x2F;&#x2F;www.typetheoryforall.com&#x2F;episodes&#x2F;the-lost-elegance-of-computation" rel="nofollow">https:&#x2F;&#x2F;www.typetheoryforall.com&#x2F;episodes&#x2F;the-lost-elegance-...</a><p>- <a href="https:&#x2F;&#x2F;www.typetheoryforall.com&#x2F;episodes&#x2F;denotational-design" rel="nofollow">https:&#x2F;&#x2F;www.typetheoryforall.com&#x2F;episodes&#x2F;denotational-desig...</a>
评论 #43072475 未加载
netsharc3 个月前
&gt; (Also I decided to try writing this thread in the style of a linkedin influencer lol, sorry about that.)<p>I hated reading this buzzfeedy style (or apparently LinkedIn-style?) moron-vomit.<p>I shouldn&#x27;t complain, just ask my nearest LLM to rewrite this article^W scribbling to a less obnoxious form of writing..
评论 #43068866 未加载
评论 #43149030 未加载
评论 #43068745 未加载
评论 #43069736 未加载
tiltowait3 个月前
Some quick research yields a couple of open source CAS, such as OpenAxiom, which uses the Modified BSD license. Granted that Google has strong &quot;NIH&quot; tendencies, but I&#x27;m curious why something like this wasn&#x27;t adapted instead of paying several engineers some undisclosed amount of time to develop a calculation system.<p>The article mentions that a CAS is an order of magnitude (or more!) more complex than the bifurcated rational + RRA approach, as well as slower, but: the complexity would be solved by adapting an open source solution, and the computation speed wouldn&#x27;t seem to matter on a device like an Android smartphone. My HP Prime in CAS mode runs at 400MHz and solves every problem the Android calculator solves with no perceptible delay.<p>Is it a matter of NIH? A legal issue with the 3-clause BSD license I don&#x27;t understand? Reducing binary size? The available CAS weren&#x27;t up to snuff for one reason or another? Some other technical issue? Or, if not that, why not use binary-coded decimal?<p>These are just questions, not criticisms. I have very very little experience in the problem domain and am curious about the answers :)
mg3 个月前
To make any type of app really good is super hard.<p>I have yet to see a good to-do list tool.<p>I&#x27;m not kidding. I tried TickTick, Notion, Workflowy ... everything I tried so far feels cumbersome compared to how I would like to handle my To-Do list. The way you create, edit, browse, drag+drop items is not as all as fluid as I imagine it.<p>So if anyone knows a good To-Do list software (must be web based, so I can use it anywhere without installing something) - let me know!
评论 #43069262 未加载
评论 #43071133 未加载
评论 #43069362 未加载
评论 #43068978 未加载
评论 #43069307 未加载
评论 #43068820 未加载
评论 #43069361 未加载
chacha213 个月前
I share a lot of thoughts with that, and built my own calculator, too A calculator that gives right instead of wrong answers<p><a href="https:&#x2F;&#x2F;chachatelier.fr&#x2F;chalk&#x2F;chalk-home.php" rel="nofollow">https:&#x2F;&#x2F;chachatelier.fr&#x2F;chalk&#x2F;chalk-home.php</a><p>I tried to explain what was going on <a href="https:&#x2F;&#x2F;chachatelier.fr&#x2F;chalk&#x2F;article&#x2F;chalk.html" rel="nofollow">https:&#x2F;&#x2F;chachatelier.fr&#x2F;chalk&#x2F;article&#x2F;chalk.html</a>, but it&#x27;s not a very popular topic :-)
评论 #43096395 未加载
chaboud3 个月前
There’s a pleasantly elegant “hey, we’ve solved the practical functional complement to this category of problems over here, so let’s just split the general actual user problem structurally” vibe to this journey.<p>It often pays off to revisit what the actual “why” is behind the work that you’re doing, and this story is a delightful example.<p>I wrote an arbitrary precision arithmetic C++ library back in the 90’s. We used it to compute key pairs for our then new elliptic-curve based software authentication&#x2F;authorization system. I think the full cracks of the software were available in less than two weeks, but it was definitely a fun aside and <i>waaaay</i> too strong of a solution to a specific problem. I was young and stupid… now I’m old and stupid, so I’d just find an existing tool chain to solve the problem.
wiz21c3 个月前
I use qalculate, it behaves well enough for my needs.<p><a href="https:&#x2F;&#x2F;qalculate.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;qalculate.github.io&#x2F;</a>
staplung3 个月前
All the calculators that I just tried for the article&#x27;s expression give the wrong answer (HP Prime, TI-36X Pro, some casio thing). Even google&#x27;s own online calculator gives the wrong answer, which is mildly ironic. [<a href="https:&#x2F;&#x2F;www.google.com&#x2F;search?q=1e101%2B1-1e101&amp;oq=1e101%2B1" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=1e101%2B1-1e101&amp;oq=1e101%2B1</a>]<p>I played around with the macOS calculator and discovered that the dividing line seems to be at 1e33. I.e. 1e33+1-1e33 gives the correct answer of 1 but 1e34+1-1e34 gives 0. Not sure what to make of that.
评论 #43069589 未加载
评论 #43076361 未加载
move-on-by3 个月前
I enjoyed the article, but it seems Apple has since improved their calculator app slightly. The first example is giving me the correct result today. However, the second example with the “Underflow” result is still occurring.
评论 #43068806 未加载
评论 #43068785 未加载
GistNoesis3 个月前
That&#x27;s just a single number to calculate.<p>The real fun begins when you do geometry.<p>Find a representation of finite memory to represent points, which allows exact addition, multiplication and rotation between them, (with all the nice standard math property like associativity and commutativity).<p>For example your representation should be able to take a 2d point A, aka two coordinates, and rotate it around the origin by an angle theta to obtain the point B. Take the original point and rotate it by pi + theta, then reflect it around the origin to obtain the point C. Now answer the question whether B is coincident with C.
评论 #43072764 未加载
thomaspark3 个月前
I solved this by making a calculator that rounds to the nearest 1&#x2F;16. Tiny app for Americans doing DIY work around the house:<p><a href="https:&#x2F;&#x2F;thomaspark.co&#x2F;projects&#x2F;calc-16&#x2F;" rel="nofollow">https:&#x2F;&#x2F;thomaspark.co&#x2F;projects&#x2F;calc-16&#x2F;</a>
gravitronic3 个月前
years ago the daily wtf had a challenge for writing the worst calculator app. my submission maintained calculation state by emitting it&#x27;s own source code, recompiling and running the new executable.
评论 #43069284 未加载
评论 #43068278 未加载
HarHarVeryFunny3 个月前
Interesting article, and kudos to Boehm for going the extra mile(s), but it seems like overkill to me.<p>I wouldn&#x27;t expect, or use, a calculator for any calculation requiring more accuracy than the number of digits it can display. I&#x27;m OK with with iPhone&#x27;s 10^100 + 1 = 1e100.<p>If I really needed something better, I&#x27;d try Wolfram Alpha.
评论 #43073005 未加载
schneems3 个月前
This is interesting.<p>One of the first ideas I had for an app was a calculator that represented digits like shown in the article but allowed you to write them with variables and toggle between symbolic and actual responses.<p>A use case would be: in a spreadsheet like interface you could verify if the operations produced the final equation you were modeling in order to help validate if the number was correct or not. I had a TI-89 that could do something close and even in 2006 that was not exactly brand new tech. I figured surely some open source library available on the desktop must get me close. I was wildly wrong. I stuck with programming but abandoned the calculator idea. Even nearly 20 years later, such a task doesn’t seem that much easier to me.
评论 #43069283 未加载
评论 #43069137 未加载
xixixao3 个月前
Great resource! For my calculator I also wanted to tackle physics, which expands on the number definition with measurement error size.<p>It is suprisingly hard problem.<p><a href="https:&#x2F;&#x2F;recomputer.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;recomputer.github.io&#x2F;</a>
评论 #43070853 未加载
gweinberg3 个月前
At the risk of coming across as being a spoilsport, I think when someone says &quot;anyone can write a calculator app&quot;, they just mean an app that simulates a pocket calculator (which is indeed pretty easy) as opposed to one which always gives precisely the right answer (which is indeed impossible). Also, you can avoid the most embarrassing errors just by rearranging the terms to do cancellation where possible, e.g. sqrt(2) * 3 * sqrt(2) is absolutely precisely 6, not 6 within some degree of approximation.
评论 #43071539 未加载
评论 #43073473 未加载
HappyPanacea3 个月前
&gt; It&#x27;s too slow.<p>&gt; 1 is not equal to 1 - e^(-e^1000). But for Richardson and Fitch&#x27;s algorithm to detect that, it would require more steps than there are atoms in the universe.<p>&gt; They needed something faster.<p>I&#x27;m disappointed after this paragraph I expected a better algorithm and instead they decided to give up. Fredrik Johansson in his paper &quot;Calcium: computing in exact real and complex fields&quot; gives a partial algorithm for the problem and writes &quot;Algorithm 2 is inspired by Richardson’s algorithm, but incomplete: it will find logarithmic and exponential relations, but only if the extension tower is flattened (in other words, we must avoid extensions such as e^log(z) or √z^2), and it does not handle all algebraic functions. Much like the Risch algorithm, Richardson’s algorithm has apparently never been implemented fully. We presume that Mathematica and Maple use similar heuristics to ours, but the details are not documented [6], and we do not know to what extent True&#x2F;False answers are backed up by a rigorous certification in those system&quot;.
cibyr3 个月前
Perhaps amusingly, the implementation referenced in Boehm&#x27;s paper is a still-unmerged Android platform CL adding tests using this approach: <a href="https:&#x2F;&#x2F;android-review.googlesource.com&#x2F;c&#x2F;platform&#x2F;art&#x2F;+&#x2F;1012109" rel="nofollow">https:&#x2F;&#x2F;android-review.googlesource.com&#x2F;c&#x2F;platform&#x2F;art&#x2F;+&#x2F;101...</a>
CydeWeys3 个月前
&gt; Obviously we&#x27;ll want a symbolic representation for the real number 1<p>Sorry, why is this obvious? A basic int type can store the value of 1, let alone the more complicated Rational (BigNum&#x2F;BigNum) type they have. I can absolutely see why you want symbolic representations for pi, e, i, trig functions, etc., but why one?!
评论 #43071123 未加载
评论 #43071130 未加载
评论 #43072529 未加载
ikanreed3 个月前
I use python repl as my primary calculator on my computer.<p>1. I don&#x27;t have problems like the IOS problem documented here. This requires me to know the difference between an int and a float, but pythons ints have unbounded precision(except if you overflow your entire memory), so that kind of precision loss isn&#x27;t a big deal. 2. History is a lot better. Being able to scroll back seems like a thing calculators ought to offer you, but they don&#x27;t. 3. In the 1-in-a-hundred times I need to repeat operations on the calculator, hey, we&#x27;ve already got loops, this is python 4. Every math feature in the windows default calculator is available in the math library. 5. As bad as python&#x27;s performance reputation is, it&#x27;s not at all going to be noticeable for simple math.
评论 #43093614 未加载
raincole3 个月前
I really hate when people put cat images and memes in a serious article.<p>Don&#x27;t get me wrong, the content is good and informative. But I just hate the format.<p>That reminds me when SideFX started putting memes into their official tutorial youtube channel. At least this is just a webpage and we can scroll through them...
评论 #43067997 未加载
评论 #43068436 未加载
评论 #43067900 未加载
评论 #43068873 未加载
评论 #43068061 未加载
评论 #43068102 未加载
评论 #43068701 未加载
评论 #43068121 未加载
评论 #43068202 未加载
评论 #43068117 未加载
scotty793 个月前
Off topic, but I believe naming this specific kind of numbers &quot;real&quot; is a misnomer. Nothing in reality is expression of a real number. Real numbers pop up only when we abstract reality into mathematical models.<p>In Polish language rational numbers are called something more like &quot;measurable&quot; numbers and in my opinion that&#x27;s the last kind of numbers that is expressed in reality in any way. Those should be called &quot;real&quot; and real should be called something like &quot;abstract&quot; or &quot;limiting&quot; because they pop-up first as limits of some process working on rational numbers for infinite number of steps.
oldgradstudent3 个月前
&gt; This means a calculator built on floating point numbers is like a house built on sand.<p>I&#x27;ve taken multiple numerical analysis courses, including at the graduate level.<p>The only thing I&#x27;ve learnt was: be afraid, very afraid.
andrelaszlo3 个月前
π+1−π = 1.0000000000000<p>But<p>π−π = 0<p>I think I understand why, from the article, but wouldn&#x27;t it be &quot;easy&quot; (probably not, but curious about why) to simplify the first expression to (1-1)π + 1 then 0π + 1 and finally just 1 before calculating a result?
评论 #43073715 未加载
wodenokoto3 个月前
Hasn&#x27;t this been solved in cheap pocket calculators for decades before this?<p>HP scientific calculators goes back to the 60&#x27;s and can presumably add 0.6 to 3 without adding small values to the 20th significant digit.
Const-me3 个月前
Due to backwards compatibility modern PC CPUs have some mathematical constants in hardware, one of them Pi <a href="https:&#x2F;&#x2F;www.felixcloutier.com&#x2F;x86&#x2F;fld1:fldl2t:fldl2e:fldpi:fldlg2:fldln2:fldz" rel="nofollow">https:&#x2F;&#x2F;www.felixcloutier.com&#x2F;x86&#x2F;fld1:fldl2t:fldl2e:fldpi:f...</a> Moreover, that FLDPI instruction delivers 80 bits of precision, i.e. more precise than FP64.<p>That’s pretty much useless in modern world because the whole x87 FPU is deprecated. Modern compilers are generating SSE1 and SSE2 instructions for floating-point arithmetic, instead of x87.
daitangio3 个月前
As far as I know, windows calculator have a similar approach. It use rational, and switch to Taylor expansion to try to avoid cancellation errors. Microsoft open sourced it some times ago on GitHub
enricojr3 个月前
Could this be the reason why iPads haven&#x27;t had a calculator app until recently?<p>Because it&#x27;s such a difficult problem to solve that it required elite coders and Masters&#x2F;PhD level knowledge to even make an attempt?<p>(Apple Finally Plans To Release a Calculator App for iPad Later This Year)[<a href="https:&#x2F;&#x2F;www.macrumors.com&#x2F;2024&#x2F;04&#x2F;23&#x2F;calculator-app-for-ipad-rumor&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.macrumors.com&#x2F;2024&#x2F;04&#x2F;23&#x2F;calculator-app-for-ipad...</a>]
评论 #43077744 未加载
adilcanq3 个月前
lowkey this is why ieee 754 floating point is both a blessing and a curse, like yeah it’s fast n standardized but also introduces unavoidable precision loss, esp w iterative computations where rounding errors stack up in unpredictable ways. ppl act like increasing precision bits solves everything. but u just push the problem further down, still dealing w truncation, cancellation, etc. (and edge cases where numerical stability breaks down.)<p>… and this is why interval arithmetic and arbitrary precision methods exist, so it gives guaranteed bounds on error instead of just hoping fp rounding doesn’t mess things up too bad. but obv those come w their own overhead: interval methods can be overly conservative, which leads to unnecessary precision loss, and arbitrary precision is computationally expensive, scaling non-linearly w operand size.<p>wonder if hybrid approaches could be the move, like symbolic preprocessing to maintain exact forms where possible, then constrained numerical evaluation only when necessary. could optimize tradeoffs dynamically. so we’d keep things efficient while minimizing precision loss in critical operations. esp useful in contexts where precision requirements shift in real time. might even be interesting to explore adaptive precision techniques (where computations start at lower precision but refine iteratively based on error estimates).
joelburget3 个月前
I wrote an OCaml implementation of this paper a few years ago, which I&#x27;ve now extracted into its own [repo](<a href="https:&#x2F;&#x2F;github.com&#x2F;joelburget&#x2F;constructive-reals&#x2F;blob&#x2F;main&#x2F;Constructive_reals.ml">https:&#x2F;&#x2F;github.com&#x2F;joelburget&#x2F;constructive-reals&#x2F;blob&#x2F;main&#x2F;C...</a>)<p>The link in the paper to their Java implementation is now broken: does anyone have a current link?
LordGrignard3 个月前
This article was really well written. Usually in such articles i understand about 50%, maybe if I&#x27;m lucky 70% but this one I&#x27;ve understood nearly everything. It&#x27;s not much of a smartness thing but an absolute refusal on my part to learn the jargon of programming as well as my severe lack of knowledge of all the big words that are thrown around lol. But really simply written love it
jedberg3 个月前
I thought this was going to be about how Apple completely destroyed the calculator on iOS with the latest update.<p>Now it does the running ticker tape thing, which means you can&#x27;t use the AC button to quickly start over, because there is no AC button anymore!<p>I know it&#x27;s supposed to be easier&#x2F;better for the user, but they didn&#x27;t even give me a way to go back to the old behavior.
mcrouther3 个月前
Hmmm, solved a lot of these problems as well when building my own calculator: <a href="https:&#x2F;&#x2F;github.com&#x2F;crouther&#x2F;SciCalc">https:&#x2F;&#x2F;github.com&#x2F;crouther&#x2F;SciCalc</a><p>Seems like Apple got lazy with their calculator didn&#x27;t even realize they had so many flaws... Math Notes is pretty cool though.
pclmulqdq3 个月前
At some point, when I get a spare 5 years (and&#x2F;or if people start paying for software again), I will start to work on a calculator application. Number system wrangling is quite fun and challenging, and I am hoping to incorporate units as a first-class citizen.
phendrenad23 个月前
If you accept that Pi and Sqrt(2) will be represented as a terminating series of digits (say, 30), then 99% of the problems stated go away. My HP calculator doesn&#x27;t represent the square root of 2 as a magic number, it&#x27;s 1.414213562.
kstrauser3 个月前
Given the function to compute pi:<p><pre><code> while (Math.abs(term) &gt; tolerance) { term = ...; sum += term; } return sum * 4; </code></pre> Wouldn’t that return a value where the error of the result is 4x the requested tolerance?
based23 个月前
<a href="https:&#x2F;&#x2F;github.com&#x2F;based2&#x2F;KB&#x2F;blob&#x2F;main&#x2F;math&#x2F;aaa.md#calculator">https:&#x2F;&#x2F;github.com&#x2F;based2&#x2F;KB&#x2F;blob&#x2F;main&#x2F;math&#x2F;aaa.md#calculato...</a>
laidoffamazon3 个月前
This is really cool, but it does show how Google works. They’ll pay this guy ~$3million a year (assuming stock appreciation) to do this but almost no end user will appreciate it in the calculator app itself.
t435623 个月前
I doubt that most people using the calc app expect it to handle such situations. It&#x27;s nice that it does of course but IMO it misses the point that the inputs to a lot of real world calculations are inaccurate to start with.<p>i.e it&#x27;s more likely that I&#x27;ve made a few mm mistake when measuring the radius of my table than that I&#x27;m not using an precise enough version of Pi. The area of the table will have more error because one is squaring the radius, obviously.<p>It would be interesting to have a calculator that let you add in your estimated measurement error (or made a few reasonable guesses about it for you) and told you the error in your result e.g. the standard deviation.<p>I sometimes want to buy stuff at a hardware shop and I think : &quot;how much paint do I need to buy?&quot; I haven&#x27;t planned so I&#x27;m thinking &quot;it&#x27;s about 4m by 5m...I think?&quot; I try to do a couple of calculations with worst case numbers so I at least get enough paint and save another trip to the shop but not comically too much so that I have a tin of it for the next 5 years.<p>I remember having to estimate error in results that were calculated from measured values for physics 101 and it was a pain.
评论 #43071636 未加载
ChuckMcM3 个月前
Does anyone know if this was the system used by higher end TI calculators like the TI-92? It had a &#x27;rational&#x27; mode for exact answers and I suspect that it used RRA for that.
评论 #43073468 未加载
charlieok3 个月前
The bar for &quot;the greatest calculator app development story ever told&quot; it should be noted, is quite high :)<p><pre><code> https:&#x2F;&#x2F;www.pacifict.com&#x2F;story&#x2F;</code></pre>
darkhorse2223 个月前
I really do think we should just use the symbolic systems of math rather than trying to bring natural world numbers into a digital number space. It&#x27;s this mapping that inherently leads to compensating strategies. I guess this is called an algebraic system like the author mentioned.<p>But I view math as more of a string manipulation function with position-dependent mapping behavior per character and dependency graphs, combined with several special functions that form the universal constants.<p>Just because data is stored in digitization as 1 and O, don&#x27;t forget it&#x27;s more like charged and not charged. Computers are not numeric systems, they are binary systems. Not the same thing.
Synaesthesia3 个月前
Really interesting article. I noticed that my Android calculator app could display irrational numbers like PI to an impressive amount of digits, if I hold it sideways.
评论 #43072996 未加载
stevage3 个月前
I really wonder what the business case for spending so much effort on such precision was. Who are the users who need such accuracy but are using android calculator?
评论 #43072950 未加载
评论 #43071835 未加载
red_admiral3 个月前
There&#x27;s a point at which you&#x27;re really building a computer algebra system.<p>Or you can do what the Windows 11 calculator does and not even get 1+2*3 right.
评论 #43079940 未加载
评论 #43069210 未加载
morkalork3 个月前
This reminds me of solving project Euler problems that intentionally not possible to solve with simple float representation of numbers
shutupnerd00003 个月前
Why does the author insist on using a dick bar? With the &quot;contact me&quot; portion, it takes up 30% of my screen on an iPhone SE.
评论 #43072427 未加载
评论 #43072333 未加载
librasteve3 个月前
I just tried this in raku App::Crag...<p>crag &#x27;say (10*100) + 1 − (10*100)&#x27; #1<p>Raku uses Rats by default (Rational numbers) unless you ask for floating point.
dgacmu3 个月前
Anyone know of a comparison of the linked paper&#x27;s algorithm to how Gavin Howard&#x27;s &#x27;bc&#x27; CLI calculator does it?
评论 #43069106 未加载
hoseja3 个月前
No it is easy, you just throw up a math error whenever a smartass tries something like this. Like calculators do.
insane_dreamer3 个月前
How does an &quot;old school&quot; physical calculator handle the floating point precision problem?
NooneAtAll33 个月前
&gt; Showing 0.0000000000000 on the screen, when the answer is exactly 0, would be a horrible user experience.<p>&gt; They realized that it&#x27;s not the end of the world if they show &quot;0.000000...&quot; in a case where the answer is exactly 0<p>so... devs self-made a requirement, got into trouble (complexity) - removed the requirement, trouble didn&#x27;t go anywhere<p>just keep saying &quot;it&#x27;s a win&quot; and you&#x27;ll be winning, I guess
评论 #43069683 未加载
donatj3 个月前
Was given the task to build a simple calculator app as a project for a Java class I took in college.<p>No parens or anything like that, nothing nearly so fancy. Classic desk calculator where you set the infix operation to apply to the previous value, followed by the second value of the operation.<p>It was frankly an unexpected challenge. There&#x27;s a lot more to it than meets the eye.<p>I only got as far as rational numbers though. PI accurate to the 8 digit display was good enough for me.<p>Honestly though, I think it was a great exercise for students, showing how seemingly simple tasks can actually be more complex than they seem. I&#x27;m still here thinking about it some twenty years later.
ShaggyHotDog3 个月前
Saw the thread on Twitter. Kudos to the author for going in so much detail!
jwmoz3 个月前
Not a calculator engineer but this seems hideously complex?
评论 #43067827 未加载
评论 #43067882 未加载
评论 #43069385 未加载
评论 #43067746 未加载
est3 个月前
if &quot;answer&quot; overflows, switch to symbolic mode.
评论 #43067959 未加载
stackedinserter3 个月前
Yes, anyone can make a calculator.<p>I don&#x27;t care if it gives me &quot;Underflow&quot; for bs like e^-1000, just give me a text field that will be calculated into result that&#x27;s represented in the way I want (sci notation, hex, binary, ascii etc whatever).<p>All standard calculators are imitations of a desktop calculator, It&#x27;s insane that we&#x27;re still dragging this UI into desktop. Why don&#x27;t we use rotary dial on mobile phones then?<p>It&#x27;s great that at least OSX have cmd+space where I can type an expression and get a quick result.<p>And yes, I did develop my own calculator, and happily used it for many years.<p>TLDR: the real problem of calculators is their UI, not arithmetic core.
评论 #43071571 未加载
Mudasir_Fayaz3 个月前
nice story, building calculator at that time was a tough task today building calculator is just a prompt away inspiring
ksec3 个月前
So did they fix the iOS Calculator bug?<p>On another note. Since Calculator is so complex are there any open source cross platform library that makes it easier to implement?
评论 #43068605 未加载
评论 #43068754 未加载
cubefox3 个月前
Slightly disappointing: The calculator embedded in Google&#x27;s search page also gives the wrong answer (0) for (10^100) + 1 − (10^100). So apparently they don&#x27;t use the insights they gained from their Android calculator.
评论 #43072349 未加载
1970-01-013 个月前
I removed telemetry on my Win10 system and now calc.exe crashes on basic calculations. I&#x27;ve reported this but nobody cares because the next step in troubleshooting is to reinstall Windows. So if telemetry fails, calc.exe will silently explode. Therefore no, anyone cannot make it.<p>Won&#x27;t fix: <a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;calculator&#x2F;issues&#x2F;148">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;calculator&#x2F;issues&#x2F;148</a>
评论 #43068883 未加载
评论 #43070002 未加载
评论 #43068353 未加载
veltas3 个月前
And yet Android&#x27;s calculator is quite bad. Despite being able to correctly calculate stuff that 99.99% of the population don&#x27;t care about, it lacks many scientific operations that a good chunk of accountants, engineers and coders would make use of regularly. This is a classic situation of engineers solving the fun&#x2F;challenging problems before the customer&#x27;s actual problems.
评论 #43079319 未加载
mgaunard3 个月前
Could have just used an off-the-shelf CAS.
评论 #43071643 未加载
purplezooey3 个月前
&quot;Over the past year or so, I&#x27;ve reluctantly come to the conclusion I need to leave Elm and migrate to some other MUA like PINE or mutt...&quot;
MiddleEndian3 个月前
lol I ran into this when making a calculator program because Google&#x27;s calculator didn&#x27;t do certain operations (such as adding clock time results like 1:23+1:54) and also because Google occasionally accuses me of being a bot when I search for too many equations.<p>Maybe I&#x27;ll get back to the project and finish it this year.
jll293 个月前
Good read, thanks.
kingkulk3 个月前
cool story. All programming students should be made to create a calculator in school and have them truly understand the issue at hand.
112358132134553 个月前
recursive descent parser, normally any decent developer can do that, my version: <a href="https:&#x2F;&#x2F;caub.github.io&#x2F;misc&#x2F;calculator" rel="nofollow">https:&#x2F;&#x2F;caub.github.io&#x2F;misc&#x2F;calculator</a>
评论 #43068925 未加载
评论 #43069159 未加载
nabaraz3 个月前
Re: (10^100)+1-(10^100)<p>i) Answer is 0 if you cancel out two expression (10^100)<p>ii) Answer is 1 if you compute 10^100 and then add 1 which is insignificant.<p>How do you even cater for these scenarios? This needs more than arithmetic.
评论 #43071075 未加载
评论 #43070703 未加载
ajnin3 个月前
Interesting article but that feels like wasted effort for what is probably the most bare-bones calculator app out there. The Android calc app has the 4 operations, sin cos tan ^ ln log √ ! And that&#x27;s it. I think most people serious about calculator usage either have a physical one or use another more featureful app and the others don&#x27;t need such precision.
评论 #43070904 未加载
elif3 个月前
Nah yea you can over engineer anything.<p>In the year he did this he easily could have just done some minor interface tweaks to a ruby repl which includes the BigDecimal library. In fact I bet this post to an AI could result in such a numerically accurate calculator app. maybe as a Sinatra single file ruby web app designed to format to phone resolutions natively.