126 reputation
2
bio website
location
age
visits member for 2 years, 2 months
seen Dec 22 at 14:55

Jul
9
awarded  Teacher
Jul
9
answered Python API: Extension Module or Pure Module
May
7
comment comparison of floating point numbers vs. comparsion of Integers in C
0.219s vs 0.263 is not a huge difference given other factors such as dj bazzie wazzie points out. Write a test program that first loads the array into memory then time just the sort routine. Use an array large enough that the longest case takes minutes or at least several seconds (but not large enough that the OS swaps pages) then draw conclusions from there.
May
7
comment comparison of floating point numbers vs. comparsion of Integers in C
@gon1332, I'm not sure if floats actually perform better than doubles. Many FP CPUs operate on numbers internally in high precision then convert to lower precision for transfer. When I learned x86 FP assembly the book mentioned that "besides memory space, the only upside to using single precision performancewise is the educational value of learning that more precision is better" (quote from memory)
May
7
comment comparison of floating point numbers vs. comparsion of Integers in C
A sorting routine can be made very efficient for floating point as long as you don't compare for equality and just use >, >= operators... OTOH if you use a stock sort() library routine and must provide a function that returns -1, 0 or 1 if the numbers are less than, equal or greater than, then you may be forced to compare for equality and are screwed.
May
7
comment comparison of floating point numbers vs. comparsion of Integers in C
I don't see the OP's time differences as dramatic and can be explained mainly by points 1-4 above rather than in the CPU's ability to handle integers better than floating point numbers which, although existing, would be minimal compared to other factors.
Oct
15
awarded  Supporter