1. QBasic --> Euphoria (again)
- Posted by Alan Tu <ATU5713 at COMPUSERVE.COM> Sep 01, 1998
- 620 views
For ABS, function abs(atom x) if x >=3D 0 then return x elsif x < 0 then return -x end if end function --Alan =
2. Re: QBasic --> Euphoria (again)
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Sep 01, 1998
- 592 views
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
3. Re: QBasic --> Euphoria (again)
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Sep 02, 1998
- 584 views
Good one, Carl! I especially like the sign function. I have just compared (over several million cycles) function abs(object x) return -2*x*(x<0)+x end function with your function abs(object x) return x*((x>0)-(x<0)) end function and yours is faster by about 4%! Congratulations! ;and -) jiri
4. Re: QBasic --> Euphoria (again)
- Posted by "C.K. & Kirsten Lester" <candk at TICNET.COM> Sep 01, 1998
- 595 views
> function abs(object x) > return x*((x>0)-(x<0)) > end function > > yours is faster by about 4%! Congratulations! ;and -) jiri I hope this is the kind of thing that makes it into the FAQ code snippets section. :)
5. Re: QBasic --> Euphoria (again)
- Posted by Jeff Zeitlin <jeff.zeitlin at MAIL.EXECNET.COM> Sep 01, 1998
- 643 views
- Last edited Sep 02, 1998
On Tue, 1 Sep 1998 00:00:10 -0400, Doug Cox <cox.family at SK.SYMPATICO.CA> wrote: >While doing some porting from QBasic to Euphoria, >I came across some commands that I've been unable >to stick into Euphoria. If anyone could offer a Euphoria >equivalent to any of these, it would help a lot. >WINDOW (resizes graphics display) No equivalent. >OUT (sends information to a port, I believe) I believe you would have to write machine code for this. >ABS (gives the ABSolute value of a number) If this isn't one of the built-in math functions, you'll find that compare(x,0) will work just as well. >WAIT (??waits for information from ports??) I believe you would have to write machine code for this. -- Jeff Zeitlin jeff.zeitlin at mail.execnet.com
6. Re: QBasic --> Euphoria (again)
- Posted by Greg Harris <blackdog at CDC.NET> Sep 01, 1998
- 591 views
How about: function abs(atom x) if x < 0 then return -x end if return x end function Regards, Greg Harris HHS -----Original Message----- From: jiri babor <jbabor at PARADISE.NET.NZ> To: EUPHORIA at LISTSERV.MUOHIO.EDU <EUPHORIA at LISTSERV.MUOHIO.EDU> Date: Tuesday, September 01, 1998 9:36 AM Subject: Re: QBasic --> Euphoria (again) >Good one, Carl! I especially like the sign function. > > >I have just compared (over several million cycles) > > function abs(object x) > return -2*x*(x<0)+x > end function > > >with your > >function abs(object x) > return x*((x>0)-(x<0)) >end function > > >and yours is faster by about 4%! Congratulations! ;and -) jiri >
7. Re: QBasic --> Euphoria (again)
- Posted by James Begley <jizim at GEOCITIES.COM> Sep 02, 1998
- 616 views
>> WINDOW (resizes graphics display) I believe that this one would require a separate program-specific function, but as long as it's no problem, you could use graphics_mode... >> OUT (sends information to a port, I believe) Ummm... it'd seem that ports.e would take care of that one. >> WAIT (??waits for information from ports??) either ports.e, or for geniuses like myself (ahem...) you could use DOS interrupts to call MODE and CTTY without using system(). James Begley
8. QBasic --> Euphoria (again)
- Posted by Doug Cox <cox.family at SK.SYMPATICO.CA> Aug 31, 1998
- 585 views
- Last edited Sep 01, 1998
Dear Euphorians, While doing some porting from QBasic to Euphoria, I came across some commands that I've been unable to stick into Euphoria. If anyone could offer a Euphoria equivalent to any of these, it would help a lot. WINDOW (resizes graphics display) OUT (sends information to a port, I believe) ABS (gives the ABSolute value of a number) WAIT (??waits for information from ports??) Thanks! Chris Cox cox.family at sk.sympatico.ca