octave-maintainers
[Top][All Lists]
Advanced

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

Re: Help with rat()


From: Rik
Subject: Re: Help with rat()
Date: Thu, 6 Dec 2018 09:11:56 -0800

On 12/06/2018 09:07 AM, CROZIER Richard wrote:
>
> On 06/12/2018 17:05, Rik wrote:
>> On 12/06/2018 08:49 AM, CROZIER Richard wrote:
>>> R2018b:
>>>
>>>   >> s = rat ([Inf 0 1 1/2])
>>> size (s)
>>>
>>> s =
>>>
>>>     4×10 char array
>>>
>>>       'Inf       '
>>>       '0         '
>>>       '1         '
>>>       '1 + 1/(-2)'
>>>
>>>
>>> ans =
>>>
>>>        4.0000e+000    10.0000e+000
>>>
>>>
>>>
>>> On 06/12/2018 16:46, Rik wrote:
>>>> Could someone run the following test under Matlab?
>>>>
>>>> s = rat ([Inf 0 1 1/2])
>>>> size (s)
>>>>
>>>> Thanks,
>>>> Rik
>>>>
>>>>
>> Richard,
>>
>> Could you try this as well?  I'm surprised that they don't return "1/0" for
>> Inf.
>>
>> rats (Inf)
>>
>> --Rik
>>
> here you go (sorry I forgot to bottom post last time
>
>  >> rats (Inf)
>
> ans =
>
>      '      1/0     '
>

Thanks.  This makes sense to me.  I am re-coding rat.m and I think I am
going to make it consistent with rats() and "format rat" so that it returns
"1/0" for Inf.

While checking this, I see that Octave returns "1/0" for "rats (-Inf)". 
Doesn't that seem odd?  Shouldn't it be "-1/0"?  If so, maybe I'll file a
bug report about that.

--Rik




reply via email to

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