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
Wikipedia, and the entire Wikimedia movement, has been a democratic, anti-authoritarian experiment since the day of its inception.
It's a project that matters, something I've been proud to have made a career of.
I spent my 20 years at the Wikimedia Foundation trying to further that experiment on a professional basis, and I have never been prouder of my former colleagues at WMF than I have been these past few months as we've been making @wwu a reality.
You should organize your workplace too.
I'm sick of hearing how LLMs are warping projects & people I care about. Here's what I want to hear about instead.
You want to create something amazing, that'll reach & last? You need help. Build a team culture of respect, humor, genuine affection, curiosity, patience, sympathy, delight. Build a place where good people want to do the best work of their lives. Help them grow, help them leave.
It's not the commits. It is not the *fucking* *tools*.
It. Is. The. People.
Help the people.
kitsune tails, the award winning gay foxgirl mario-like, is 35% off on steam: https://store.steampowered.com/app/1325260/Kitsune_Tails/
or you can pick up all four of our games in support of a queer studio for only $18.75: https://store.steampowered.com/bundle/15673/Kitsune_Games_Complete_Pack/
Trans woman, bisexual, someone's fiancée, forever a programmer, poly, and former total mess
Avatar by mavica