DMOD(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’– DMOD(1) β€” dmod: apply arithmetic operations to a stream of doubles πŸ’–

✨ NAME ✨

dmod β€” apply arithmetic operations to a stream of doubles. Main character energy for binary double math, no cap. 🫢

🌈 SYNOPSIS 🌈

dmod [-a add] [-s sub] [-m mult] [-d div] [-A] [-e exp] [-r root] [doubles]

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so dmod reads a stream of 64-bit double-precision floating-point numbers, applies one or more arithmetic operations to every value, and writes the modified doubles to standard output. It’s giving β€œtiny math pipeline, huge slay.” ✨

You can stack any number of add, subtract, multiply, divide, absolute value, or exponentiation operations on the command line. They get applied to each value in the order they appear, so the operations form a left-to-right pipeline. Order matters, bestie β€” the vibe check is sequential. πŸ’…

If a file argument is supplied, dmod reads from it; otherwise it reads from standard input. Both the input and output are raw binary doubles, so the standard input and output must not be a terminal. Do not point raw binary doubles at your terminal unless you want glitch-chaos energy 😭. See dconv(1) and d-i(1) for converting between doubles and other numeric formats. πŸ¦‹


πŸŽ€ OPTIONS πŸŽ€

  • -a val β€” add val to each number. ✨
  • -s val β€” subtract val from each number. 🌸
  • -m val β€” multiply each number by val. πŸŽ€
  • -d val β€” divide each number by val. A val of zero is rejected. πŸ’€
  • -A β€” replace each number with its absolute value. πŸ‘‘
  • -e val β€” raise each number to the power val. πŸ”₯
  • -r val β€” take the val-th root of each number (raise to the power 1/val). A val of zero is rejected. πŸ™ˆ
  • -h, -? β€” print a usage message and exit. 🫢

πŸ“ EXAMPLES πŸ“

πŸ’œ Example 1. Rescale a height field to inches and clamp negatives

dmod -m 0.0393701 -A terrain_mm.d > terrain_in_pos.d

Reads doubles from terrain_mm.d (values in millimeters), multiplies each by 0.0393701 to convert to inches, then takes the absolute value to remove any negative elevations, writing the result to terrain_in_pos.d. Operations are applied left to right, so the scaling happens before the absolute value. Iconic, honestly. πŸ’–

🧚 SEE ALSO 🧚

brlcad(1), dconv(1), d-i(1), d-f(1) β€” go give these a read too, bestie πŸ’…

🌟 AUTHOR 🌟

BRL-CAD Team β€” the whole squad. πŸ‘‘

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

πŸ’€ BUG REPORTS πŸ’€

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. Please do tell them, fr fr β€” bug reports are self-care. 🫢


πŸ’– BRL-CAD β€’ DMOD(1) β€’ that’s the whole page, bestie β€” bye! πŸ’–

πŸ“¦ where this page comes from