| 1 |
330 |
jeremybenn |
/* decSingle module for the decNumber C Library.
|
| 2 |
|
|
Copyright (C) 2007, 2009 Free Software Foundation, Inc.
|
| 3 |
|
|
Contributed by IBM Corporation. Author Mike Cowlishaw.
|
| 4 |
|
|
|
| 5 |
|
|
This file is part of GCC.
|
| 6 |
|
|
|
| 7 |
|
|
GCC is free software; you can redistribute it and/or modify it under
|
| 8 |
|
|
the terms of the GNU General Public License as published by the Free
|
| 9 |
|
|
Software Foundation; either version 3, or (at your option) any later
|
| 10 |
|
|
version.
|
| 11 |
|
|
|
| 12 |
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 13 |
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 14 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 15 |
|
|
for more details.
|
| 16 |
|
|
|
| 17 |
|
|
Under Section 7 of GPL version 3, you are granted additional
|
| 18 |
|
|
permissions described in the GCC Runtime Library Exception, version
|
| 19 |
|
|
3.1, as published by the Free Software Foundation.
|
| 20 |
|
|
|
| 21 |
|
|
You should have received a copy of the GNU General Public License and
|
| 22 |
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
| 23 |
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
| 24 |
|
|
<http://www.gnu.org/licenses/>. */
|
| 25 |
|
|
|
| 26 |
|
|
/* ------------------------------------------------------------------ */
|
| 27 |
|
|
/* decSingle.c -- decSingle operations module */
|
| 28 |
|
|
/* ------------------------------------------------------------------ */
|
| 29 |
|
|
|
| 30 |
|
|
#include "decContext.h" /* public includes */
|
| 31 |
|
|
#include "decSingle.h" /* public includes */
|
| 32 |
|
|
|
| 33 |
|
|
/* Constant mappings for shared code */
|
| 34 |
|
|
#define DECPMAX DECSINGLE_Pmax
|
| 35 |
|
|
#define DECEMIN DECSINGLE_Emin
|
| 36 |
|
|
#define DECEMAX DECSINGLE_Emax
|
| 37 |
|
|
#define DECEMAXD DECSINGLE_EmaxD
|
| 38 |
|
|
#define DECBYTES DECSINGLE_Bytes
|
| 39 |
|
|
#define DECSTRING DECSINGLE_String
|
| 40 |
|
|
#define DECECONL DECSINGLE_EconL
|
| 41 |
|
|
#define DECBIAS DECSINGLE_Bias
|
| 42 |
|
|
#define DECLETS DECSINGLE_Declets
|
| 43 |
|
|
#define DECQTINY (-DECSINGLE_Bias)
|
| 44 |
|
|
/* parameters of next-wider format */
|
| 45 |
|
|
#define DECWBYTES DECDOUBLE_Bytes
|
| 46 |
|
|
#define DECWPMAX DECDOUBLE_Pmax
|
| 47 |
|
|
#define DECWECONL DECDOUBLE_EconL
|
| 48 |
|
|
#define DECWBIAS DECDOUBLE_Bias
|
| 49 |
|
|
|
| 50 |
|
|
/* Type and function mappings for shared code */
|
| 51 |
|
|
#define decFloat decSingle /* Type name */
|
| 52 |
|
|
#define decFloatWider decDouble /* Type name */
|
| 53 |
|
|
|
| 54 |
|
|
/* Utility (binary results, extractors, etc.) */
|
| 55 |
|
|
#define decFloatFromBCD decSingleFromBCD
|
| 56 |
|
|
#define decFloatFromPacked decSingleFromPacked
|
| 57 |
|
|
#define decFloatFromPackedChecked decSingleFromPackedChecked
|
| 58 |
|
|
#define decFloatFromString decSingleFromString
|
| 59 |
|
|
#define decFloatFromWider decSingleFromWider
|
| 60 |
|
|
#define decFloatGetCoefficient decSingleGetCoefficient
|
| 61 |
|
|
#define decFloatGetExponent decSingleGetExponent
|
| 62 |
|
|
#define decFloatSetCoefficient decSingleSetCoefficient
|
| 63 |
|
|
#define decFloatSetExponent decSingleSetExponent
|
| 64 |
|
|
#define decFloatShow decSingleShow
|
| 65 |
|
|
#define decFloatToBCD decSingleToBCD
|
| 66 |
|
|
#define decFloatToEngString decSingleToEngString
|
| 67 |
|
|
#define decFloatToPacked decSingleToPacked
|
| 68 |
|
|
#define decFloatToString decSingleToString
|
| 69 |
|
|
#define decFloatToWider decSingleToWider
|
| 70 |
|
|
#define decFloatZero decSingleZero
|
| 71 |
|
|
|
| 72 |
|
|
/* Non-computational */
|
| 73 |
|
|
#define decFloatRadix decSingleRadix
|
| 74 |
|
|
#define decFloatVersion decSingleVersion
|
| 75 |
|
|
|
| 76 |
|
|
#include "decNumberLocal.h" /* local includes (need DECPMAX) */
|
| 77 |
|
|
#include "decCommon.c" /* non-basic decFloat routines */
|
| 78 |
|
|
/* [Do not include decBasic.c for decimal32] */
|
| 79 |
|
|
|