_Qquad.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1989 by Sun Microsystems, Inc.
*/
/*
* Header file for long double == quadruple-precision run-time support. C
* "long double" and Fortran "real*16" are implemented identically on all
* architectures.
*
* Thus the quad run-time support is intentionally coded as C-callable routines
* for portability.
*
* Mixed-case identifiers with leading _ are intentionally chosen to minimize
* conflicts with user-defined C and Fortran identifiers.
*/
#include <math.h> /* to get float macros */
#ifndef _QUAD_INCLUDED_
#define _QUAD_INCLUDED_ /* Render harmless multiple inclusions. */
#ifdef __STDC__ /* are we there yet */
#define QUAD long double
#define SINGLE float
#define SINGLERESULT float
#define RETURNSINGLE(x) return x
#define ASSIGNSINGLERESULT(x,y) x = y
#else
struct quadstruct {
unsigned parts[4]
};
#define QUAD struct quadstruct
#define SINGLE FLOATPARAMETER
#define SINGLERESULT FLOATFUNCTIONTYPE
#define RETURNSINGLE(x) RETURNFLOAT(x)
#endif
extern enum fcc_type
* only on signaling NaN */
extern enum fcc_type
* on quiet NaN */
/* Conversion routines are pretty straightforward. */
extern double _Q_qtod( /* QUAD x */ );
extern int _Q_qtoi( /* QUAD x */ );
extern unsigned _Q_qtou( /* QUAD x */ );
/******
*****/
extern void
decimal_to_longdouble( /* QUAD *px ; decimal_mode *pm;
* decimal_record *pd;
fp_exception_field_type *ps; */ );
extern void
longdouble_to_decimal( /* QUAD *px ; decimal_mode *pm;
* decimal_record *pd;
fp_exception_field_type *ps; */ );
#ifdef sparc
enum fcc_type /* relationships for loading into cc */
{
fcc_equal = 0,
fcc_less = 1,
fcc_greater = 2,
fcc_unordered = 3
} ;
#endif
#ifdef i386
enum fcc_type /* relationships for loading into cc */
{
fcc_equal = 64,
fcc_less = 1,
fcc_greater = 0,
fcc_unordered = 69
} ;
#endif
#ifdef mc68000
enum fcc_type /* relationships for loading into cc */
{
fcc_equal = 4,
fcc_less = 25,
fcc_greater = 0,
fcc_unordered = 2
} ;
#endif
#ifdef i386
typedef /* FPU register viewed as single components. */
struct
{
unsigned significand : 23 ;
unsigned exponent : 8 ;
unsigned sign : 1 ;
}
typedef /* FPU register viewed as double components. */
struct
{
unsigned significand : 20 ;
unsigned exponent : 11 ;
unsigned sign : 1 ;
}
typedef /* FPU register viewed as extended components. */
struct
{
unsigned significand : 16 ;
unsigned exponent : 15 ;
unsigned sign : 1 ;
}
#else
typedef /* FPU register viewed as single components. */
struct
{
unsigned sign : 1 ;
unsigned exponent : 8 ;
unsigned significand : 23 ;
}
typedef /* FPU register viewed as double components. */
struct
{
unsigned sign : 1 ;
unsigned exponent : 11 ;
unsigned significand : 20 ;
}
typedef /* FPU register viewed as extended components. */
struct
{
unsigned sign : 1 ;
unsigned exponent : 15 ;
unsigned significand : 16 ;
}
#endif
enum fp_op_type /* Type specifiers in FPU instructions. */
{
fp_op_integer = 0, /* Not in hardware, but convenient to define. */
fp_op_single = 1,
fp_op_double = 2,
fp_op_extended = 3
} ;
#endif /* QUAD_INCLUDED */