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.
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 https://joelpurra.com/ All rights reserved.
When using jq-math, comply to the MIT license. Please see the LICENSE file for details.