mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.10.3t5.45
This commit is contained in:
29
zio.c
29
zio.c
@@ -6,6 +6,7 @@
|
||||
* Scanf and printf routines for arbitrary precision integers.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "config.h"
|
||||
#include "zmath.h"
|
||||
#include "args.h"
|
||||
@@ -710,4 +711,32 @@ str2z(char *s, ZVALUE *res)
|
||||
*res = z;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fitzprint(ZVALUE z, long digits, long show)
|
||||
{
|
||||
ZVALUE ztmp1, ztmp2;
|
||||
long i;
|
||||
|
||||
if (digits <= show) {
|
||||
zprintval(z, 0, 0);
|
||||
return;
|
||||
}
|
||||
show /= 2;
|
||||
ztenpow(digits - show, &ztmp1);
|
||||
(void) zquo(z, ztmp1, &ztmp2, 1);
|
||||
zprintval(ztmp2, 0, 0);
|
||||
zfree(ztmp1);
|
||||
zfree(ztmp2);
|
||||
printf("...");
|
||||
ztenpow(show, &ztmp1);
|
||||
(void) zmod(z, ztmp1, &ztmp2, 0);
|
||||
i = zdigits(ztmp2);
|
||||
while (i++ < show)
|
||||
printf("0");
|
||||
zprintval(ztmp2, 0, 0);
|
||||
zfree(ztmp1);
|
||||
zfree(ztmp2);
|
||||
}
|
||||
|
||||
/* END CODE */
|
||||
|
Reference in New Issue
Block a user