2678 |
unsigned int radix, enum t_exactness *p_exactness) |
unsigned int radix, enum t_exactness *p_exactness) |
2679 |
{ |
{ |
2680 |
unsigned int idx = *p_idx; |
unsigned int idx = *p_idx; |
2681 |
|
SCM result; |
2682 |
|
|
2683 |
if (idx == len) |
if (idx == len) |
2684 |
return SCM_BOOL_F; |
return SCM_BOOL_F; |
2710 |
else if (!isdigit (mem[idx + 1])) |
else if (!isdigit (mem[idx + 1])) |
2711 |
return SCM_BOOL_F; |
return SCM_BOOL_F; |
2712 |
else |
else |
2713 |
return mem2decimal_from_point (SCM_MAKINUM (0), mem, len, |
result = mem2decimal_from_point (SCM_MAKINUM (0), mem, len, |
2714 |
p_idx, p_exactness); |
p_idx, p_exactness); |
2715 |
} |
} |
2716 |
else |
else |
2717 |
{ |
{ |
2718 |
enum t_exactness x = EXACT; |
enum t_exactness x = EXACT; |
2719 |
SCM uinteger; |
SCM uinteger; |
|
SCM result; |
|
2720 |
|
|
2721 |
uinteger = mem2uinteger (mem, len, &idx, radix, &x); |
uinteger = mem2uinteger (mem, len, &idx, radix, &x); |
2722 |
if (SCM_FALSEP (uinteger)) |
if (SCM_FALSEP (uinteger)) |
2748 |
*p_idx = idx; |
*p_idx = idx; |
2749 |
if (x == INEXACT) |
if (x == INEXACT) |
2750 |
*p_exactness = x; |
*p_exactness = x; |
|
|
|
|
return result; |
|
2751 |
} |
} |
2752 |
|
|
2753 |
|
/* When returning an inexact zero, make sure it is represented as a |
2754 |
|
floating point value so that we can change its sign. |
2755 |
|
*/ |
2756 |
|
if (SCM_EQ_P (result, SCM_MAKINUM(0)) && *p_exactness == INEXACT) |
2757 |
|
result = scm_make_real (0.0); |
2758 |
|
|
2759 |
|
return result; |
2760 |
} |
} |
2761 |
|
|
2762 |
|
|