+++ /dev/null
-/* $NetBSD: ulp.c,v 1.2 2006/01/25 15:27:42 kleink Exp $ */\r
-\r
-/****************************************************************\r
-\r
-The author of this software is David M. Gay.\r
-\r
-Copyright (C) 1998, 1999 by Lucent Technologies\r
-All Rights Reserved\r
-\r
-Permission to use, copy, modify, and distribute this software and\r
-its documentation for any purpose and without fee is hereby\r
-granted, provided that the above copyright notice appear in all\r
-copies and that both that the copyright notice and this\r
-permission notice and warranty disclaimer appear in supporting\r
-documentation, and that the name of Lucent or any of its entities\r
-not be used in advertising or publicity pertaining to\r
-distribution of the software without specific, written prior\r
-permission.\r
-\r
-LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,\r
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.\r
-IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY\r
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\r
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER\r
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\r
-THIS SOFTWARE.\r
-\r
-****************************************************************/\r
-\r
-/* Please send bug reports to David M. Gay (dmg at acm dot org,\r
- * with " at " changed at "@" and " dot " changed to "."). */\r
-#include <LibConfig.h>\r
-\r
-#include "gdtoaimp.h"\r
-\r
- double\r
-ulp\r
-#ifdef KR_headers\r
- (x) double x;\r
-#else\r
- (double x)\r
-#endif\r
-{\r
- Long L;\r
- double a;\r
-\r
- L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;\r
-#ifndef Sudden_Underflow\r
- if (L > 0) {\r
-#endif\r
-#ifdef IBM\r
- L |= Exp_msk1 >> 4;\r
-#endif\r
- word0(a) = (UINT32)L;\r
- word1(a) = 0;\r
-#ifndef Sudden_Underflow\r
- }\r
- else {\r
- L = (unsigned int)-L >> Exp_shift;\r
- if (L < Exp_shift) {\r
- word0(a) = 0x80000 >> L;\r
- word1(a) = 0;\r
- }\r
- else {\r
- word0(a) = 0;\r
- L -= Exp_shift;\r
- word1(a) = L >= 31 ? 1 : 1 << (31 - L);\r
- }\r
- }\r
-#endif\r
- return a;\r
- }\r