Skip to content

mrhanlon/handlebars-math-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handlebars.java Math Helpers

Build Status

A Library of Helpers for performing simple math operations in Handlebars.

Perform math operations in handlebars. Inspired by this JSFiddle.

Operands are treated as java.math.BigDecimal and operations are performed with the java.math.MathContext.DECIMAL64 MathContext, yielding results with 16 bits of precision and rounding to the nearest even digit, according to IEEE 754R. You can force rounding decimal results using the extra parameter scale, which corresponds to calling BigDecimal.setScale(int scale, RoundingMode.HALF_UP).

addition

{{math arg0 "+" arg1}} // arg0 + arg1

subtraction

{{math arg0 "-" arg1}} // arg0 - arg1

multiplication

{{math arg0 "*" arg1}} // arg0 * arg1

division

{{math arg0 "/" arg1}} // arg0 / arg1

modulus

{{math arg0 "%" arg1}} // arg0 % arg1

About

Math Helpers for Handlebars.java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages