Remix.run Logo
A calculator that doesn't round(constructive-calculator.dimview.org)
29 points by dimview 4 days ago | 27 comments
__alexs a day ago | parent | next [-]

> Hans Boehm built a Java library for this in the 1980s and 90s

Hans is such a prolific programmer that he wrote a Java library before Java was even invented?

tomjakubowski a day ago | parent | next [-]

The article has so many of the hallmarks of LLM writing, naturally it will have some hallucinated factoids too. "What that gives you: [bullet list]", "What got ported: [bullet list]", "foo: x, y, just z"

Boehm's Java library has copyright dates of 1999 and 2001-2004. https://www.hboehm.info/new_crcalc/CR.java

The whitepaper was only published in 2005: https://www.sciencedirect.com/science/article/pii/S156783260...

I have a dimview now of the blog, and of this Swift port of the library, indeed.

dimview a day ago | parent [-]

Thank you. Of course the dates were out of order. The Java library (com.hp.creals) is 1999-2004, paper is from 2005. Unfortunate price of LLM-assisted development. Corrected.

a day ago | parent | prev | next [-]
[deleted]
nxobject a day ago | parent | prev [-]

Well, you know, you go into your Smalltalk-80 workstation for a hack sesh, and an all-nighter later you end up with an implementatkon of Swing...

bla3 a day ago | parent | prev | next [-]

> I built one, by porting Boehm’s engine. > It’s 2026, so I didn’t hand-write the port. I directed Opus 4.8 to translate the source line by line into Swift

I wish I could filter out stuff like this. Cool work by Hans Boehm, but what's the value add in this blog post.

B1FF_PSUVM a day ago | parent [-]

Read. Guy knows what he's doing.

IAmBroom 11 hours ago | parent [-]

You mean his AI wrote something you like... which is factually incorrect, so it's basically fanfic.

dimview 4 days ago | parent | prev | next [-]

Author here. I could not find a constructive‑reals calculator on iPhone, so I ported the engine Android uses: Hans Boehm's com.hp.creals plus AOSP's UnifiedReal/BoundedRational. Used Opus 4.8 to do the port and Fable 5 for the review.

Fable 5 caught a couple of real concurrency bugs the port introduced while adapting Java's synchronized/AsyncTask to Swift concurrency, including one that was a memory‑safety bug on shared singletons like π, not just a wrong digit. None would have shown up in the unit tests. Writeup has the details.

It's an early iPhone TestFlight beta (link in the post); happy to go deep on either the constructive‑reals side or the AI‑assisted‑dev side.

NetMageSCW a day ago | parent | next [-]

Maybe you should correct the errors in your post before worrying about the code.

dimview a day ago | parent [-]

Corrected the dates, thank you! What are the other errors?

nomel a day ago | parent | prev [-]

The old HP calculators, and their emulators, have a computer algebra system, for symbolic maths, that supported this. The user interfaces leave much to be desired, but some also have reverse Polish notation!

dimview a day ago | parent [-]

This is different from a CAS. For example, if you ask it to do exp(100)+1-exp(100), it does not rearrange and cancel out the two exp(100)s. Instead, it does exp, addition, and subtraction, all with as many digits as you ask for.

nomel 19 hours ago | parent [-]

Sure. I was speaking to the what, not how.

> that doesn’t round at all. It computes with constructive real numbers: every result is exact, and you can scroll any answer for as many correct digits as you want.

A CAS is a practical way to achieve this, where everything is stored symbolically, with no rounding, until final calculation. Unlimited precision was through Erable [1]. This was included with/as HP49 CAS, but was an add-on with HP48. Many HP48 are on the iOS app store. The one I tried about a decade ago had the add-on, and I see many still there (but not sure if they have the add-on).

The "S" in CAS is "system", so it's a bit open.

[1] https://en.wikipedia.org/wiki/Erable

19 hours ago | parent [-]
[deleted]
quixoticelixer- a day ago | parent | prev | next [-]

I don't get why this is a big deal. All the calculators I've used have been rectangle.

jagraff a day ago | parent | prev | next [-]

Very interesting, thank you for posting! I'm curious - roughly how many tokens do you think you used during the initial port and subsequent bug hunting and fixes?

dimview a day ago | parent [-]

For Opus 4.8, 142.3k input, 2.0m output for the entire project. No longer have access to Fable 5 to check.

piinbinary a day ago | parent | prev | next [-]

It would also be fun to have a full computer algebra system (like maxima) on a phone

xigoi 14 hours ago | parent | next [-]

https://webdev4.gitlab.io/fdroid-website/en/packages/jp.yhon...

dimview a day ago | parent | prev [-]

That should be doable, too. Maybe as a next project.

htx80nerd a day ago | parent | prev | next [-]

btw if you turn the iphone calc into landscape mode and switch you scientific calc it does Ramanujan's constant without rounding, but stops after the twelve 9s.

dimview a day ago | parent [-]

Correct, but if you don't know the next digit is 2, you can think it's all 9s, another representation of an integer number.

Jblx2 a day ago | parent | prev [-]

Edit: Whoops. My bad. This must have been a HN "second chance" winner.

badc0ffee a day ago | parent | next [-]

That looks like a link right back to this thread?

ColinWright a day ago | parent | prev | next [-]

Er, that's this submission.

a day ago | parent | prev [-]
[deleted]