takagi / cl-cuda

Cl-cuda is a library to use NVIDIA CUDA in Common Lisp programs.
MIT License
280 stars 24 forks source link

kernel `-` function does not correspond to lisp `-` #89

Closed DrSplinter closed 6 years ago

DrSplinter commented 6 years ago

(- 2 3 4) is compiled to 2 - 3 - 4, which does not correspond to lisp behaviour. It should be compiled to 2 - (3 + 4).

takagi commented 6 years ago

What resource specifies the behavior?

At least, I can't read the difference between 2 - 3 - 4 and 2 - (3 + 4) from the description of CLHS minus function :

If more than one argument is given, it subtracts all of the subtrahends from the minuend and returns the result.
DrSplinter commented 6 years ago

I'm sorry for wrongly describing the problem. If you compile (- 2 3 4) you get (2 - (3 - 4)) in CUDA C which is different from 2 - (3 + 4).

takagi commented 6 years ago

Oh... it's completely wrong. Thanks for the report!

DrSplinter commented 6 years ago

No problem, I'm happy to help. It took me few hours to figure this out :-D. Btw have a look on / too.