1 over (count-digits) <sbuf> (fixnum>dec) "" like reverse! nip ; inline
: (positive>base) ( num radix -- str )
- dup 1 <= [ throw-invalid-radix ] when
+ dup 1 <= [ invalid-radix ] when
[ dup 0 > ] swap [ /mod >digit ] curry "" produce-as nip
reverse! ; inline
{ 16 [ [ float>hex-value ] swap (bin-float>base) ] }
{ 8 [ [ float>oct-value ] swap (bin-float>base) ] }
{ 2 [ [ float>bin-value ] swap (bin-float>base) ] }
- [ throw-invalid-radix ]
+ [ invalid-radix ]
} case ;
: format-string ( format -- format )