Home | Notes | Languages | Programs | Homework |
Re: cs 3304 |
Stephen Edwards (edwards@CS.VT.EDU)
Wed, 10 Oct 2001 08:50:11 -0400
Message-ID: <3BC44403.B1A947AC@cs.vt.edu> Date: Wed, 10 Oct 2001 08:50:11 -0400 From: Stephen Edwards <edwards@CS.VT.EDU> Subject: Re: cs 3304
adrian porter asked two excellent questions:
>
> What do we do about idiv and irem by 0?
>
> '(iconst -13 iconst 0 idiv)
> '(iconst -13 iconst 0 irem)
Good question--I have slightly modified the program description on the
web site to add a separate error message for this kind of error.
> Also, what are we supposed to do about the remainder of negative operations?
>
> '(iconst -13 iconst 4 irem ireturn)
Use the Scheme numeric function "remainder" to compute the result of an
irem command. For the above example, (remainder -13 4) returns -1.
-- Steve
-- Stephen Edwards 604 McBryde Hall Dept. of Computer Science e-mail : edwards@cs.vt.edu U.S. mail: Virginia Tech (VPI&SU) office phone: (540)-231-5723 Blacksburg, VA 24061-0106 -------------------------------------------------------------------------------
Home | Notes | Languages | Programs | Homework |