fcard / c23meta Goto Github PK
View Code? Open in Web Editor NEWMetaprogramming exercises using c23.
License: MIT License
Metaprogramming exercises using c23.
License: MIT License
For some reason I kept doing this:
DEFER(CAT(X,Y))()
That's unnecessary and just adds scans, save for very specific arguments.
The cats must be freed from their defer prisons.
printf("trunc(-sqrt(32)): %f", FP32_CONVERT(FP32_TRUNC(FP32_NEG(FP32_SQRT(FP32_32)))));
trunc(-sqrt(32)): -6.313708
fweh. prolly just need to get its absolute value and then negate it if it was negative. time to add a FP32_WITH_SIGN
as wew.
I should be more careful doing stuff like this:
#define FP32_CLASSIFY(X) CAT_ALL(_FP32_CLASSIFY, FP32_IS_NAN(X), FP32_IS_INF(X), FP32_IS_ZERO(X))
I need to pass the argument into a macro first before having its argument appear more than once.
I should check the other datatypes as well.
There's already a 'hex' one for hexadecimal digit operations, so there should be one for binary digit operations, instead of me copy pasting them into every binary datatype (or worse, depending on other datatypes being included and making them depend on one another unnecessarily)
those are missing. Can probably base them on trunc and do some equality and sign checking tests to get them to behave as they should. FP32_ROUND
is also missing but that will be a separate issue since that one is more complicated.
Float ops are pretty slow as they are but it would be good at least for them to handle special values properly (NaN, Inf, zero)
For some reason I thought just multiplying teh exponents was enough, but actually the mantissa also needs to be multiplied, duh.
Instead of just printing the values of tests, there should be actual testing. Maybe not yet making use of a unit test library but at least checking that the results are correct and exiting/reporting otherwise.
So I don't forget, tuple foreach needs to have its eval function changed to use __VA_ARGS__
, just like list foreach
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.