

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

Administrator

> On Jan 6, 2018, at 7:23 AM, Rik < [hidden email]> 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


Ben Abbott writes:
>> On Jan 6, 2018, at 7:23 AM, Rik < [hidden email]> 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


On 01/06/2018 07:56 AM, Ben Abbott wrote:
>> On Jan 6, 2018, at 7:23 AM, Rik < [hidden email]> 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
>
>
>
Okay, silly, but overruled.
Rik


On 01/06/2018 05:44 PM, Rik wrote:
On 01/06/2018 07:56 AM, Ben Abbott wrote:
On Jan 6, 2018, at 7:23 AM, Rik [hidden email] 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
Okay, silly, but overruled.
Rik
Right! Pretty cute of Matlab to hide the 


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


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

Administrator

On 01/06/2018 02:00 PM, michele wrote:
> >> 1./linspace(0, 0, 5)
>
> ans =
>
> Inf Inf Inf Inf Inf
I guess it's an optimization of sorts. It also seems pretty funny
because I think the final value is normally set to be the one given as
the end point. Though I guess not in this case now.
jwe


On 01/06/2018 10:20 AM, 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:
Done. See http://hg.savannah.gnu.org/hgweb/octave/rev/22a2bc91cc7f.
Rik

