A-D(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’– A-D(1) β€” bestie's guide to a-d πŸ’–

okay so this is a page from the BRL-CAD manual set β€” it's A-D(1), and no, the manual name is not a typo, it's literally called a-d and it's iconic for exactly one job. Let's get into it 🫢


✨ NAME ✨

a-d β€” the little converter that turns ASCII numbers into double-precision binary. that's it. that's the whole personality. πŸ’…


🌸 SYNOPSIS 🌸

a-d [values ...] < ascii > doubles

like, you either hand it values or you pipe stuff into it, and it spits out doubles. simple. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

so a-d takes decimal numbers in ASCII text and turns them into a stream of machine-native double-precision (8-byte) binary floating point values, which get written to standard output. it's giving translator, it's giving "I speak both languages". ✨

here's the vibe check on how it picks up numbers:

  • if you pass one or more numeric values on the command line, each one gets converted in order and written to standard output. in order. respectfully. πŸ‘‘
  • otherwise, the numbers get read from standard input, separated by whitespace. easy.
  • and specifically when reading from standard input: any line beginning with a # character is treated as a comment and ignored through the end of that line. so you can annotate your data, no cap πŸ’–
⚠️ important one, bestie: because the output is raw binary, a-d refuses to run when standard output is a terminal. it's protecting you. you don't want that sprayed onto your screen, trust 😭

the inverse conversion β€” from binary doubles back to ASCII β€” is done by d-a(1). they're a matching set, iykyk.

πŸ’€ also real talk: this command is deprecated and scheduled for removal, and it prints a deprecation warning on startup. so like… enjoy it while it lasts, but maybe don't build your whole life on it πŸ™ˆ

πŸŽ€ EXAMPLES πŸŽ€

Example 1. Convert command-line values to a binary double stream

a-d 1.0 2.5 -3.75 > values.d

writes three 8-byte doubles (24 bytes total) to the file values.d. math is mathing, bytes are byting. πŸ”₯

Example 2. Pipe ASCII data through to a binary consumer

echo "# sample data
1.0 2.0 3.0" | a-d | d-a

this one reads whitespace-separated numbers from standard input, skipping the leading comment line, converts them to binary doubles, and feeds the result to d-a(1) to convert it back to ASCII. it's a whole round trip. main character energy honestly 🌈


🧚 SEE ALSO 🧚

go read those too, they're part of the family πŸ’œ


⭐ AUTHOR ⭐

BRL-CAD Team β€” absolute legends, we stan 🫢


this software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory. periodt. πŸ’…


πŸ“ BUG REPORTS πŸ“

reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. if something's cursed, tell the devs, don't just suffer in silence bestie πŸ˜­πŸ’–


and that's the page!! brought to you by the BRL-CAD manual, A-D(1) β€” go forth and convert responsibly βœ¨πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from