From 555a2d0c47b34f933735f65ba6b0c21079234ba5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 18 Jan 2019 10:38:47 -0800 Subject: int-flo: take advantage of unsigned range. * arith.c (int_flo): If the floating point value is in the ucnum range, we can convert to integer by way of that type; we gain a little bit of range. For instance on 32 bits, floating values in the range 2147483648.0 to 4294967295.0 can be converted via the fast path. --- arith.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arith.c b/arith.c index 1420d65d..401e9693 100644 --- a/arith.c +++ b/arith.c @@ -2367,6 +2367,9 @@ val int_flo(val f) if (n < NUM_MIN || n > NUM_MAX) return bignum(n); return num_fast(n); + } else if (d >= 0 && d <= UINT_PTR_MAX) { + ucnum n = d; + return unum(n); } else { char text[128]; char mint[128] = "", mfrac[128] = "", *pint = mint; -- cgit v1.2.3