4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 #pragma ident "%Z%%M% %I% %E% SMI"
25 * Copyright (c) 1988 by Sun Microsystems, Inc.
29 * Conversion between single, and extended binary and decimal
30 * floating point - separated from double_to_decimal to minimize impact on
31 * main(){printf("Hello");}
34 #include "base_conversion.h"
37 single_to_decimal(px
, pm
, pd
, ps
)
41 fp_exception_field_type
*ps
;
43 single_equivalence kluge
;
46 *ps
= 0; /* Initialize *ps - no exceptions. */
48 pd
->sign
= kluge
.f
.msw
.sign
;
49 pd
->fpclass
= _class_single(px
);
50 switch (pd
->fpclass
) {
60 _unpack_single(&u
, &kluge
.x
);
61 _unpacked_to_decimal(&u
, pm
, pd
, ps
);
66 extended_to_decimal(px
, pm
, pd
, ps
)
70 fp_exception_field_type
*ps
;
72 extended_equivalence kluge
;
75 *ps
= 0; /* Initialize *ps - no exceptions. */
76 kluge
.x
[0] = (*px
)[0];
77 kluge
.x
[1] = (*px
)[1];
78 kluge
.x
[2] = (*px
)[2];
79 pd
->sign
= kluge
.f
.msw
.sign
;
80 pd
->fpclass
= _class_extended(px
);
81 switch (pd
->fpclass
) {
91 _unpack_extended(&u
, px
);
92 _unpacked_to_decimal(&u
, pm
, pd
, ps
);