Make a comment to the author.


Basic and Newbie Questions

Question 1. Linux doesn't have the sin() [or some other common] function.

Answer 1. You are probably new to Linux (or UNIX) and don't know that you must tell the linker to link your program with the appropriate libraries, e.g. instead of compiling with the following command:

           gcc -o myprog myprog.c
you need to do:
           gcc -o myprog myprog.c -lm
The "-lm" tells the linker to also look in the standard "maths" library which should be found in the standard place. (Your system should have at least /usr/lib/libm.a)
Question 2. gcc is bugged, it gives a * (1 / a) != 1

Answer 2. Floating point numbers are an approximation to Real numbers. Floating point arithmetic is not exactly the same as Real number arithmetic, but instead it is a useful approximation. If you don't understand that the following is true for Real numbers (provided that a is not zero), but is often false for floating point numbers, even if there are *no* errors in the floating point arithmetic, then you should refer to a good text book and learn some of the basics:

           (1.0 / a) * a  == 1.0