[Perldl] Large Number Support?

Clifford Sobchuk clifford.sobchuk at ericsson.com
Fri Feb 10 13:45:21 HST 2012


Thanks Chris. At least now I understand why. I'll start converting to using epoch seconds instead. The module allows reverse calculation - in a manner of speaking. 


CLIFF SOBCHUK
Core RF Engineering
Phone 613-667-1974   ecn: 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com 

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is solely responsible for this email and its contents. All inquiries regarding this email should be addressed to Ericsson. The web site for Ericsson is www.ericsson.com."

This Communication is Confidential. We only send and receive email on the basis of the terms set out at www.ericsson.com/email_disclaimer


-----Original Message-----
From: Chris Marshall [mailto:devel.chm.01 at gmail.com] 
Sent: Friday, February 10, 2012 3:50 PM
To: Clifford Sobchuk
Cc: Perldl at jach.hawaii.edu
Subject: Re: [Perldl] Large Number Support?

I think you are printing two different things.
$mydt is initialized as a string value so you are printing that the first time.

The pdl datatype is double, so you then
print in as a double format.

If you do $mydt += 0 and then print again you'll get the same result as from the pdl since the string used for the print output is generated from the double type numeric value in $mydt.

In fact, if you use Devel::Peek and Dump $mydt before and after you'll see what happens to the internal representation.

--Chris

