[racket] "error: degrees->complex: 360.0"

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Mon May 12 21:38:31 EDT 2014

Hi Sean: do you have a program that demonstrates this error that you can
share? That'll let me track down the bug.

Hi Danny: The contracts are checked at the boundary based on the define/chk
macro. This is an internal error somewhere -- angles are not restricted to
being between 0 and 360. I don't suppose you noticed how to make this error
happen?

Robby

On Monday, May 12, 2014, Danny Yoo <dyoo at hashcollision.org> wrote:

> On Mon, May 12, 2014 at 4:11 PM, Sean Kanaley <skanaley at gmail.com> wrote:
> > Hello all,
> >
> > I can't figure this out as I have no function called degrees->complex
> and it
> > occurs only sometimes.  It's always when rotating stuff through the
> positive
> > x axis, as in it's probably related to floating point operations like
> sin or
> > cos near 0 or perhaps integer multiples of 2pi.  So far I believe it has
> > only happened rotating clockwise where the error freezes the program with
> > slightly negative radians displaying (part of my debug output).
> >
> > It's possible it's my own bug with a bad sqrt or using NaN or something,
> but
> > then what does the message mean?
>
>
> You're trying to rotate, but the degrees have to be between 0 and 360
> degrees.
>
>
> http://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._rotate%29%29
>
> Double check your calls to (rotate) and see that the angle is within
> those bounds.
>
> ---
>
> Internal comment: The error message appears to arise deep within
> htdp-lib/2htdp/private/image-more.rkt.  Unfortunately, the contract
> check appears to be done at the private implementation end of things,
> rather than at the public function boundary, so the original
> questioner is not seeing as helpful of an error message as would be
> ideal... Actually, the contract might be wrong.  It says that it has
> to be an angle:
>
>
> http://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._angle~3f%29%29
>
> but angles aren't restricted to 0-360, even though the internal
> implementation really needs it to be within those bounds, according
> to:
>
>
> http://git.racket-lang.org/plt/blob/HEAD:/pkgs/htdp-pkgs/htdp-lib/2htdp/private/image-more.rkt#l794
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140512/d551f591/attachment.html>

Posted on the users mailing list.