delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/11/16/12:27:06

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
Date: Sun, 16 Nov 2003 17:37:44 +0000
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: math_errhandling [PATCH]
Message-Id: <E1ALR3u-0001WM-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Below is a patch to add math_errhandling to DJGPP. If there are no comments,
I will commit this next weekend.

math_errhandling is only returned with MATH_ERRNO set, since we don't
support raising "exceptions" yet.

Bye, Rich =]

Index: include/math.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/math.h,v
retrieving revision 1.12
diff -p -u -3 -r1.12 math.h
--- include/math.h	16 Nov 2003 10:44:35 -0000	1.12
+++ include/math.h	16 Nov 2003 17:24:43 -0000
@@ -123,6 +123,12 @@ double		nan(const char *);
 float		nanf(const char *);
 long double	nanl(const char *);
 
+#define MATH_ERRNO     1
+#define MATH_ERREXCEPT 2
+
+int __get_math_errhandling (void);
+#define math_errhandling (__get_math_errhandling())
+
 double	acosh(double);
 double	asinh(double);
 double	atanh(double);
Index: src/libc/c99/math/makefile
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/c99/math/makefile,v
retrieving revision 1.4
diff -p -u -3 -r1.4 makefile
--- src/libc/c99/math/makefile	25 Oct 2003 11:22:53 -0000	1.4
+++ src/libc/c99/math/makefile	16 Nov 2003 17:24:43 -0000
@@ -2,6 +2,7 @@
 # Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details
 TOP=../..
 
+SRC += errhandl.c
 SRC += hugevalf.c
 SRC += hugevall.c
 SRC += nan_def.c
Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.163
diff -p -u -3 -r1.163 wc204.txi
--- src/docs/kb/wc204.txi	14 Nov 2003 08:39:53 -0000	1.163
+++ src/docs/kb/wc204.txi	16 Nov 2003 17:24:45 -0000
@@ -1036,3 +1036,7 @@ This means that @code{%T} and @code{%X} 
 @vindex __djgpp_stack_overflow_eip AT r{ added}
 @findex __djgpp_stack_overflow_exit AT r{ added}
 A stack overflow handler was added.
+
+@findex math_errhandling AT r{ added}
+@vindex math_errhandling AT r{ added}
+@code{math_errhandling} was added.
--- /dev/null	2003-11-16 17:36:32.000000000 +0000
+++ src/libc/c99/math/errhandl.c	2003-11-16 17:35:00.000000000 +0000
@@ -0,0 +1,10 @@
+/* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
+#include <math.h>
+
+static int __math_errhandling = MATH_ERRNO;
+
+int
+__get_math_errhandling (void)
+{
+  return __math_errhandling;
+}
--- /dev/null	2003-11-16 17:36:32.000000000 +0000
+++ src/libc/c99/math/errhandl.txh	2003-11-16 17:33:26.000000000 +0000
@@ -0,0 +1,38 @@
+@c ----------------------------------------------------------------------
+@node math_errhandling, math
+@findex math_errhandling
+@vindex math_errhandling
+@subheading Syntax
+
+@example
+#include <math.h>
+@end example
+
+@subheading Description
+
+@code{math_errhandling} evaluates to an integer expression describing
+the floating-point error reporting methods used by the C library.
+
+If @code{math_errhandling} returns the bit @code{MATH_ERRNO} set,
+then errors are reported using @code{errno} (@pxref{errno}).
+
+If @code{math_errhandling} returns the bit @code{MATH_ERREXCEPT} set,
+then errors are reported by raising ``exceptions''.
+
+The library may support both methods of error reporting. Currently
+DJGPP only supports reporting errors using @code{errno}.
+
+@subheading Return Value
+
+Which floating-point error reporting methods are available.
+
+@subheading Portability
+
+@portability ansi-c99, posix-1003.1-2001
+
+@subheading Example
+
+@example
+if (math_errhandling & MATH_ERRNO)
+  perror("myprogram");
+@end example

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019