1. abs() , rnd() func or integer cast?

Hi everyone, maybe I just missed it, but i can't find a lib function
 or builtin to isolate the integer part of a number. I need to just take
the integer part of a division result, but amazingly I can't find any way
of doing this in Euphoria. I searched the docs for either a integer divide 
such as DIV in pascal, or a lib function strip the decimal part off a number
so I can use it as an indice in a sequence!

new topic     » topic index » view message » categorize

2. Re: abs() , rnd() func or integer cast?

Asa wrote:
> 
> 
>  Hi everyone, maybe I just missed it, but i can't find a lib function
>  or builtin to isolate the integer part of a number. I need to just take
> the integer part of a division result, but amazingly I can't find any way
> of doing this in Euphoria. I searched the docs for either a integer divide 
> such as DIV in pascal, or a lib function strip the decimal part off a number
> so I can use it as an indice in a sequence!

Look up ' floor '

Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

3. Re: abs() , rnd() func or integer cast?

Thanks for the quick reply! I guess the name thew me off. :)

new topic     » goto parent     » topic index » view message » categorize

4. Re: abs() , rnd() func or integer cast?

Asa wrote:
> 
> 
>  Hi everyone, maybe I just missed it, but i can't find a lib function
>  or builtin to isolate the integer part of a number. I need to just take
> the integer part of a division result, but amazingly I can't find any way
> of doing this in Euphoria. I searched the docs for either a integer divide 
> such as DIV in pascal, or a lib function strip the decimal part off a number
> so I can use it as an indice in a sequence!

1/ Check the manual for floor(), you'll be delighted.

2/ Sequence indexes are rounded down to integers if non integer atoms, so you
don't even need to call floor() in this case, the interpreter does it for you.

CChris

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu