import BigNumber from 'bignumber.js' ; export const digits = new BigNumber ( '24' ) ; export const fixed1 = new BigNumber ( '1000000000000000000000000' ) ; export const toFixed = ( n ) => { return fixed1 . times ( n ) . integerValue ( BigNumber . ROUND_FLOOR ) ; } ; export const fromFixed = ( f ) => { return f . div ( fixed1 ) ; } ; export const fixedToInt = ( f ) => { return f . idiv ( fixed1 ) ; } ; export const multiply = ( a , b ) => { return a . times ( b ) . idiv ( fixed1 ) ; } ; export const divide = ( a , b ) => { return a . times ( fixed1 ) . idiv ( b ) ; } ; export const reciprocal = ( f ) => { return divide ( fixed1 , f ) ; } ;