Example #1
0
strtoIxL(CONST char *s, char **sp, void *a, void *b)
#endif
{
	static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
	Long exp[2];
	Bigint *B[2];
	int k, rv[2];
	ULong *L = (ULong *)a, *M = (ULong *)b;

	B[0] = Balloc(1);
	B[0]->wds = 2;
	k = strtoIg(s, sp, &fpi, exp, B, rv);
	ULtoxL(L, B[0]->x, exp[0], rv[0]);
	Bfree(B[0]);
	if (B[1]) {
		ULtoxL(M, B[1]->x, exp[1], rv[1]);
		Bfree(B[1]);
		}
	else {
		M[0] = L[0];
		M[1] = L[1];
		M[2] = L[2];
		}
	return k;
	}
Example #2
0
strtoId(CONST char *s, char **sp, double *f0, double *f1)
#endif
{
	static FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI };
	Long exp[2];
	Bigint *B[2];
	int k, rv[2];

	B[0] = Balloc(1);
	if (B[0] == NULL)
		return STRTOG_NoMemory;
	B[0]->wds = 2;
	k = strtoIg(s, sp, &fpi, exp, B, rv);
	if (k == STRTOG_NoMemory)
		return k;
	ULtod((ULong*)f0, B[0]->x, exp[0], rv[0]);
	Bfree(B[0]);
	if (B[1]) {
		ULtod((ULong*)f1, B[1]->x, exp[1], rv[1]);
		Bfree(B[1]);
		}
	else {
		((ULong*)f1)[0] = ((ULong*)f0)[0];
		((ULong*)f1)[1] = ((ULong*)f0)[1];
		}
	return k;
	}
Example #3
0
strtoIf(CONST char *s, char **sp, float *f0, float *f1)
#endif
{
	static FPI fpi = { 24, 1-127-24+1,  254-127-24+1, 1, SI };
	Long exp[2];
	Bigint *B[2];
	int k, rv[2];

	B[0] = Balloc(0);
	B[0]->wds = 1;
	k = strtoIg(s, sp, &fpi, exp, B, rv);
	ULtof((ULong*)f0, B[0]->x, exp[0], rv[0]);
	Bfree(B[0]);
	if (B[1]) {
		ULtof((ULong*)f1, B[1]->x, exp[1], rv[1]);
		Bfree(B[1]);
		}
	else
		*(ULong*)f1 = *(ULong*)f0;
	return k;
	}