dc is the RPN arbitrary precision calculator that's long been a standard on UNIX systems (but not actually standardized by POSIX)
Yesterday a friend was noticing how .. weird .. it is with fractions in non-decimal radixes. gnu dc is particularly spectacularly broken, while bsd dc is somewhat better.
gnu dc failing: 16dio 8k .02p (set precision to 8 places, input and output radix to 16, and print 1/256(decimal)) prints "0". Ideally, it would print ".02". bsd dc prints ".020000".
bsd dc failing: 99k 3o 1 3 / p (set precision to 99 places, output radix to 3, compute 1/3, and print it). Ideally it would print ".1" or ".1000..." but bsd dc prints ".022....21"
This is because internally all dc arithmetic takes place in decimal; additionally, gnu dc incorrectly counts how many decimal digits of precision are needed.
So of course .. I wrote my own incomplete dc implementation. It uses Python and infinite precision fractions. Only the very basic operations are implemented, but at least you can calculate in hexadecimal floating point notation and get accurate results.
pydc> 8k 16dio
pydc> .8 .FFE *p
0.7FF
pydc> 1 3 / p
0.55555555
For now the code lives in my junk drawer and has no explicit license, but you can use it if you want. https://codeberg.org/jepler/junkdrawer/src/branch/main/bgj9ls82/dc.py
I was there Gandalf, in the 90s.
I have fond memories of using this calculator growing up. It’s been stolen on several occasions from my father during moves and he’s replaced it just as many times.
When he passed, it was one of his things that I wanted, but it also mysteriously disappeared.
I purchased my own today and am happy. It’s not the calculator my father used, but it’s still a first gen 12C and it brings me joy.
time for some concatenative language
More work on my pure #python #rpn #calculator. I added the ability to edit user functions for the calculator with syntax highlighting thanks to the IDLE editor.
J’adore ces machines où l’UX est… mécanique.
La HP-46 (1973) combine calcul scientifique, RPN et imprimante intégrée : tu obtiens une trace papier immédiate et le clac-clac vaut un ASMR vintage. 😄
A lire : https://www.silicium.org/index.php/blog-catalogue/ordis/hewlett-packard/hp46
#HP-46 #HewlettPackard #RetroComputing #VintageTech #RPN #OldHardware #GeekHistory
RPN - rätt sätt att räkna på.
Joachim Klahr använder omvänd polsk notation i sitt programmeringsspråk Quadrate, och insåg att han räknat på ett sämre sätt hela livet.
Ett utdrag ur Kodsnack 690 - lyssna där poddar finns eller på kodsnack.se
#podcast #rpn #quadrate #hpCalculators #ti83
RE: https://mastodon.ml/@volandevsrat/116022729946941274
#софт #TRH #идиоты #математика #калькулятор #RPN #Android
...Вот именно поэтому для подсчтета всякой бытовой херни у меня есть какулятор в обратной польской нотации 😉 Всё лежит в стеке, нет «алгоритмического» порядка операций 😉 нету скобок, понятно даже ребенку с первого раза. На #FDroid гуглить RPN Calculator, вот этот самое огниво при том, что прост как три копейки.