octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #55232] Inconsistent warning of acot, acotd, .


From: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #55232] Inconsistent warning of acot, acotd, ... for scalar and vector input.
Date: Sat, 15 Dec 2018 18:19:34 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?55232>

                 Summary: Inconsistent warning of acot, acotd, ... for scalar
and vector input.
                 Project: GNU Octave
            Submitted by: siko1056
            Submitted on: Sun 16 Dec 2018 12:19:33 AM CET
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: Need Info
             Assigned to: siko1056
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55232>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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