diff src/mappers.cc @ 4524:fd95dc5e6f28

[project @ 2003-10-02 03:14:48 by jwe]
author jwe
date Thu, 02 Oct 2003 03:14:48 +0000
parents 363d406ec86c
children 7849788ca4bd
line wrap: on
line diff
--- a/src/mappers.cc	Thu Oct 02 01:18:22 2003 +0000
+++ b/src/mappers.cc	Thu Oct 02 03:14:48 2003 +0000
@@ -27,6 +27,7 @@
 #include <cctype>
 #include <cfloat>
 
+#include "lo-ieee.h"
 #include "lo-specfun.h"
 #include "lo-mappers.h"
 
@@ -134,6 +135,12 @@
   return toupper (c);
 }
 
+static double
+xabs (const Complex& x)
+{
+  return (xisinf (x.real ()) || xisinf (x.imag ())) ? octave_Inf : abs (x);
+}
+
 static Complex
 xconj (const Complex& x)
 {
@@ -161,7 +168,7 @@
 void
 install_mapper_functions (void)
 {
-  DEFUN_MAPPER (abs, xabs, 0, 0, fabs, abs, 0, 0.0, 0.0, 1, 0,
+  DEFUN_MAPPER (abs, xabs, 0, 0, fabs, xabs, 0, 0.0, 0.0, 1, 0,
     "-*- texinfo -*-\n\
 @deftypefn {Mapping Function} {} abs (@var{z})\n\
 Compute the magnitude of @var{z}, defined as\n\