Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Maybe I'm just dumb...

by Evanovich (Scribe)
on May 16, 2003 at 04:30 UTC ( [id://258581]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://258581]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-24 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found