Yorick Hardy
4bbceeb4d6
round half-integers to even instead of away from zero
...
This changes the behaviour to match r7rs (round x) instead of C round(x).
An answer to https://stackoverflow.com/questions/32746523/ieee-754-compliant-round-half-to-even
suggests using remainder(). The following will work if FE_TONEAREST is defined, but C11
requires FE_TONEAREST to be defined if and only if the implemenetation supports it in
fegetround() and fesetround() [Draft N1570]. On the other hand, remainder() must be defined.
C23 will have roundeven(), but this is not yet available on all platforms.
The behaviour of remainder is described in Draft N1570, page 254, footnote 239.
Alternative implementation:
double round_to_nearest_even(double x)
{
#pragma STDC FENV_ACCESS ON
int mode;
double nearest;
mode = fegetround();
fesetround(FE_TONEAREST);
nearest = nearbyint(x);
fesetround(mode);
#pragma STDC FENV_ACCESS OFF
return nearest;
}
2024-02-01 22:25:47 +02:00
Justin Ethier
3b921e7389
Re-format code
2024-01-17 19:43:47 -08:00
Justin Ethier
abaed9f6f2
Issue #510 - Implement exact using runtime functions
2023-09-12 19:20:38 -07:00
Justin Ethier
7dc1f9e179
Issue #510 - Exact support for complex nums
...
Allow `exact` to properly handle complex numbers
2023-09-11 19:02:28 -07:00
Justin Ethier
e8ba3f1c1b
Issue #510 - Exact conversion of large doubles
...
Allow `exact` to convert large double values to bignums.
2023-09-11 18:24:33 -07:00
Justin Ethier
f8fbb9ad7d
WIP, fixing bugs with double ops
...
Allow round/ceil/floor/truncate to properly handle doubles.
Need to handle more edge cases with (exact).
2023-09-06 19:41:57 -07:00
Justin Ethier
cc5d1d5d65
WIP
2023-09-05 19:04:18 -07:00
Justin Ethier
ad1ac3a135
Issue #490 - Proper assv and memv implementations
...
Both were previously implemented in terms of `assq` and `memq`, respectively.
2022-07-24 10:56:41 -04:00
Justin Ethier
6ffd229dcd
Add memory-streams to list of features
2022-05-28 08:21:11 -07:00
Justin Ethier
5101de1547
Issue #143 - Track recursion depth of equalp
...
This prevents the possibility of segfaulting when traversing arbitrarily complex circular structures.
2022-05-26 13:02:24 -04:00
Justin Ethier
bb861334f6
Simplify heap type definitions
...
This is the first step in making it easier to change the number and/or size of heap pages.
2021-08-17 15:03:53 -04:00
Justin Ethier
227861cb2e
Use smaller datatype for ttl
2021-08-17 07:42:39 -04:00
Justin Ethier
f17102178b
Continue building-out new numerator/denominator
2021-07-21 19:47:42 -07:00
Justin Ethier
d3ab710bb4
Issue #466 - Prevent compiler warnings regarding Cyc_st_add and string comparisons
...
Were seeing newer versions of clang spamming warnings due to how we were comparing strings here.
2021-07-16 13:02:50 -07:00
Justin Ethier
e21735512e
Attempt to avoid compilation warnings on clang
2021-07-15 20:00:33 -07:00
Justin Ethier
358fe01fc2
Issue #211 - production version of (char-ready?)
2021-06-08 13:38:33 -04:00
Justin Ethier
100c9c50ab
Fix primitive_type declarations so module compiles
2021-05-24 18:49:45 -07:00
Justin Ethier
6ac96ea5c2
Simplify num argument checks for apply
...
Avoid calling (length) twice, cleanup, and simplify related code.
2021-05-24 12:41:19 -04:00
Justin Ethier
8526a0676f
Require num_args for primitive_type
...
This will allow us to use the same validation code as for closures.
2021-05-24 12:35:50 -04:00
Justin Ethier
a05959cb90
Converted primitive functions to new calling conventions
2021-05-22 19:45:52 -07:00
Justin Ethier
c44f7fcc0b
WIP conversion
2021-05-20 19:58:14 -07:00
Justin Ethier
b8ed157105
Added init_polyfills()
2021-05-02 19:30:11 -07:00
Justin Ethier
81d9410395
Document macros, remove dead code
2021-04-06 19:51:45 -07:00
Justin Ethier
2c66875899
Update C macro docs
2021-04-06 19:01:37 -07:00
Justin Ethier
5c113c0303
Issu3 #421 - Add missing docs
2021-04-05 18:36:50 -04:00
Justin Ethier
6edbd8cd57
Prevent compilation warninG
2021-03-14 21:22:14 -04:00
Justin Ethier
b507485f55
Port dispatch_apply to new calling convention
2021-03-06 22:07:11 -05:00
Justin Ethier
d590904894
Porting function callling conventions
2021-02-26 22:31:02 -05:00
Justin Ethier
93310be845
Convert C function calls
2021-02-21 11:24:08 -05:00
Justin Ethier
d06dbcb64a
Remove dispatch.c, port Cyc_apply
2021-02-21 10:53:16 -05:00
Justin Ethier
5ff682a592
Remove Cyc-list, seems unused
2021-02-19 10:19:32 -05:00
Justin Ethier
c839edb5e2
Cleanup, convert CPS function sigs
2021-02-18 22:59:03 -05:00
Justin Ethier
24bbc2e39d
Converting function calls
2021-02-16 22:55:40 -05:00
Justin Ethier
d5ba874ae2
WIP, updating function calling conventions
2021-02-16 22:42:36 -05:00
Justin Ethier
2de1eb9e7f
WIP, changing CPS calling conventions
2021-02-15 22:47:33 -05:00
Justin Ethier
496387293f
Merge branch 'cargs-dev' into cargs2-dev
2021-02-15 21:21:15 -05:00
Justin Ethier
b6c2a353a8
Compilation fixes
2021-02-11 22:27:50 -05:00
Justin Ethier
c77cfcd6f7
unpack varargs
2021-02-10 22:28:21 -05:00
Justin Ethier
7974ce9da2
Issue #370 - add type checking for doubles
2021-01-30 17:43:38 -05:00
Justin Ethier
23249133af
Added Cyc_check_argc macro to help w/new functions
2021-01-21 23:03:55 -05:00
Justin Ethier
d2b500278c
Bug fixes
2021-01-07 10:10:25 -08:00
Justin Ethier
abe4e31d05
Added hashset_to_array
2021-01-06 19:58:25 -08:00
Justin Ethier
a5fb3b1b14
Allow (vector?) to recognize and disregard record types
2020-12-21 23:00:43 -05:00
Justin Ethier
c3075a6396
Added record_tag
2020-12-20 22:39:28 -05:00
Justin Ethier
937f6b61c2
Added ffi module
2020-08-14 14:37:19 -04:00
Justin Ethier
9eb67e28e8
Issue #82 - Clean up
2020-06-17 22:54:08 -04:00
Justin Ethier
d96eaab5cc
Issue #388 - Prevent gcc 10.1 build errors
2020-06-04 22:11:50 -04:00
Justin Ethier
3dc451d016
eqv? behavior per R7RS
2020-05-21 18:12:54 -04:00
Justin Ethier
cf6ccc25d9
Issue #377
2020-05-18 18:18:33 -04:00
Justin Ethier
81d2e70037
Issue #374 - Allow full access to open-binary prims
2020-05-17 18:35:12 -04:00