fix F`fillarr leaking fill element
also print higher precision numbers
This commit is contained in:
parent
62209961eb
commit
b8c362247b
@ -87,10 +87,10 @@ B each_c2(B d, B w, B x) { B f = c(Md1D,d)->f;
|
|||||||
|
|
||||||
B scan_c1(B d, B x) { B f = c(Md1D,d)->f;
|
B scan_c1(B d, B x) { B f = c(Md1D,d)->f;
|
||||||
if (isAtm(x) || rnk(x)==0) thrM("`: Argument cannot have rank 0");
|
if (isAtm(x) || rnk(x)==0) thrM("`: Argument cannot have rank 0");
|
||||||
B xf = getFillQ(x);
|
|
||||||
ur xr = rnk(x);
|
ur xr = rnk(x);
|
||||||
usz ia = a(x)->ia;
|
usz ia = a(x)->ia;
|
||||||
if (ia==0) return x;
|
if (ia==0) return x;
|
||||||
|
B xf = getFillQ(x);
|
||||||
if (xr==1 && TI(x).elType==el_i32 && isFun(f) && v(f)->flags) {
|
if (xr==1 && TI(x).elType==el_i32 && isFun(f) && v(f)->flags) {
|
||||||
u8 rtid = v(f)->flags-1;
|
u8 rtid = v(f)->flags-1;
|
||||||
i32* xp = i32any_ptr(x);
|
i32* xp = i32any_ptr(x);
|
||||||
|
|||||||
@ -41,7 +41,7 @@ B repr_c1(B t, B x) {
|
|||||||
#define BL 100
|
#define BL 100
|
||||||
if (isF64(x)) {
|
if (isF64(x)) {
|
||||||
char buf[BL];
|
char buf[BL];
|
||||||
snprintf(buf, BL, "%g", x.f);
|
snprintf(buf, BL, "%.14g", x.f);
|
||||||
return m_str8(strlen(buf), buf);
|
return m_str8(strlen(buf), buf);
|
||||||
} else {
|
} else {
|
||||||
#ifdef FORMATTER
|
#ifdef FORMATTER
|
||||||
|
|||||||
@ -85,6 +85,7 @@ NOINLINE void harr_pfree(B x, usz am) { // am - item after last written
|
|||||||
assert(v(x)->type==t_harr);
|
assert(v(x)->type==t_harr);
|
||||||
B* p = harr_ptr(x);
|
B* p = harr_ptr(x);
|
||||||
for (usz i = 0; i < am; i++) dec(p[i]);
|
for (usz i = 0; i < am; i++) dec(p[i]);
|
||||||
|
if (rnk(x)>1) ptr_dec(shObj(x));
|
||||||
mm_free(v(x));
|
mm_free(v(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,7 @@ NOINLINE void print(B x) {
|
|||||||
|
|
||||||
NOINLINE void printRaw(B x) {
|
NOINLINE void printRaw(B x) {
|
||||||
if (isAtm(x)) {
|
if (isAtm(x)) {
|
||||||
if (isF64(x)) printf("%g", x.f);
|
if (isF64(x)) printf("%.14g", x.f);
|
||||||
else if (isC32(x)) printUTF8((u32)x.u);
|
else if (isC32(x)) printUTF8((u32)x.u);
|
||||||
else thrM("bad printRaw argument: atom arguments should be either numerical or characters");
|
else thrM("bad printRaw argument: atom arguments should be either numerical or characters");
|
||||||
} else {
|
} else {
|
||||||
@ -196,7 +196,7 @@ NOINLINE B append_fmt(B s, char* p, ...) {
|
|||||||
AU("¯");
|
AU("¯");
|
||||||
f=-f;
|
f=-f;
|
||||||
}
|
}
|
||||||
snprintf(buf, 30, "%g", f);
|
snprintf(buf, 30, "%.14g", f);
|
||||||
A8(buf);
|
A8(buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user