2 (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 See the copyright notice in the ACK home directory, in the file "Copyright".
9 CONVERT INTEGER TO SINGLE (CIF n 4)
11 THIS ROUTINE WORKS BY FILLING AN EXTENDED
12 WITH THE INTEGER VALUE IN EXTENDED FORMAT
13 AND USES COMPACT() TO PUT IT INTO THE PROPER
14 FLOATING POINT PRECISION.
21 int ss
; /* source size */
22 long src
; /* largest possible integer to convert */
30 if (ss
== sizeof(long)) {
33 result
= (SINGLE
*) &src
;
39 result
= (SINGLE
*) &ss
;
42 *result
= (SINGLE
) 0L;
45 /* ESTABLISHED THAT src != 0 */
46 /* adjust exponent field */
47 buf
.sign
= (i_src
< 0) ? 0x8000 : 0;
48 /* clear sign bit of integer */
49 /* move to mantissa field */
50 buf
.m1
= (i_src
< 0) ? -i_src
: i_src
;
51 /* adjust mantissa field */
52 if (ss
!= sizeof(long))
54 nrm_ext(&buf
); /* adjust mantissa field */
55 compact(&buf
, result
,sizeof(SINGLE
)); /* put on stack */