bugGNU Octave - Bugs: bug #55232, Inconsistent warning of acot,...

 
 

bug #55232: Inconsistent warning of acot, acotd, ... for scalar and vector input.

Submitter:  Kai Torben Ohlhus <siko1056>
Submitted:  Sat 15 Dec 2018 11:19:33 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Duplicate Assigned to:  siko1056
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 16 Dec 2018 10:26:15 PM UTC, comment #2: 

Thanks for pointing me to bug #46650 Rik. I thought it was a bigger issue.

I am fine with waiting for the 5.0 release.  In the meantime I will have to disable "Octave:divide-by-zero" in my octaverc.

Kai Torben Ohlhus <siko1056>
Group Member
Sun 16 Dec 2018 03:05:45 PM UTC, comment #1: 

This is actually a deeper issue with the division by zero warning which is different between scalars and vectors.  See bug #46650.

The decision there was that Octave would remove the division by zero warning.  In fact, that is one of the first things that I want to see happen on the development branch once 5.0 is shipped.

For now, I am marking this as a duplicate of #46650 and closing.

Rik <rik5>
Group administrator
Sat 15 Dec 2018 11:19:33 PM UTC, original submission:  

Octave is inconsistent with scalar and vector input, as shown below:


>> acot (0)
warning: division by zero
warning: called from
    acot at line 40 column 5
ans =  1.5708
>> acot ([0 0])
ans =

   1.5708   1.5708


Affected functions are:

  • acosd
  • acot
  • acotd
  • acoth
  • acsc
  • acsch
  • asec
  • asech
  • cot
  • cotd
  • coth
  • csc
  • cscd
  • csch
  • sec
  • secd


All implementations are pretty simple one-liners, just like:


function y = acot (x)
  y = atan (1 ./ x);
endfunction


As possible workarounds I see three possibilities:

1. Check for scalar input and bad values. (quite fast, easy implementation, bad for periodic roots, i.e. '1./sin(x)')


  ## FIXME: Workaround to avoid inconsistent warning "Octave:divide-by-zero"
  ##        for scalar 0 input.
  if (isscalar (x) && x == 0)
    y = pi / 2;
    return;
  endif


2. Move all "elfun"s to

https://hg.savannah.gnu.org/hgweb/octave/file/a957e0da8613/libinterp/corefcn/mappers.cc

as C++ implementation to obtain control about warnings, etc.  This might also speed up Octave in general.

I favor the second option.

Kai Torben Ohlhus <siko1056>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by siko1056 (Submitted the item)
  • -email is unavailable- added by siko1056
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-16 rik5 StatusNeed Info Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #46650
    2018-12-15 siko1056 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code