On Fri, Feb 10, 2012 at 5:08 PM, Clifford Sobchuk <clifford.sobchuk at ericsson.com> wrote:
> Thanks Judd.
>
> That is a good idea. The reason is historical because we often used 
> the timestamp to quickly see which dates we were looking at without 
> plotting. I never thought about changing it to any other means that 
> could be recalculated for plotting.
>
> I don't understand though why Perl prints the whole precision but PDL 
> didn't.
>
> pdl> $mydt= $dt->ymd('').$dt->hms('').".".$dt->millisecond()
>
> pdl> p $mydt
>
> 20120210162751.100
>
> pdl> $mydtpdl=pdl($mydt)
>
> pdl> help $mydtpdl
>
> This variable is Double D [] P 0.01KB
>
> pdl> p $mydtpdl
>
> 20120210162751.1
>
>
>
> Thanks.
>
>
> CLIFF SOBCHUK
> Core RF Engineering
> Phone 613-667-1974   ecn: 8109-71974
> mobile 403-819-9233
> yahoo: sobchuk
> www.ericsson.com
>
> "The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), 
> who is solely responsible for this email and its contents. All 
> inquiries regarding this email should be addressed to Ericsson. The 
> web site for Ericsson is www.ericsson.com."
>
>
>
> This Communication is Confidential. We only send and receive email on 
> the basis of the terms set out at www.ericsson.com/email_disclaimer
>
>
>
> ________________________________
> From: Judd Taylor [mailto:judd.t at orbitalsystems.com]
> Sent: Friday, February 10, 2012 2:02 PM
> To: MARK BAKER; "perldl at jach.hawaii.edu"
>
> Subject: Re: [Perldl] Large Number Support?
>
> Why are you using a serial number format in the first place? It 
> requires more digits than can be expected from a double, and I can 
> think of no mathematical advantage of using this over a decimal epoch 
> format (which is seconds from 1970, with milisec precision).
>
> It's not like doing date1 + date2 in the serialized version is going 
> to make any sense. If it were me, I'd just convert to the unix epoch 
> with milisecs before putting it into the piddle variable. Then you 
> have the advantage of
> date1 + date2, etc making sense.
>
> -Judd
>
> ____________________________
> Judd Taylor
> Software Engineer
>
> Orbital Systems, Ltd.
> 3807 Carbon Rd.
> Irving, TX 75038-3415
>
> judd.t at orbitalsystems.com
> (972) 915-3669 x127
> ________________________________
> From: MARK BAKER [mrbaker_mark at yahoo.com]
> Sent: Friday, February 10, 2012 11:29 AM
> To: "perldl at jach.hawaii.edu"
> Subject: Re: [Perldl] Large Number Support?
>
> Im having the same problem
> where my piddle gets clobbered
>
> pdl> $a = pdl(34758935747354930567354689735940673659406798345);
> pdl> p $a;
> 3.47589357473549e+046
>
> and it clobbers it even if i use a string method
>
> pdl> $a = pdl('34758935747354930567354689735940673659406798345');
> pdl> p $a;
> 3.47589357473549e+046
>
> is there any way to save the precision here and still use this matrix ?
>
> Thanks & Cheers
>
> -Mark R Baker
> mrbaker_mark at yahoo.com
>
> ________________________________
> From: Joel Berger <joel.a.berger at gmail.com>
> To: Chris Marshall <devel.chm.01 at gmail.com>
> Cc: "perldl at jach.hawaii.edu" <perldl at jach.hawaii.edu>
> Sent: Friday, February 10, 2012 7:21 AM
> Subject: Re: [Perldl] Large Number Support?
>
> I'm not sure how it interoperates with PDL (in fact I would guess it
> can't) but if you need more digits you can look at bignum
> (http://p3rl.org/bignum) which has been core since 5.8. Internally it 
> uses different classes for Int Float etc, but on the surface are used 
> like any other number in Perl (again probably not PDL).
>
> On Fri, Feb 10, 2012 at 7:54 AM, Chris Marshall 
> <devel.chm.01 at gmail.com>
> wrote:
>> I think the problem is you are trying to use more significant digits 
>> than can be represented by IEEE double precision: about 15.95 decimal 
>> digits while your time values are 17 digits.  You can either bias 
>> your dates (maybe starting from 2000, e.g., 2000+xx so 2012->12) or 
>> use a 64bit integer type.
>>
>> --Chris
>>
>> On Fri, Feb 10, 2012 at 6:32 AM, chm <devel.chm.01 at gmail.com> wrote:
>>> Hi Cliff-
>>>
>>> Do you have a program showing the problem with some input data?  
>>> What data type are the piddles?  (help $mypdl in the shell)
>>>
>>> As for the output from the 'p' command for a piddle, you're looking 
>>> at some format conversion of some pdl type and not the raw data.  
>>> See PDL::Core for info on the current format.
>>>
>>> Also, you might see if the example you show for the PDL shell gives 
>>> the same output for the debugger session.
>>>
>>> --Chris
>>>
>>> P.S. Could you please wrap your text to
>>> 72 characters so that the list archives are readable as paragraphs.  
>>> I.e., for this post:
>>>
>>>
>>>  
>>> http://mailman.jach.hawaii.edu/pipermail/perldl/2012-February/006432
>>> .html
>>>
>>> There appear to be problems with mac mail that result in this 
>>> happening.  No solution other than hand folding/wrapping was found.
>>>
>>>
>>>
>>> On 2/9/2012 10:49 PM, Clifford Sobchuk wrote:
>>>>
>>>>
>>>> Hi folks,
>>>>
>>>> I ran into a problem - or an effect, that I don't understand. There 
>>>> seems to be a number that is too big to be displayed. See the 
>>>> following code:
>>>>
>>>> pdl>  p 2**40 1099511627776
>>>>
>>>> pdl>  p 2**32*1.00001 4295010245.67296
>>>>
>>>> pdl>  p 2**36*1.00001 68720163930.7674
>>>>
>>>> pdl>  p 2**38*1.00001 274880655723.069
>>>>
>>>> My problem is that I am using a serialized value for the date and 
>>>> time - to millisecond precision. So the following represents :
>>>> YYYYMMDDHHMMSS.msmsms
>>>>
>>>> DB<33>  p ${$myData{MC800BTS1494}{1}{1}{time}}[0] 
>>>> 20120206201813.220
>>>>
>>>> DB<34>  p ${$myData{MC800BTS1494}{1}{1}{time}}[1] 
>>>> 20120206201813.320
>>>>
>>>> DB<35>  p ${$myData{MC800BTS1494}{1}{1}{time}}[2] 
>>>> 20120206201813.420
>>>>
>>>> DB<36>  p ${$myData{MC800BTS1494}{1}{1}{time}}[4] 
>>>> 20120206201813.620
>>>>
>>>> You'll notice that there are two more digits displayed when they 
>>>> are in Perl but after I convert them into a PDL, I lose the last 
>>>> two digits. I didn't think that this was considered a BigFloat?
>>>>
>>>> Any thoughts. Thanks,
>>>>
>>>>
>>>> CLIFF SOBCHUK Ericsson Core RF Engineering Calgary, AB, Canada 
>>>> Phone
>>>> 613-667-1974  ECN 8109 x71974 Mobile 403-819-9233 
>>>> clifford.sobchuk at ericsson.com<mailto:clifford.sobchuk at ericsson.com>
>>>>
>>>> yahoo: sobchuk http://www.ericsson.com/
>>>>
>>>> "The author works for Telefonaktiebolaget L M Ericsson 
>>>> ("Ericsson"), who is solely responsible for this email and its 
>>>> contents. All inquiries regarding this email should be addressed to 
>>>> Ericsson. The web site for Ericsson is www.ericsson.com."
>>>>
>>>> This Communication is Confidential. We only send and receive email 
>>>> on the basis of the terms set out at
>>>>
>>>>
>>>> www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_dis
>>>> claimer>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________ Perldl mailing list 
>>>> Perldl at jach.hawaii.edu 
>>>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>>>
>>>
>>
>> _______________________________________________
>> Perldl mailing list
>> Perldl at jach.hawaii.edu
>> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
> _______________________________________________
> Perldl mailing list
> Perldl at jach.hawaii.edu
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>
>
>
> _______________________________________________
> Perldl mailing list
> Perldl at jach.hawaii.edu
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
>




More information about the Perldl mailing list