1 /* $NetBSD: setovfl.c,v 1.1 2002/06/05 01:04:26 fredette Exp $ */ 2 3 /* $OpenBSD: setovfl.c,v 1.4 2001/03/29 03:58:19 mickey Exp $ */ 4 5 /* 6 * Copyright 1996 1995 by Open Software Foundation, Inc. 7 * All Rights Reserved 8 * 9 * Permission to use, copy, modify, and distribute this software and 10 * its documentation for any purpose and without fee is hereby granted, 11 * provided that the above copyright notice appears in all copies and 12 * that both the copyright notice and this permission notice appear in 13 * supporting documentation. 14 * 15 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 16 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 17 * FOR A PARTICULAR PURPOSE. 18 * 19 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 21 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 22 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 23 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 24 * 25 */ 26 /* 27 * pmk1.1 28 */ 29 /* 30 * (c) Copyright 1986 HEWLETT-PACKARD COMPANY 31 * 32 * To anyone who acknowledges that this file is provided "AS IS" 33 * without any express or implied warranty: 34 * permission to use, copy, modify, and distribute this file 35 * for any purpose is hereby granted without fee, provided that 36 * the above copyright notice and this notice appears in all 37 * copies, and that the name of Hewlett-Packard Company not be 38 * used in advertising or publicity pertaining to distribution 39 * of the software without specific, written prior permission. 40 * Hewlett-Packard Company makes no representations about the 41 * suitability of this software for any purpose. 42 */ 43 44 45 #include "../spmath/float.h" 46 #include "../spmath/sgl_float.h" 47 #include "../spmath/dbl_float.h" 48 49 sgl_floating_point sgl_setoverflow(sign) 50 51 unsigned int sign; 52 { 53 sgl_floating_point result; 54 55 /* set result to infinity or largest number */ 56 /* ignore for now 57 switch (Rounding_mode()) { 58 case ROUNDPLUS: 59 if (sign) { 60 Sgl_setlargestnegative(result); 61 } 62 else { 63 Sgl_setinfinitypositive(result); 64 } 65 break; 66 case ROUNDMINUS: 67 if (sign==0) { 68 Sgl_setlargestpositive(result); 69 } 70 else { 71 Sgl_setinfinitynegative(result); 72 } 73 break; 74 case ROUNDNEAREST: 75 Sgl_setinfinity(result,sign); 76 break; 77 case ROUNDZERO: 78 Sgl_setlargest(result,sign); 79 } 80 */ 81 return(result); 82 } 83 84 dbl_floating_point dbl_setoverflow(sign) 85 86 unsigned int sign; 87 { 88 dbl_floating_point result; 89 90 /* set result to infinity or largest number */ 91 /* ignore for now 92 switch (Rounding_mode()) { 93 case ROUNDPLUS: 94 if (sign) { 95 Dbl_setlargestnegative(result); 96 } 97 else { 98 Dbl_setinfinitypositive(result); 99 } 100 break; 101 case ROUNDMINUS: 102 if (sign==0) { 103 Dbl_setlargestpositive(result); 104 } 105 else { 106 Dbl_setinfinitynegative(result); 107 } 108 break; 109 case ROUNDNEAREST: 110 Dbl_setinfinity(result,sign); 111 break; 112 case ROUNDZERO: 113 Dbl_setlargest(result,sign); 114 } 115 */ 116 return(result); 117 } 118