octave-maintainers
[Top][All Lists]
Advanced

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

Re: 2.9.11?


From: John W. Eaton
Subject: Re: 2.9.11?
Date: Thu, 19 Apr 2007 15:47:02 -0400

On 19-Apr-2007, Daniel J Sebald wrote:

| Daniel J Sebald wrote:
| 
| > The only other unusual results are the scripts/elfun/acscd.m and asecd.m 
| > tests with the division by zero problem that hangs.

So it is the function asecd.m and acscd.m that have problems?  Then I
would thing that it is really asin and acos that have problems because
the others are just .m files.

| On this one, I'm trying to follow the code but I've gotten lost at the point 
of:
| 
| #define XDEFUN_MAPPER_INTERNAL(name, ch_map, d_b_map, c_b_map, d_d_map, \
|                              d_c_map, c_c_map, lo, hi, \
|                              ch_map_flag, can_ret_cmplx_for_real, doc)
| 
| 
| How are these general trigonometric routines defined?  The standard C/C++ 
math 
| functions are real input (i.e., float), whereas Octave is complex.  So is it 
| Octave implementing the complex version, or is it an additional library?

Look in src/mappers.cc.  There you'll find

  DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 0, 1,
    "-*- texinfo -*-\n\
@deftypefn {Mapping Function} {} asin (@var{x})\n\
Compute the inverse sine of each element of @var{x}.\n\
@end deftypefn");

So along with the comments in defun.h where DEFUN_MAPPER is defined,
this means that there are two versions of asin defined:

//   d_d_map is a pointer to a function that should be called for real
//     arguments that are expected to create real results.
//
//   c_c_map is a pointer to a function that should be called for
//     complex arguments that are expected to create complex results.

The complex versions of asin and acos come from
liboctave/lo-mappers.cc.  Their definitions are:

  Complex
  acosh (const Complex& x)
  {
    return log (x + sqrt (x*x - 1.0));
  }

  Complex
  asin (const Complex& x)
  {
    static Complex i (0, 1);

    return -i * log (i*x + sqrt (1.0 - x*x));
  }


jwe


reply via email to

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