Joel Purra: Developer and more

jqnpm logotype, a Penrose triangle


A collection of basic mathematical functions.

⚠️ This project has been archived

No future updates are planned. Feel free to continue using it, but expect no support.

This is a package for the command-line JSON processor jq. Install the package in your jq project/package directory with jqnpm:

jqnpm install joelpurra/jq-math


import "joelpurra/jq-math" as Math;

# Math::pow($base; $n)
Math::pow(2; 10)		# 1024

# Math::round
1234.567 | Math::round		# 1235

# Math::round($decimals)
1234.567 | Math::round(2)		# 1234.57

# Math::round($decimals)
-1234.567 | Math::round(2)		# -1234.57

Rounding tie-breaker rule

  • Rounding uses the round half away from zero tie-breaker rule.
  • Additional rounding tie-breaker rules can be implemented; perhaps in a separate rounding package.


Copyright (c) 2015 Joel Purra All rights reserved.

When using jq-math, comply to the MIT license. Please see the LICENSE file for details.

Live programming stream