1 /* ieee754 floating point arithmetic 2 * single and double precision 3 * 4 * BUGS 5 * not much dp done 6 * doesn't generate IEEE754_INEXACT 7 * 8 */ 9 /* 10 * MIPS floating point support 11 * Copyright (C) 1994-2000 Algorithmics Ltd. 12 * 13 * This program is free software; you can distribute it and/or modify it 14 * under the terms of the GNU General Public License (Version 2) as 15 * published by the Free Software Foundation. 16 * 17 * This program is distributed in the hope it will be useful, but WITHOUT 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20 * for more details. 21 * 22 * You should have received a copy of the GNU General Public License along 23 * with this program; if not, write to the Free Software Foundation, Inc., 24 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25 */ 26 27 #include <linux/compiler.h> 28 29 #include "ieee754.h" 30 #include "ieee754sp.h" 31 #include "ieee754dp.h" 32 33 /* 34 * Special constants 35 */ 36 37 #define DPCNST(s, b, m) \ 38 { \ 39 .sign = (s), \ 40 .bexp = (b) + DP_EBIAS, \ 41 .mant = (m) \ 42 } 43 44 const union ieee754dp __ieee754dp_spcvals[] = { 45 DPCNST(0, DP_EMIN - 1, 0x0000000000000ULL), /* + zero */ 46 DPCNST(1, DP_EMIN - 1, 0x0000000000000ULL), /* - zero */ 47 DPCNST(0, 0, 0x0000000000000ULL), /* + 1.0 */ 48 DPCNST(1, 0, 0x0000000000000ULL), /* - 1.0 */ 49 DPCNST(0, 3, 0x4000000000000ULL), /* + 10.0 */ 50 DPCNST(1, 3, 0x4000000000000ULL), /* - 10.0 */ 51 DPCNST(0, DP_EMAX + 1, 0x0000000000000ULL), /* + infinity */ 52 DPCNST(1, DP_EMAX + 1, 0x0000000000000ULL), /* - infinity */ 53 DPCNST(0, DP_EMAX + 1, 0x7FFFFFFFFFFFFULL), /* + indef quiet Nan */ 54 DPCNST(0, DP_EMAX, 0xFFFFFFFFFFFFFULL), /* + max */ 55 DPCNST(1, DP_EMAX, 0xFFFFFFFFFFFFFULL), /* - max */ 56 DPCNST(0, DP_EMIN, 0x0000000000000ULL), /* + min normal */ 57 DPCNST(1, DP_EMIN, 0x0000000000000ULL), /* - min normal */ 58 DPCNST(0, DP_EMIN - 1, 0x0000000000001ULL), /* + min denormal */ 59 DPCNST(1, DP_EMIN - 1, 0x0000000000001ULL), /* - min denormal */ 60 DPCNST(0, 31, 0x0000000000000ULL), /* + 1.0e31 */ 61 DPCNST(0, 63, 0x0000000000000ULL), /* + 1.0e63 */ 62 }; 63 64 #define SPCNST(s, b, m) \ 65 { \ 66 .sign = (s), \ 67 .bexp = (b) + SP_EBIAS, \ 68 .mant = (m) \ 69 } 70 71 const union ieee754sp __ieee754sp_spcvals[] = { 72 SPCNST(0, SP_EMIN - 1, 0x000000), /* + zero */ 73 SPCNST(1, SP_EMIN - 1, 0x000000), /* - zero */ 74 SPCNST(0, 0, 0x000000), /* + 1.0 */ 75 SPCNST(1, 0, 0x000000), /* - 1.0 */ 76 SPCNST(0, 3, 0x200000), /* + 10.0 */ 77 SPCNST(1, 3, 0x200000), /* - 10.0 */ 78 SPCNST(0, SP_EMAX + 1, 0x000000), /* + infinity */ 79 SPCNST(1, SP_EMAX + 1, 0x000000), /* - infinity */ 80 SPCNST(0, SP_EMAX + 1, 0x3FFFFF), /* + indef quiet Nan */ 81 SPCNST(0, SP_EMAX, 0x7FFFFF), /* + max normal */ 82 SPCNST(1, SP_EMAX, 0x7FFFFF), /* - max normal */ 83 SPCNST(0, SP_EMIN, 0x000000), /* + min normal */ 84 SPCNST(1, SP_EMIN, 0x000000), /* - min normal */ 85 SPCNST(0, SP_EMIN - 1, 0x000001), /* + min denormal */ 86 SPCNST(1, SP_EMIN - 1, 0x000001), /* - min denormal */ 87 SPCNST(0, 31, 0x000000), /* + 1.0e31 */ 88 SPCNST(0, 63, 0x000000), /* + 1.0e63 */ 89 }; 90