3 void prepare_rpn_result_2(calc_number_t
*rpn
, TCHAR
*buffer
, int size
, int base
)
11 _stprintf(buffer
, TEXT("%I64X"), rpn
->i
);
15 * Modifed from 17 to 16 for fixing this bug:
16 * 14+14+6.3+6.3= 40.5999999 instead of 40.6
17 * So, it's probably better to leave the least
18 * significant digit out of the display.
20 #define MAX_LD_WIDTH 16
21 /* calculate the width of integer number */
22 width
= (rpn
->f
==0) ? 1 : (int)log10(fabs(rpn
->f
))+1;
23 if (calc
.sci_out
== TRUE
|| width
> MAX_LD_WIDTH
|| width
< -MAX_LD_WIDTH
)
24 ptr
= buffer
+ _stprintf(buffer
, TEXT("%#le"), rpn
->f
);
26 ptr
= buffer
+ _stprintf(buffer
, TEXT("%#*.*lf"), width
, ((MAX_LD_WIDTH
-width
-1)>=0) ? MAX_LD_WIDTH
-width
-1 : 0, rpn
->f
);
27 dst
= _tcschr(buffer
, TEXT('.'));
29 if (*ptr
!= TEXT('0'))
32 /* put the string terminator for removing the final '0' (if any) */
34 /* check if the number finishes with '.' */
36 /* remove the dot (it will be re-added later) */
42 _stprintf(buffer
, TEXT("%I64o"), rpn
->i
);
46 buffer
[0] = TEXT('0');
47 buffer
[1] = TEXT('\0');
51 buffer
[0] = TEXT('\0');
53 memmove(buffer
+1, buffer
, (size
-1)*sizeof(TCHAR
));
55 calc
.buffer
[0] = TEXT('1');
57 calc
.buffer
[0] = TEXT('0');
64 void convert_text2number_2(calc_number_t
*a
)
70 _stscanf(calc
.buffer
, TEXT("%I64X"), &(a
->i
));
73 _stscanf(calc
.buffer
, TEXT("%lf"), &(a
->f
));
76 _stscanf(calc
.buffer
, TEXT("%I64o"), &(a
->i
));
81 while (*ptr
!= TEXT('\0')) {
83 if (*ptr
++ == TEXT('1'))
90 void convert_real_integer(unsigned int base
)
94 calc
.code
.f
= (double)calc
.code
.i
;
99 if (calc
.base
== IDC_RADIO_DEC
) {
100 calc
.code
.i
= (__int64
)calc
.code
.f
;
101 apply_int_mask(&calc
.code
);