Re: QBasic --> Euphoria (again)

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

On Tue, 1 Sep 1998, jiri babor wrote:

> Ralf, you wrote:
>
> function abs (object x)
>     return x < 0 * -2 + x
> end function
>
> Did you not really mean something like
>
> function abs(object x)
>     return -2*x*(x<0)+x   -- or perhaps (1-2*(x<0))*x
> end function

I'll have to get in on this one :)

function sgn(object x)
    return (x>0)-(x<0) -- or compare({x},{0})
end function

function abs(object x)
    return x*sgn(x)
end function

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
In my last few days on the net, I have room for a witty quote. Irony. :S

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

Search



Quick Links

User menu

Not signed in.

Misc Menu