For some reason I decided to rewrite the "wave" program that I wrote in Basic-11, but using DECUS C. I thought that it would be easy, but I didn't count on there not being a math.h. This means that I had to work out how to calculate a sine and cosine for myself. Well, actually I went off to google to see if somebody had already done the hard work for me. Indeed they had, I found it here: www.bsdlover.cn/study/unixtree/V7/usr/src/libm/sin.c.html
That code was already in K&R syntax, but it used modf(), I think that I went off and found some source code for that somewhere else... Anyway, when I had it working, I decided that I might want to use these bits of maths code somewhere else - so I extracted it out into my own library and made "maths.h". So I can now use sin/cos wherever I want.
Anyway, since I went to all that trouble, I thought that I had better post the results. You need to compile maths.c into maths.obj, like this:
RUN C:AS DK:MATHS.S/D
Then, you can #include "maths.h" and link to the maths.obj we created above, like this example:
I expect I'll add more to my maths library as I go, but this is a start.