ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
28 stars 7 forks source link

Basic floating point support. #1258

Closed vext01 closed 1 month ago

vext01 commented 1 month ago

This gives us just enough floating point support to print a float value in a test.

We only support the common floating point types: float and double.

Requires https://github.com/ykjit/ykllvm/pull/175

ltratt commented 1 month ago

This looks good but could we quickly add:

Both well make it less likely we accidentally break things in the future :)

vext01 commented 1 month ago

ah, sorry, wasn't aware of those tests. Yep, will add some.

vext01 commented 1 month ago

I just realised that i accidentally re-used an old branch unintentionally! Never mind, it should be ok.

vext01 commented 1 month ago

https://github.com/ykjit/yk/pull/1258/commits/33b8901951a78019c98cb95d76b1eee065d29102 adds tests (and strengthens some checks).

OK to squash.

ltratt commented 1 month ago

Please squash.

vext01 commented 1 month ago

squashed.

vext01 commented 1 month ago

This is a strange error:

11:36:58      Running `target/debug/xtask cfmt --check`
11:36:58 ./tests/c/double.newcg.c:51:46: error: code should be clang-formatted [-Wclang-format-violations]
11:36:58     fprintf(stderr, "%d -> %f\n", i, (double) i);
11:36:58                                              ^
11:36:58 
11:36:58 ./tests/c/float.newcg.c:53:45: error: code should be clang-formatted [-Wclang-format-violations]
11:36:58     fprintf(stderr, "%d -> %f\n", i, (float) i);
11:36:58                                             ^
11:36:58 

I am unable to reproduce it, but also the error is really generic and doesn't actually say what the problem is.

Any ideas?

vext01 commented 1 month ago

Sorry, I got it. I was on the wrong commit. It wants me to remove the space between the cast.

vext01 commented 1 month ago

Force pushed the fix.