in reply to Re: Using PDL for rotations
in thread Using PDL for rotations

Okay one more question, upon doing rotations perl some times returns infitesmaly small numbers instead of zero (where it should be zero, as I check them my-self). Is there a simple way to have perl return them zero by changing precision somehow? Thanks...

Replies are listed 'Best First'.
Re^3: Using PDL for rotations
by plobsing (Friar) on Apr 29, 2008 at 20:23 UTC
    Floating-point math can get ugly little rounding errors. You're seeing them here.

    No need to set any precision, simply make sure the magnitude of the values are above some $eps (epsilon) or set them to zero.

    Like so:  $pdl = $pdl * ( (abs $pdl) > $eps);