octave-maintainers
[Top][All Lists]
Advanced

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

Re: Help with linspace


From: Joel Dahne
Subject: Re: Help with linspace
Date: Sat, 6 Jan 2018 17:04:55 +0000

Ben Abbott writes:

>> On Jan 6, 2018, at 7:23 AM, Rik <address@hidden> wrote:
>>
>> Could someone with access to Matlab try the following?
>>
>> linspace(-0, 0, 5)
>>
>> Octave returns
>>
>> ans =
>>
>>   -0   0   0   0   0
>>
>> which is pretty silly unless it is required for compatibility.
>>
>> —Rik
>
> 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

Joel

reply via email to

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