Commit Graph

1370 Commits

Author SHA1 Message Date
K. Lange
ce6ddec02d Add simple float parser 2024-02-29 00:26:44 +09:00
K. Lange
cfe34614da Hopefully more correct rounding in long.__truediv__? 2024-02-28 20:56:26 +09:00
K. Lange
55debe7570 Fast long shifts 2024-02-28 19:13:12 +09:00
K. Lange
a36f6e00eb Remove unused 'exact' parameter. 2024-02-28 18:01:57 +09:00
K. Lange
1cdd9dfb1b Fix repr display of trailing zero 2024-02-28 17:58:27 +09:00
K. Lange
7ed0cd6823 Improve final construction of decimal strings 2024-02-28 17:39:47 +09:00
K. Lange
f80b5430f8 Support field width, some alignment for float.__format__ 2024-02-28 09:29:26 +09:00
K. Lange
4a2e736594 Use 10^52, as that makes more sense. 2024-02-28 07:24:27 +09:00
K. Lange
27b2d584ab Also cache 10^31 2024-02-27 19:42:43 +09:00
K. Lange
4e97099bd6 Implement float → string conversion 2024-02-27 19:37:23 +09:00
K. Lange
9ad85010bf Fix leak of tmp values in long.__truediv__ 2024-02-27 19:31:13 +09:00
K. Lange
53c08adec9 Similarly, krk_tableAdjustCapacity can use identity 2024-02-27 19:26:51 +09:00
K. Lange
1ebff2c5e5 Only check identity when populating string table 2024-02-27 19:19:11 +09:00
K. Lange
f75adeb2ca Implement long.__truediv__ through actual long division 2024-02-27 07:48:15 +09:00
K. Lange
1c75adaa51 rline should only set LC_CTYPE, and only if needed 2024-02-27 07:46:56 +09:00
K. Lange
0c8cb94b6a Quick hack for rline to not have locales break float parsing 2024-02-25 22:23:56 +09:00
K. Lange
f1d7bdaa5a Accept floats in things that use krk_long_to_int 2024-02-24 21:31:39 +09:00
K. Lange
32bd212a49 Need sys/types.h for ssize_t 2024-02-15 18:49:28 +09:00
K. Lange
2c0ab9a3e9 Fix another potential case of writing to the wrong stack 2024-02-15 17:54:50 +09:00
K. Lange
d920ff7f54 Fix leaked KrkLong in rshift_z 2024-02-15 17:49:38 +09:00
K. Lange
c179b7f4b4 Fix potential references to bad stacks due to ordering of array indexing 2024-02-15 17:48:00 +09:00
K. Lange
e9702ad37e Account for increased table sizes in getsizeof 2024-02-15 17:36:05 +09:00
K. Lange
539f217714 Only scan used entries when iterating over dicts 2024-02-15 17:22:41 +09:00
K. Lange
8acf7a9113 Make tables (dicts, methods/fields) ordered 2024-02-15 17:22:11 +09:00
K. Lange
93b5fce168 dict should do power-of-two calculation when preallocating space 2024-02-15 12:01:12 +09:00
K. Lange
2fd88b8219 krk_findEntry should not be exposed 2024-02-15 12:00:31 +09:00
K. Lange
fbf1b09514 Fix missing spaces in tools/compile 2024-02-12 12:05:26 +09:00
K. Lange
22e550ee67 Fixup bounds for negative values 2024-01-15 19:36:37 +09:00
K. Lange
049c58c40c Build strings from longs before formatting them 2024-01-15 19:27:08 +09:00
K. Lange
99dfc12a67 _ format specifier should be 3 digits for decimal, 4 for others 2024-01-15 19:25:51 +09:00
K. Lange
6e8aa9bee6 Don't pass around w as a KrkLong
We only shifting up to size_t bits anyway; expose the internal
size_t-based shifting, use that in these functions, and stop
allocating additional KrkLongs for the `w` values.

Since we only do this a few times and the values were very small,
this has minimal impact but does simplify the code a bit.
2024-01-13 16:57:07 +09:00
K. Lange
9590df3ef0 Faster binary-to-decimal conversions 2024-01-11 22:56:46 +09:00
K. Lange
b162ed889b Add support for building without nan-boxing 2024-01-11 13:36:27 +09:00
K. Lange
df4435efdc Ensure bytes are zero'd when building bytearrays 2024-01-10 21:56:23 +09:00
K. Lange
0b516fd7e2 Fix long.__rshift__ in particular to be linear
on the number of bits in the number to shift, not the amount
to shif it by
2024-01-10 13:48:08 +09:00
K. Lange
4008133a0b Fix bad value boxings 2024-01-08 17:09:24 +09:00
K. Lange
bc3024881f Fixes that should enable MSVC to build the core interpreter 2024-01-08 14:12:24 +09:00
K. Lange
c530cf20fd file names passed to krk_interpret, krk_compile, krk_runfile can be const 2024-01-08 10:53:38 +09:00
K. Lange
0a9a3c7129 Step one of trying to clean up the macro namespace 2024-01-08 09:29:52 +09:00
K. Lange
a5f5c30157 NONE_VAL and NOTIMPL_VAL don't actually take an argument 2024-01-08 09:09:29 +09:00
K. Lange
29b2f91762 Don't include sys/time.h, unused 2024-01-08 08:34:05 +09:00
K. Lange
6211f81535 Avoid passing -g to can-floor-without-libm as clang doesn't like -g with -o /dev/null 2024-01-07 21:27:54 +09:00
K. Lange
eb0d40a2ad shut clang up 2024-01-07 21:17:18 +09:00
K. Lange
e4136437c6 Add a test for expression underlining data 2024-01-07 17:51:50 +09:00
K. Lange
0c552807ff Simplify repl acquisition of build version 2024-01-07 17:40:19 +09:00
K. Lange
5bf7cf89c3 Optimize type.__call__ when __new__ is a native function 2024-01-07 15:16:53 +09:00
K. Lange
2f72a8004a Handle common case for int.__new__ better 2024-01-07 15:16:26 +09:00
K. Lange
484f0f68a1 Use krk_int_from_float for float.__int__, shortcircuit small enough values 2024-01-07 10:10:51 +09:00
K. Lange
114b66dd5c Set __hash__ to None when clearing it, to match CPython 2024-01-07 10:05:16 +09:00
K. Lange
efca612a20 Support Ellipsis in tools/compile.c 2024-01-03 14:34:17 +09:00