package Ġio . open elt . sdk . util ĊĊ Ċ /* Ċ Ġ* ĠCopyright Ġ 2 0 1 5 ĠMichael ĠRo z um y ans ki y Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ ĊĊ Ċ fun ĠDouble . sin (): ĠDouble Ġ= ĠMath . sin ( this ) Ċ fun ĠDouble . cos (): ĠDouble Ġ= ĠMath . cos ( this ) Ċ fun ĠDouble . tan (): ĠDouble Ġ= ĠMath . tan ( this ) Ċ fun ĠDouble . asin (): ĠDouble Ġ= ĠMath . asin ( this ) Ċ fun ĠDouble . acos (): ĠDouble Ġ= ĠMath . acos ( this ) Ċ fun ĠDouble . atan (): ĠDouble Ġ= ĠMath . atan ( this ) Ċ fun ĠDouble . to Radians (): ĠDouble Ġ= ĠMath . to Radians ( this ) Ċ fun ĠDouble . to Degrees (): ĠDouble Ġ= ĠMath . to Degrees ( this ) Ċ fun ĠDouble . exp (): ĠDouble Ġ= ĠMath . exp ( this ) Ċ fun ĠDouble . log (): ĠDouble Ġ= ĠMath . log ( this ) Ċ fun ĠDouble . log 1 0 (): ĠDouble Ġ= ĠMath . log 1 0 ( this ) Ċ fun ĠDouble . sqrt (): ĠDouble Ġ= ĠMath . sqrt ( this ) Ċ fun ĠDouble . c br t (): ĠDouble Ġ= ĠMath . c br t ( this ) Ċ fun ĠDouble . IEEE remainder ( div isor : ĠDouble ): ĠDouble Ġ= ĠMath . IEEE remainder ( this , Ġdivisor ) Ċ fun ĠDouble . ceil (): ĠDouble Ġ= ĠMath . ceil ( this ) Ċ fun ĠDouble . floor (): ĠDouble Ġ= ĠMath . floor ( this ) Ċ fun ĠDouble . rint (): ĠDouble Ġ= ĠMath . rint ( this ) Ċ fun ĠDouble . atan 2 ( x : ĠDouble ): ĠDouble Ġ= ĠMath . atan 2 ( this , Ġx ) Ċ fun ĠDouble . pow ( exp : ĠDouble ): ĠDouble Ġ= ĠMath . pow ( this , Ġexp ) Ċ fun ĠDouble . round (): ĠLong Ġ= ĠMath . round ( this ) Ċ fun ĠDouble . abs (): ĠDouble Ġ= ĠMath . abs ( this ) Ċ fun ĠDouble . ulp (): ĠDouble Ġ= ĠMath . ulp ( this ) Ċ fun ĠDouble . sign um (): ĠDouble Ġ= ĠMath . sign um ( this ) Ċ fun ĠDouble . sin h (): ĠDouble Ġ= ĠMath . sin h ( this ) Ċ fun ĠDouble . co sh (): ĠDouble Ġ= ĠMath . co sh ( this ) Ċ fun ĠDouble . tanh (): ĠDouble Ġ= ĠMath . tanh ( this ) Ċ fun ĠDouble . exp m 1 (): ĠDouble Ġ= ĠMath . exp m 1 ( this ) Ċ fun ĠDouble . log 1 p (): ĠDouble Ġ= ĠMath . log 1 p ( this ) Ċ fun ĠDouble . copy Sign ( sign : ĠDouble ): ĠDouble Ġ= ĠMath . copy Sign ( this , Ġsign ) Ċ fun ĠDouble . exponent (): ĠInt Ġ= ĠMath . get Exponent ( this ) Ċ fun ĠDouble . next ( direction : ĠDouble ): ĠDouble Ġ= ĠMath . next After ( this , Ġdirection ) Ċ fun ĠDouble . next Up (): ĠDouble Ġ= ĠMath . next Up ( this ) Ċ fun ĠDouble . scal b ( scale Factor : ĠInt ): ĠDouble Ġ= ĠMath . scal b ( this , Ġscale Factor ) Ċ fun ĠDouble . clamp ( min : ĠDouble , Ġmax : ĠDouble ): ĠDouble Ġ= ĠMath . max ( min , ĠMath . min ( this , Ġmax )) Ċ Ċ fun ĠFloat . sin (): ĠFloat Ġ= ĠFloat Math . sin ( this ) Ċ fun ĠFloat . cos (): ĠFloat Ġ= ĠFloat Math . cos ( this ) Ċ fun ĠFloat . tan (): ĠFloat Ġ= ĠFloat Math . tan ( this ) Ċ fun ĠFloat . asin (): ĠFloat Ġ= ĠFloat Math . asin ( this ) Ċ fun ĠFloat . acos (): ĠFloat Ġ= ĠFloat Math . acos ( this ) Ċ fun ĠFloat . atan (): ĠFloat Ġ= ĠFloat Math . atan ( this ) Ċ fun ĠFloat . to Radians (): ĠFloat Ġ= ĠFloat Math . to Radians ( this ) Ċ fun ĠFloat . to Degrees (): ĠFloat Ġ= ĠFloat Math . to Degrees ( this ) Ċ fun ĠFloat . exp (): ĠFloat Ġ= ĠFloat Math . exp ( this ) Ċ fun ĠFloat . log (): ĠFloat Ġ= ĠFloat Math . log ( this ) Ċ fun ĠFloat . log 1 0 (): ĠFloat Ġ= ĠFloat Math . log 1 0 ( this ) Ċ fun ĠFloat . sqrt (): ĠFloat Ġ= ĠFloat Math . sqrt ( this ) Ċ fun ĠFloat . c br t (): ĠFloat Ġ= ĠFloat Math . c br t ( this ) Ċ fun ĠFloat . IEEE remainder ( div isor : ĠFloat ): ĠFloat Ġ= ĠFloat Math . IEEE remainder ( this , Ġdivisor ) Ċ fun ĠFloat . ceil (): ĠFloat Ġ= ĠFloat Math . ceil ( this ) Ċ fun ĠFloat . floor (): ĠFloat Ġ= ĠFloat Math . floor ( this ) Ċ fun ĠFloat . rint (): ĠFloat Ġ= ĠFloat Math . rint ( this ) Ċ fun ĠFloat . atan 2 ( x : ĠFloat ): ĠFloat Ġ= ĠFloat Math . atan 2 ( this , Ġx ) Ċ fun ĠFloat . pow ( exp : ĠFloat ): ĠFloat Ġ= ĠFloat Math . pow ( this , Ġexp ) Ċ fun ĠFloat . round (): ĠInt Ġ= ĠMath . round ( this ) Ċ fun ĠFloat . abs (): ĠFloat Ġ= ĠMath . abs ( this ) Ċ fun ĠFloat . ulp (): ĠFloat Ġ= ĠMath . ulp ( this ) Ċ fun ĠFloat . sign um (): ĠFloat Ġ= ĠMath . sign um ( this ) Ċ fun ĠFloat . sin h (): ĠFloat Ġ= ĠFloat Math . sin h ( this ) Ċ fun ĠFloat . co sh (): ĠFloat Ġ= ĠFloat Math . co sh ( this ) Ċ fun ĠFloat . tanh (): ĠFloat Ġ= ĠFloat Math . tanh ( this ) Ċ fun ĠFloat . exp m 1 (): ĠFloat Ġ= ĠFloat Math . exp m 1 ( this ) Ċ fun ĠFloat . log 1 p (): ĠFloat Ġ= ĠFloat Math . log 1 p ( this ) Ċ fun ĠFloat . copy Sign ( sign : ĠFloat ): ĠFloat Ġ= ĠMath . copy Sign ( this , Ġsign ) Ċ fun ĠFloat . exponent (): ĠInt Ġ= ĠMath . get Exponent ( this ) Ċ fun ĠFloat . next ( direction : ĠFloat ): ĠFloat Ġ= ĠFloat Math . next After ( this , Ġdirection ) Ċ fun ĠFloat . next ( direction : ĠDouble ): ĠFloat Ġ= ĠMath . next After ( this , Ġdirection ) Ċ fun ĠFloat . next Up (): ĠFloat Ġ= ĠMath . next Up ( this ) Ċ fun ĠFloat . scal b ( scale Factor : ĠInt ): ĠFloat Ġ= ĠMath . scal b ( this , Ġscale Factor ) Ċ fun ĠFloat . clamp ( min : ĠFloat , Ġmax : ĠFloat ): ĠFloat Ġ= ĠMath . max ( min , ĠMath . min ( this , Ġmax )) Ċ Ċ fun ĠInt . log 2 () Ġ= ĠInt Math . log 2 ( this ) Ċ Ċ object ĠFloat Math Ġ{ ĊĠĠĠ Ġval ĠPI : ĠFloat Ġ= ĠMath . PI . toFloat () ĊĠĠĠ Ġval ĠE : ĠFloat Ġ= ĠMath . E . toFloat () ĊĊĠĠĠ Ġfun Ġsin ( value : ĠFloat ): ĠFloat Ġ= ĠMath . sin ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġcos ( value : ĠFloat ): ĠFloat Ġ= ĠMath . cos ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġtan ( value : ĠFloat ): ĠFloat Ġ= ĠMath . tan ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġsqrt ( value : ĠFloat ): ĠFloat Ġ= ĠMath . sqrt ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġa cos ( value : ĠFloat ): ĠFloat Ġ= ĠMath . acos ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġas in ( value : ĠFloat ): ĠFloat Ġ= ĠMath . asin ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġatan ( value : ĠFloat ): ĠFloat Ġ= ĠMath . atan ( value . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġatan 2 ( x : ĠFloat , Ġy : ĠFloat ): ĠFloat Ġ= ĠMath . atan 2 ( x . toDouble (), Ġy . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġpow ( x : ĠFloat , Ġy : ĠFloat ): ĠFloat Ġ= ĠMath . pow ( x . toDouble (), Ġy . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġceil ( x : ĠFloat ): ĠFloat Ġ= ĠMath . ceil ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġfloor ( x : ĠFloat ): ĠFloat Ġ= ĠMath . floor ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġto Radians ( ang deg : ĠFloat ): ĠFloat Ġ= ĠMath . to Radians ( ang deg . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġto Degrees ( ang rad : ĠFloat ): ĠFloat Ġ= ĠMath . to Degrees ( ang rad . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġexp ( x : ĠFloat ): ĠFloat Ġ= ĠMath . exp ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġlog ( x : ĠFloat ): ĠFloat Ġ= ĠMath . log ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġlog 1 0 ( x : ĠFloat ): ĠFloat Ġ= ĠMath . log 1 0 ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġc br t ( x : ĠFloat ): ĠFloat Ġ= ĠMath . c br t ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun ĠIEEE remainder ( x : ĠFloat , Ġy : ĠFloat ): ĠFloat Ġ= ĠMath . IEEE remainder ( x . toDouble (), Ġy . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġr int ( x : ĠFloat ): ĠFloat Ġ= ĠMath . rint ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġsin h ( x : ĠFloat ): ĠFloat Ġ= ĠMath . sin h ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġcos h ( x : ĠFloat ): ĠFloat Ġ= ĠMath . co sh ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġt anh ( x : ĠFloat ): ĠFloat Ġ= ĠMath . tanh ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġexp m 1 ( x : ĠFloat ): ĠFloat Ġ= ĠMath . exp m 1 ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġlog 1 p ( x : ĠFloat ): ĠFloat Ġ= ĠMath . log 1 p ( x . toDouble ()). toFloat () ĊĠĠĠ Ġfun Ġnext After ( start : ĠFloat , Ġdirection : ĠFloat ): ĠFloat Ġ= ĠMath . next After ( start , Ġdirection . toDouble ()) ĊĠĠĠ Ġfun Ġclamp ( value : ĠFloat , Ġmin : ĠFloat , Ġmax : ĠFloat ): ĠFloat Ġ= ĠMath . max ( min , ĠMath . min ( value , Ġmax )) Ċ } Ċ Ċ object ĠInt Math Ġ{ ĊĊĠĠĠ Ġfun Ġlog 2 ( n : ĠInt ): ĠInt Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ( n Ġ<= Ġ 0 ) Ġthrow ĠIllegalArgumentException () ĊĠĠĠĠĠĠĠ Ġreturn Ġ 3 1 Ġ- ĠInteger . numberOf Leading Z eros ( n ) ĊĠĠĠ Ġ} Ċ }