diff --git a/complex.cpp b/complex.cpp index 9f94170d..41084372 100644 --- a/complex.cpp +++ b/complex.cpp @@ -914,7 +914,7 @@ EX namespace clearing { // printf("R %4d C %4d\n", celldistAlt(bd.root), celldistAlt(c)); if(celldistAlt(c) > celldistAlt(bd.root)) { stepcount++; - if(stepcount > 1000) { + if(stepcount > 100000000) { printf("buggy #1\n"); return; } @@ -933,7 +933,7 @@ EX namespace clearing { } else { bd.dist--; - if(bd.dist < -1000) { + if(bd.dist < -100000000) { for(int i=0; iitem = itBuggy; for(int i=0; i<(int) rpath.size(); i++) diff --git a/heptagon.cpp b/heptagon.cpp index f9f15483..d0379225 100644 --- a/heptagon.cpp +++ b/heptagon.cpp @@ -237,7 +237,7 @@ heptagon *hrmap_standard::create_step(heptagon *h, int d) { pard = 3; // to do: randomize else if(S3 == 4) pard = 3; - buildHeptagon(h, 0, h->distance < -10000 ? hsOrigin : hsA, pard); + buildHeptagon(h, 0, h->distance < -32500 ? hsOrigin : hsA, pard); } if(h->move(d)) return h->move(d); if(h->s == hsOrigin) { diff --git a/hud.cpp b/hud.cpp index 185b97ea..ed15b5c2 100644 --- a/hud.cpp +++ b/hud.cpp @@ -255,14 +255,8 @@ bool displayglyph(int cx, int cy, int buttonsize, char glyph, color_t color, int buttonsize / 3; if(id == moMutant + ittypes && clearing::imputed.nonzero()) { - ld d = qty + clearing::imputed.approx_ld(); - if(d < 100000) str = its(int(d)); - else { - int digits = 0; - while(d >= 10) digits++, d /= 10; - str = its(int(d*100)) + "E" + its(digits); - str.insert(1, "."); - } + bignum bn = clearing::imputed + qty; + str = short_form(bn); bsize = buttonsize / 4; } diff --git a/util.cpp b/util.cpp index 81491cbf..c89c14ff 100644 --- a/util.cpp +++ b/util.cpp @@ -514,6 +514,29 @@ string bignum::get_str(int max_length) const { return ret; } +EX string short_form(bignum b) { + if(b < 0) return "-" + short_form(0-b); + else if(b < 100000) return its(b.approx_int()); + else { + long long val; + int q; + if(isize(b.digits) >= 2) { + q = max(isize(b.digits) - 2, 0); + val = b.digits[q] + (long long)(bignum::BASE) * b.digits[q+1]; + } + else { + q = 0; + val = b.digits[0]; + } + + int digits = q * 9; + while(val >= 1000) { val /= 10; digits++; } + string str = its(val) + "E" + its(digits + 2); + str.insert(1, "."); + return str; + } + } + bignum::bignum(ld d) { if(d == 0) return; int n = 1;