[Top][All Lists]

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

[Octave-bug-tracker] [bug #57870] mod doesn't accept char or logical inp

From: Rik
Subject: [Octave-bug-tracker] [bug #57870] mod doesn't accept char or logical inputs (Matlab compatibility)
Date: Fri, 21 Feb 2020 11:02:52 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Update of bug #57870 (project octave):

                Category:                    None => Octave Function        
                Severity:              3 - Normal => 1 - Wish               
                Priority:              5 - Normal => 1 - Later              
              Item Group:                    None => Feature Request        
                  Status:                    None => Confirmed              
                 Summary:  mod won't accept bools => mod doesn't accept char
or logical inputs (Matlab compatibility)


Follow-up Comment #1:

Yes, this is true.  But, I'm not sure it's all that useful.

A logical matrix can only take the values of 0 and 1.  Hence, there is never
any need to check for non-integers.  And using isbool() or islogical() is a
much faster test then mod() because it only checks the matrix type, rather
than performing any floating point math.

If you really want to use mod with booleans there are workarounds.  You can
cast your input to double as you demonstrated.

The same thing holds for char matrices.

mod ('A', 1)
error: mod: wrong type argument 'sq_string'

I re-titled the bug report to mention that both char and logical inputs are
not accepted by mod.  However, because there is an easy workaround, and a
better choice not to use mod at all, I've lowered the priority.


Reply to this item at:


  Message sent via Savannah

reply via email to

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