1104862Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2001 Free Software Foundation, Inc. 275584Sru Written by James Clark (jjc@jclark.com) 375584Sru 475584SruThis file is part of groff. 575584Sru 675584Srugroff is free software; you can redistribute it and/or modify it under 775584Sruthe terms of the GNU General Public License as published by the Free 875584SruSoftware Foundation; either version 2, or (at your option) any later 975584Sruversion. 1075584Sru 1175584Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY 1275584SruWARRANTY; without even the implied warranty of MERCHANTABILITY or 1375584SruFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1475584Srufor more details. 1575584Sru 1675584SruYou should have received a copy of the GNU General Public License along 1775584Sruwith groff; see the file COPYING. If not, write to the Free Software 18151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */ 1975584Sru 20104862Sru#ifdef HAVE_CONFIG_H 21104862Sru#include <config.h> 22104862Sru#endif 23104862Sru 2475584Sru#include <math.h> 2575584Sru#include <errno.h> 2675584Sru 2775584Sru#ifdef HAVE_STRUCT_EXCEPTION 2875584Sru#ifdef TLOSS 2975584Sru 3075584Sruint matherr(exc) 3175584Srustruct exception *exc; 3275584Sru{ 3375584Sru switch (exc->type) { 3475584Sru case SING: 3575584Sru case DOMAIN: 3675584Sru errno = EDOM; 3775584Sru break; 3875584Sru case OVERFLOW: 3975584Sru case UNDERFLOW: 4075584Sru case TLOSS: 4175584Sru case PLOSS: 4275584Sru errno = ERANGE; 4375584Sru break; 4475584Sru } 4575584Sru return 1; 4675584Sru} 4775584Sru 4875584Sru#endif /* TLOSS */ 4975584Sru#endif /* HAVE_STRUCT_EXCEPTION */ 50