A pluggable architecture increases flexibility and extensibility. The factory design pattern is used to allow creating an object without having to specify its type/class. ISQ is extended to use other packages with the isq.config
object.
Numbers
By default, ISQ uses the javascript Number to represent a numeric value which is notorious for rounding and precision errors. More precise packages (big.js, big-decimal, ...) can be used by setting isq.config.Number
to the package's constructor
isq.config.Number = require('big.js')
A number package is expected to implement the standard math methods. Various aliases are pre-defined to cope with naming inconsistencies.
Uncertain Numbers
By default, ISQ uses the supplied UncertainNumber to represent uncertain numeric values. It can be changed with isq.config.UncertainNumber
. The extension package is expected to implement the standard math methods and also the value
and uncertainty
property.