octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with linspace


From: michele
Subject: Re: Help with linspace
Date: Sat, 6 Jan 2018 20:00:30 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 01/06/2018 07:20 PM, Daniel J Sebald wrote:
On 01/06/2018 11:04 AM, Joel Dahne wrote:
Ben Abbott writes:

[snip]
Using R2016a ...

linspace(-0, 0, 5)

ans =

      0     0     0     0     0

Ben

Matlab does not show the sign of 0. In fact it does indeed return [-0,
0, 0, 0, 0]. An easy way to check is

1./(linspace(-0, 0, 5))

ans =

   -Inf   Inf   Inf   Inf   Inf

Nice manner of testing...  Consider adding this to the list of linspace compatibility tests in data.cc:

Dan


Actually, on Matlab R2017b

>> linspace(-0, 0, 5)

ans =

     0     0     0     0     0

>> 1./linspace(-0, 0, 5)

ans =

  -Inf  -Inf  -Inf  -Inf  -Inf

and

>> linspace(0, -0, 5)

ans =

     0     0     0     0     0

>> 1./linspace(0, -0, 5)

ans =

   Inf   Inf   Inf   Inf   Inf

--
Michele Ginesi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]