[Perldl] Large Number Support?

Clifford Sobchuk clifford.sobchuk at ericsson.com
Fri Feb 10 06:44:31 HST 2012


The code snippet is that I create a data structure that has an array of time values in Perl:
=======>>>>>>
push (@{$data{$L1}{$L2}{$L3}{time}},($dt->ymd('').$dt->hms('').".".$dt->millisecond())
<<<<<<======
I then unwind the hash per L1/2/3 and grab the appropriate time array in to a pdl:
=======>>>>>>
$time=pdl(@{$data{$L1}{$L2}{$L3}{time}})
<<<<<<======
And then use wcols to write it to a file:
=======>>>>>>
wcols $time,$att1,$att2,$att3, *OUT, {HEADER => "#Time\tAtt1\tAtt2\tAtt3"};
<<<<<<======
I have not tried running the script live while printing out the time values directly, but I would expect that it is the same as in the pdl2 shell as below.

I am using the DateTime module as below.
=======>>>>>>
pdl> use DateTime
pdl> $dt=DateTime->now
pdl> $mydt= $dt->ymd.$dt->hms.".".$dt->millisecond()
pdl> $dt=DateTime->now->add(nanoseconds=>100*1e6)
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
<<<<<<======
Apologize for the non-wrap. I think I correctly adjusted my options, previously it was set to wrap at 76 when sending to internet addresses. The config said for RTF to plain text conversion, I hope it works correctly when it is already in plain text.

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: chm [mailto:devel.chm.01 at gmail.com] 
Sent: Friday, February 10, 2012 4:33 AM
To: Clifford Sobchuk
Cc: perldl at jach.hawaii.edu
Subject: Re: [Perldl] Large Number Support?

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_discla
> imer>
>
>
>
>
>
>
> _______________________________________________ Perldl mailing list 
> Perldl at jach.hawaii.edu 
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl





More information about the Perldl mailing list