A-D(1)
π 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 π«Ά
πΈ COPYRIGHT πΈ
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
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms