in reply to Debugging a sort in PDL routine

Folks. I figured out the problem, but I can't figure out why it would give me an error. If I don't take the acos of $d, and just multiply (180/3.14159)*$d, then I can sort normally. Can anyone explain to me why the acos() function would be screwing up my sort?

Replies are listed 'Best First'.
Re: Re: Maybe I'm just dumb...
by Enlil (Parson) on May 16, 2003 at 05:25 UTC
    Try this:
    use Math::Cephes qw/acos/; for ( -2, -1.1, -1, 0, 1, 1.1, 2 ) { print acos($_),$/; }
    I expect you are getting something similar (i.e. #QNAN), as I am guessing some of the values $d are outside the domain of the "Real" solutions of acos.

    -enlil

Re: Re: Maybe I'm just dumb...
by belg4mit (Prior) on May 16, 2003 at 05:26 UTC
    Can't acos return undef (for invalid input)?

    --
    I'm not belgian but I play one on TV.

Re: Re: Maybe I'm just dumb...
by SparkeyG (Curate) on May 17, 2003 at 00:41 UTC
    Just a thought, but is $dotproduct a PDL? If so, using acos should screw things up. But it's been a while since I used PDL.