Re: floats

new topic     » goto parent     » topic index » view thread      » older message » newer message

Thanks Matt this was the type of easy/quick solution i was looking for

Matt Lewis wrote:
> 
> Hayden McKay wrote:
> > 
> > I don't know if the last post made it so here's my question again
> > 
> > I was wondering if there was an easy way to seperate the exponent from a
> > fractal of a float32
> > 
> > eg: atom float32 float32=12345.54321
> > 
> > I need to make two words [12345][54321] respectively
> > 
> 
> The absolute easiest is probably to run the number through sprintf.  
> Something like this (untested):
> }}}
<eucode>
> atom float32 float32 = 12345.54321
> sequence float_text, words
> 
> float_text = sprintf( "%0.5f", float32 )
> words = { float_text[1..$-6], float_text[$-4..$] }
> </eucode>
{{{

> 
> Matt Lewis
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu