Home | History | Annotate | Line # | Download | only in gdtoa
strtoIdd.c revision 1.1.1.2
      1  1.1  kleink /****************************************************************
      2  1.1  kleink 
      3  1.1  kleink The author of this software is David M. Gay.
      4  1.1  kleink 
      5  1.1  kleink Copyright (C) 1998 by Lucent Technologies
      6  1.1  kleink All Rights Reserved
      7  1.1  kleink 
      8  1.1  kleink Permission to use, copy, modify, and distribute this software and
      9  1.1  kleink its documentation for any purpose and without fee is hereby
     10  1.1  kleink granted, provided that the above copyright notice appear in all
     11  1.1  kleink copies and that both that the copyright notice and this
     12  1.1  kleink permission notice and warranty disclaimer appear in supporting
     13  1.1  kleink documentation, and that the name of Lucent or any of its entities
     14  1.1  kleink not be used in advertising or publicity pertaining to
     15  1.1  kleink distribution of the software without specific, written prior
     16  1.1  kleink permission.
     17  1.1  kleink 
     18  1.1  kleink LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
     19  1.1  kleink INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
     20  1.1  kleink IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
     21  1.1  kleink SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     22  1.1  kleink WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
     23  1.1  kleink IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     24  1.1  kleink ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
     25  1.1  kleink THIS SOFTWARE.
     26  1.1  kleink 
     27  1.1  kleink ****************************************************************/
     28  1.1  kleink 
     29  1.1  kleink /* Please send bug reports to David M. Gay (dmg at acm dot org,
     30  1.1  kleink  * with " at " changed at "@" and " dot " changed to ".").	*/
     31  1.1  kleink 
     32  1.1  kleink #include "gdtoaimp.h"
     33  1.1  kleink 
     34  1.1  kleink  int
     35  1.1  kleink #ifdef KR_headers
     36  1.1  kleink strtoIdd(s, sp, f0, f1) CONST char *s; char **sp; double *f0, *f1;
     37  1.1  kleink #else
     38  1.1  kleink strtoIdd(CONST char *s, char **sp, double *f0, double *f1)
     39  1.1  kleink #endif
     40  1.1  kleink {
     41  1.1  kleink #ifdef Sudden_Underflow
     42  1.1  kleink 	static FPI fpi = { 106, 1-1023, 2046-1023-106+1, 1, 1 };
     43  1.1  kleink #else
     44  1.1  kleink 	static FPI fpi = { 106, 1-1023-53+1, 2046-1023-106+1, 1, 0 };
     45  1.1  kleink #endif
     46  1.1  kleink 	Long exp[2];
     47  1.1  kleink 	Bigint *B[2];
     48  1.1  kleink 	int k, rv[2];
     49  1.1  kleink 
     50  1.1  kleink 	B[0] = Balloc(2);
     51  1.1  kleink 	B[0]->wds = 4;
     52  1.1  kleink 	k = strtoIg(s, sp, &fpi, exp, B, rv);
     53  1.1  kleink 	ULtodd((ULong*)f0, B[0]->x, exp[0], rv[0]);
     54  1.1  kleink 	Bfree(B[0]);
     55  1.1  kleink 	if (B[1]) {
     56  1.1  kleink 		ULtodd((ULong*)f1, B[1]->x, exp[1], rv[1]);
     57  1.1  kleink 		Bfree(B[1]);
     58  1.1  kleink 		}
     59  1.1  kleink 	else {
     60  1.1  kleink 		((ULong*)f1)[0] = ((ULong*)f0)[0];
     61  1.1  kleink 		((ULong*)f1)[1] = ((ULong*)f0)[1];
     62  1.1  kleink 		((ULong*)f1)[2] = ((ULong*)f0)[2];
     63  1.1  kleink 		((ULong*)f1)[3] = ((ULong*)f0)[3];
     64  1.1  kleink 		}
     65  1.1  kleink 	return k;
     66  1.1  kleink 	}
     67