[prev in list] [next in list] [prev in thread] [next in thread] 

List:       coreutils
Subject:    Re: pr: floating-point error
From:       Ondrej Oprala <ooprala () redhat ! com>
Date:       2012-10-25 7:52:55
Message-ID: 5088EFD7.1070609 () redhat ! com
[Download RAW message or body]

On 10/24/2012 11:58 PM, Pádraig Brady wrote:
> On 10/24/2012 10:26 AM, Pádraig Brady wrote:
>> On 10/24/2012 09:03 AM, Ondrej Oprala wrote:
>>> Hello,
>>> one of our customers made a bug report, stating that pr -nNUM FILE
>>> causes a floating point exception if NUM >= 32
>>> and I would really like to hear your opinion on how to solve this.
>>> The easiest solution would be to document the <32 limit for the -n 
>>> option.
>>> The more difficult one would be to support numbers of arbitrary length.
>>> I was thinking about the second solution and  AFAIK the line number 
>>> is not
>>> used in any arithmetic (apart from incrementation), so it could be 
>>> represented as
>>> an array of digits, with a function incrementing the array from the 
>>> rightmost element
>>> as needed. Then we would just print out the array one element at a 
>>> time. It would
>>> probably cause a performance penalty though.
>>> Thanks in advance for any advice or suggestions.
>>
>> Ouch. Confirmed that this dumps core:
>>
>>    echo . | pr -T -n.32
>>
>> We can fix that up with something like the following.
>> I'll add a test and commit.
>
> Complete proposed patch is attached.
>
> thanks,
> Pádraig.
Thanks, the patch looks great. You're also right about the leading zeros
patch, this one makes it redundant.
thanks,
Ondrej



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic