2 ms·
At least you wrote the program to generate it rather than typing all that by hand. I think you got the gist of the idea. In any case, would all those branches b
by gcr 15y ago
At least you wrote the program to generate it rather than typing all that by hand. I think you got the gist of the idea. In any case, would all those branches be faster than the comparatively expensive floating-point arithmetic?
- Retric 15y agoNo, at best you could do a binary search using if's to simulate a lookup table, but you are going to trash the pipeline on a modern CPU if you want a reasonably complex lookup table you are much better off with something like: float lookup_Sine(x){ int I = 100 * (x mod 360); return sine_table(I); } Anyway, for a modern CPU hitting main memory takes a lot of cycles. So you need something a lot more complex than a simple trig function to make it worth it.