hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 40ddbc9b8bb29467e4dfbf36437a65b635fd02b1
parent a65b9f6db75f600909f35cb1ee7b59d4cf836b6c
Author: Ember Sawady <ecs@d2evs.net>
Date:   Thu,  5 Oct 2023 02:26:43 +0000

strconv: minor style fixes

Diffstat:
Mstrconv/+test/ftos_test.ha | 6++----
Mstrconv/ftos.ha | 3+--
Mstrconv/ftos_multiprecision.ha | 6++++--
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/strconv/+test/ftos_test.ha b/strconv/+test/ftos_test.ha @@ -168,8 +168,7 @@ use math; // to the original number. const back = stof64(res64)!; assert(math::isnan(back) == math::isnan(tcs[i].0)); - if (!math::isnan(back)) - assert(back == tcs[i].0); + if (!math::isnan(back)) assert(back == tcs[i].0); }; const res32 = ftosf(tcs[i].0: f32, tcs[i].1, @@ -179,8 +178,7 @@ use math; if (tcs[i].2 is void) { const back = stof32(res32)!; assert(math::isnan(back) == math::isnan(tcs[i].0)); - if (!math::isnan(back)) - assert(back == tcs[i].0: f32); + if (!math::isnan(back)) assert(back == tcs[i].0: f32); }; }; // These tests will only pass for f64 diff --git a/strconv/ftos.ha b/strconv/ftos.ha @@ -292,8 +292,7 @@ export fn fftosf( }; if (f == ffmt::G && prec is uint) { - if (prec as uint == 0) - prec = 1u; + if (prec as uint == 0) prec = 1; }; if (m.nd == 0) { diff --git a/strconv/ftos_multiprecision.ha b/strconv/ftos_multiprecision.ha @@ -96,10 +96,12 @@ const leftcheats: [](size, str) = [ fn prefix_less_than_mp(m: *mp, s: str) bool = { const u = strings::toutf8(s); for (let i = 0z; i < len(s); i += 1) { - if (i >= m.nd) + if (i >= m.nd) { return true; - if (m.buf[i] + '0': u8 != u[i]) + }; + if (m.buf[i] + '0': u8 != u[i]) { return m.buf[i] + '0': u8 < u[i]; + }; }; return false; };