quad_float.h revision 1.1
1/* 2 * Copyright 1996 1995 by Open Software Foundation, Inc. 3 * All Rights Reserved 4 * 5 * Permission to use, copy, modify, and distribute this software and 6 * its documentation for any purpose and without fee is hereby granted, 7 * provided that the above copyright notice appears in all copies and 8 * that both the copyright notice and this permission notice appear in 9 * supporting documentation. 10 * 11 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 12 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 * FOR A PARTICULAR PURPOSE. 14 * 15 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 16 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 17 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 18 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 19 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 * 21 */ 22/* 23 * pmk1.1 24 */ 25/* 26 * (c) Copyright 1986 HEWLETT-PACKARD COMPANY 27 * 28 * To anyone who acknowledges that this file is provided "AS IS" 29 * without any express or implied warranty: 30 * permission to use, copy, modify, and distribute this file 31 * for any purpose is hereby granted without fee, provided that 32 * the above copyright notice and this notice appears in all 33 * copies, and that the name of Hewlett-Packard Company not be 34 * used in advertising or publicity pertaining to distribution 35 * of the software without specific, written prior permission. 36 * Hewlett-Packard Company makes no representations about the 37 * suitability of this software for any purpose. 38 */ 39/* 40 * @(#)quad_float.h: $Revision: 1.1 $ $Date: 1998/06/23 20:34:05 $ 41 * $Locker: $ 42 * 43 */ 44/****************************** 45 * Quad precision functions * 46 ******************************/ 47 48/* 32-bit word grabing functions */ 49#define Quad_firstword(value) Qallp1(value) 50#define Quad_secondword(value) Qallp2(value) 51#define Quad_thirdword(value) Qallp3(value) 52#define Quad_fourthword(value) Qallp4(value) 53 54 55/* This magnitude comparison uses the signless first words and 56 * the regular part2 words. The comparison is graphically: 57 * 58 * 1st greater? ----------->| 59 * | 60 * 1st less?-----------------+------->| 61 * | | 62 * 2nd greater?------------->| | 63 * | | 64 * 2nd less?-----------------+------->| 65 * | | 66 * 3rd greater?------------->| | 67 * | | 68 * 3rd less?-----------------+------->| 69 * | | 70 * 4th greater or equal?---->| | 71 * | | 72 * False True 73 */ 74#define Quad_ismagnitudeless(leftp3,leftp4,rightp1,rightp2,rightp3,rightp4,signlessleft,signlessright) \ 75/* Quad_floating_point left, right; * \ 76 * unsigned int signlessleft, signlessright; */ \ 77 ( signlessleft<=signlessright && \ 78 (signlessleft<signlessright || (Qallp2(leftp2)<=Qallp2(rightp2) && \ 79 (Qallp2(leftp2)<Qallp2(rightp2) || (Qallp3(leftp3)<=Qallp3(rightp3) && \ 80 (Qallp3(leftp3)<Qallp3(rightp3) || Qallp4(leftp4)<Qallp4(rightp4))))))) 81 82#define Quad_xor_to_intp1(leftp1,rightp1,result) \ 83 /* quad_floating_point left, right; \ 84 * unsigned int result; */ \ 85 result = Qallp1(leftp1) XOR Qallp1(rightp1); 86 87#define Quad_xor_from_intp1(leftp1,rightp1,result) \ 88 /* quad_floating_point right, result; \ 89 * unsigned int left; */ \ 90 Qallp1(resultp1) = left XOR Qallp1(rightp1) 91 92#define Quad_swap_lower(leftp1,leftp2,leftp3,leftp4,rightp1,rightp2,rightp3,rightp4) \ 93 /* quad_floating_point left, right; */ \ 94 Qallp2(leftp2) = Qallp2(leftp2) XOR Qallp2(rightp2) \ 95 Qallp2(rightp2) = Qallp2(leftp2) XOR Qallp2(rightp2) \ 96 Qallp2(leftp2) = Qallp2(leftp2) XOR Qallp2(rightp2) \ 97 Qallp3(leftp3) = Qallp3(leftp3) XOR Qallp3(rightp3) \ 98 Qallp3(rightp3) = Qallp3(leftp3) XOR Qallp3(rightp3) \ 99 Qallp3(leftp3) = Qallp3(leftp3) XOR Qallp3(rightp3) \ 100 Qallp4(leftp4) = Qallp4(leftp4) XOR Qallp4(rightp4) \ 101 Qallp4(rightp4) = Qallp4(leftp4) XOR Qallp4(rightp4) \ 102 Qallp4(leftp4) = Qallp4(leftp4) XOR Qallp4(rightp4) 103