News for hackers. Stuff that matters.
Re:A deeper introduction to Unix DC by c0l0 on Monday June 08, 2020 @09:21AM (#23456237)
dc is worth having installed because of this CLI gem alone:

    echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq" | dc
I've never tried to understand what's really going on to produce the result, but also wouldn't really know where to start - maybe someone in HN's audience can enlighten me? :)
Re:A deeper introduction to Unix DC by em500 on Monday June 08, 2020 @09:39AM (#23456372)
dc and bc are standard POSIX utils (and also part of busybox for embedded systems) so for most unix-like systems they're installed by default unless you take active measures to exclude them.
Re:A deeper introduction to Unix DC by c0l0 on Monday June 08, 2020 @09:56AM (#23456494)
POSIX.1-2017 describes the `dc` program as "excluded" from the standard; check https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xcu... for details.

Many GNU/Linux distros (at least Debian and RHEL) install neither `dc` nor `bc` by default, afaik.

Re:A deeper introduction to Unix DC by yjftsjthsd-h on Monday June 08, 2020 @05:59PM (#23461283)
> Many GNU/Linux distros (at least Debian and RHEL) install neither `dc` nor `bc` by default, afaik.

Yeah, I recently wrote a script that used bc and immediately discovered that it didn't work on at least Arch Linux (and I think others, although I only seem to have added it to the Arch ansible config...); conveniently, I only needed the most trivial of calculations, so I just shifted to awk, which has better default availability.

Re:A deeper introduction to Unix DC by akira2501 on Monday June 08, 2020 @02:59PM (#23459615)
Gentoo doesn't include it in the common 'stage3' tarball, either. Which is annoying because it's actually required to compile the linux kernel.
Re:A deeper introduction to Unix DC by em500 on Monday June 08, 2020 @01:15PM (#23458480)
I stand corrected, only bc is included in POSIX.
Re:A deeper introduction to Unix DC by na85 on Monday June 08, 2020 @04:29PM (#23460417)
Re:A deeper introduction to Unix DC by kps on Monday June 08, 2020 @11:14AM (#23457187)

    echo '1033333377708482P' | dc
produces the same output using Unix dc but not in the GNU near-clone. (To understand why, you have to R the P as well as the M.)
Re:A deeper introduction to Unix DC by m463 on Monday June 08, 2020 @11:58PM (#23463508)

  echo 'EGSZ%%%'|tr 'E-Z%' 'R-ZA-M!'