@@ -18,6 +18,10 @@ export class BZZ {
1818 return new BZZ ( new FixedPointNumber ( plur , BZZ . DIGITS ) )
1919 }
2020
21+ public static fromFloat ( float : number ) {
22+ return new BZZ ( FixedPointNumber . fromFloat ( float , BZZ . DIGITS ) )
23+ }
24+
2125 public toPLURString ( ) {
2226 return this . state . toString ( )
2327 }
@@ -30,6 +34,10 @@ export class BZZ {
3034 return this . state . toDecimalString ( )
3135 }
3236
37+ public toFloat ( ) {
38+ return this . state . toFloat ( )
39+ }
40+
3341 public toSignificantDigits ( digits : number ) {
3442 return this . toDecimalString ( ) . slice ( 0 , this . toDecimalString ( ) . indexOf ( '.' ) + digits + 1 )
3543 }
@@ -108,6 +116,10 @@ export class DAI {
108116 return new DAI ( new FixedPointNumber ( wei , DAI . DIGITS ) )
109117 }
110118
119+ public static fromFloat ( float : number ) {
120+ return new DAI ( FixedPointNumber . fromFloat ( float , DAI . DIGITS ) )
121+ }
122+
111123 public toWeiString ( ) {
112124 return this . state . toString ( )
113125 }
@@ -124,6 +136,10 @@ export class DAI {
124136 return this . toDecimalString ( ) . slice ( 0 , this . toDecimalString ( ) . indexOf ( '.' ) + digits + 1 )
125137 }
126138
139+ public toFloat ( ) {
140+ return this . state . toFloat ( )
141+ }
142+
127143 /**
128144 * Does not mutate the current DAI instance.
129145 *
0 commit comments