const math = { createSin : function ( height , width , offset ) { return ( x ) : number => height * Math . sin ( width * x + offset ) ; } , createGetPointOnCircle : function ( radius , offsetX = 0 , offsetY = 0 ) { return ( radian ) => ( { x : offsetX + radius * Math . cos ( radian ) , y : offsetY + radius * Math . sin ( radian ) , } ) ; } , add : function ( ... numbers ) : number { function getDecimalLength ( n ) { const temp = n . toString ( ) . split ( '.' ) ; return temp [ temp . length - 1 ] . length ; } function addTwoNumber ( a , b ) { const firstLenth = getDecimalLength ( a ) ; const secondeLenth = getDecimalLength ( a ) ; const biggerLength = firstLenth > secondeLenth ? firstLenth : secondeLenth ; const n = Math . pow ( 10 , biggerLength ) ; return ( a * n + b * n ) / n ; } return numbers . reduce ( ( previous , current ) => { return addTwoNumber ( previous , current ) ; } ) ; } , } ; export default math ; export const createSin = math . createSin ; export const createGetPointOnCircle = math . createGetPointOnCircle ; export const add = math . add ;