----- Original Message ----- 
From: "Douglas Hunt" <[email protected]>
To: "Sisyphus" <[email protected]>
Cc: <[email protected]>; "PLplot development list" 
<[email protected]>
Sent: Saturday, December 13, 2008 5:41 PM
Subject: Re: [Perldl] Troubling PDL behavior with constants


> Hi Rob:  I'm sure that changing to GenericTypes = ['D', 'F'] fixes the 
> problem on my 32 bit Linux machine.
>
> If you saw different behavior, perhaps it was on a Windows box?

I've checked, and the behaviour I saw was definitely different. It was a 
Windows box .... but I also get the same on linux.

With "GenericTypes => ['F', 'D']," I get:

#####################################
C:\>perl -MPDL -le "print acos(-1)"
3.14159265358979

C:\>perl -MPDL -le "print acos(double(-1))"
3.14159265358979

C:\>perl -MPDL -le "print acos(float(-1))"
3.14159274101257

C:\>perl -MPDL -le "print acos(-1.0)"
3.14159274101257

C:\>perl -MPDL -le "print acos(-1.)"
3.14159274101257
#####################################

With "GenericTypes => ['D', 'F']," I get:

#####################################
C:\>perl -Mblib -MPDL -le "print acos(-1)"
3.14159274101257

C:\>perl -Mblib -MPDL -le "print acos(double(-1))"
3.14159265358979

C:\>perl -Mblib -MPDL -le "print acos(float(-1))"
3.14159274101257

C:\>perl -MPDL -le "print acos(-1.0)"
3.14159274101257

C:\>perl -MPDL -le "print acos(-1.)"
3.14159274101257
#####################################

With "GenericTypes => ['D']," I get:

#####################################
C:\>perl -Mblib -MPDL -le "print acos(-1)"
3.14159274101259

C:\>perl -Mblib -MPDL -le "print acos(double(-1))"
3.14159265358979

C:\>perl -Mblib -MPDL -le "print acos(float(-1))"
3.14159274101259

C:\>perl -Mblib -MPDL -le "print acos(-1.0)"
3.14159274101259

C:\>perl -Mblib -MPDL -le "print acos(-1.)"
3.14159274101259
#####################################

Each have their slightly different problems regarding dwim.
The only difference I can see between ['F', 'D'] and ['D', 'F'] is the value 
for acos(-1). The other values remain unchanged.

It gets even more confusing. For example, asinh(1.25) returns a float value, 
whereas asinh(1.26) returns a double value. I assume this happens because 
'1.25' doesn't suffer any loss of precision when represented as a float - 
but the same is not true for '1.26'.

I don't have a solution for any of this ... except for the user to actually 
specify what he wants (ie 'float', 'double', whatever).

Cheers,
Rob 


_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to