Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bug in PadLeft/PadRight

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108964] Bug in PadLeft/PadRight
  • From: dh <dh at metrohm.com>
  • Date: Thu, 8 Apr 2010 08:03:02 -0400 (EDT)

Hello,
hope I am not fooling myself, but there seems to be a problem with 
padding. PadLeft/PadRight seem to work as expected when used alone. 
However if we use them sequentially there seems to be some unwanted effects.
Consider:

npad = 1;
d = d0 = {x1, x2, x3, x4};
d = PadLeft[d, npad + Length[d], d0]
d = PadRight[d, npad + Length[d], d0]

For npad=1 padding on the right does not start with the first element of 
d0, but with the second one.
For npad=2, padding starts with the third element, e.t.c.
If we eliminate the PadLeft, PadRight works as expected.
cheers, Daniel
-- 

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>



  • Prev by Date: Estimating memory usage of expressions
  • Next by Date: Branching on error messages?
  • Previous by thread: Re: Estimating memory usage of expressions
  • Next by thread: Re: Bug in PadLeft/PadRight