Commit Graph

20 Commits

Author SHA1 Message Date
flatmush 5dd63f37ce Updated sin lut to use ~200KiB for it's table with the same accuracy, the lookup table implementation tends to run at about 33-36% of the speed of sinf on my machine (Intel T5500).
Fixed a bug in the sin lut code so that the results are always accurate.
Changed fixsingen tool to generate tables correctly for the new implementation.
2011-02-25 16:07:39 +00:00
flatmush 0317f964f4 Added option to replace sin function with ~384KiB look-up table for fastest and most accurate results.
Added tool to generate sin tables.
Tests indicate that using a lut is still ~2.1% out from sinf so it's very possible that our sin function is more accurate than the libmath sinf function on the computer I'm testing with. In which case the accuracy results are offset by that amount.
2011-02-25 15:32:23 +00:00
flatmush 0ecfa08dc3 Added a new faster version of the sin function, it loses 0.2% accuracy for a speed gain of 159%. The accuracy of the standard implementation is ~2.1% while this is ~2.3%.
This can be enabled using the FIXMATH_FAST_SIN macro.
2011-02-25 13:37:37 +00:00
flatmush 10c82e1c17 Fixed a minor error in previous commit where the wrong function name is printed. 2011-02-25 12:09:55 +00:00
flatmush 8cbe9b3f9b Added fix16_exp currently using the Taylor Series algorithm off Wikipedia, if anyone can optimize this better then go ahead.
Modified fixtest to be a little more generic, can now easily change which function it tests.
2011-02-25 12:08:03 +00:00
Flatmush 7c2852e7f6 Changed conversion functions to macros so that they can be optimized out by the compiler which should make optimized functions much more readable.
Implemented FIXMATH_NO_ROUNDING in all multiplication and division functions too, it should now work for all functions in the library and allow for a choice between speed and accuracy on different projects.
2011-02-24 20:04:55 +00:00
flatmush d829f83d31 Updated fix16_atan, now removes some un-necessary code.
Added FIXMATH_NO_ROUNDING macro to disable rounding, currently only applies to fix16_atan but will change to apply this to other operations (namely mul/div) too.
Changed optimization options for rel build in code::blocks project.
2011-02-24 17:18:08 +00:00
flatmush 3fc97475e1 Added multi-pass approach to fixtest, now produces more accurate results. On x86 with an FPU and full optimization fixed point is about 20% slower than floating point.
The multi-pass approach means that this test should run unmodified on embedded environments due to lower memory usage, this test also more realistically tests for cache behaviour.
2011-02-24 17:13:30 +00:00
flatmush a9ff155dcc Minor fix regarding printf format in fixtest. 2011-02-24 16:57:54 +00:00
flatmush edce6d699e Fixed an obvious bug, error was reported at 65536 times the correct value, real value for error is between 0.0060% and 0.0085%.
Changed default values to more sensible ones, though iter will need to be lowered if run on an embedded environment.
2011-02-24 16:48:57 +00:00
flatmush d3482256c2 Added a small program called fixtest which currently tests performance and average error on x86 platforms, currently it produces quite wildly varying results depending on the input values.
The average error seems to vary between 3-8%, it's possible that setting iter to a higher value (and pass to a lower one) could give a more stable value.
Fixed point seems to be slower overall on x86 (50% of float) with good floating point hardware, however with the caching enabled depending on the program the fixed point implementation may be much faster (as float would be if cached).

With caching enabled there is a massive difference between and iter size below and above 4096, this is because the caching mechanism thrashes above this threshold, it probably makes sense to disable caching for these tests by compiling libfixmath with FIXMATH_NO_CACHE.
2011-02-24 16:23:50 +00:00
Flatmush 0e06a1e8b7 Edited wiki page Microcontroller_Usage through web user interface. 2011-02-24 13:43:47 +00:00
joe.schaack b3cdf32f8d Edited wiki page Microcontroller_Usage through web user interface. 2011-02-24 02:34:23 +00:00
joe.schaack 14492d6692 Created wiki page through web user interface. 2011-02-24 02:32:03 +00:00
flatmush f5cb74ab2e Added an optimized and improved implementation of joe's fixed point atan2 algorithm so that it now works correctly over the full range of fixed point numbers and should be much faster too. 2011-02-23 17:07:17 +00:00
flatmush 5d939700e8 Fixed errors in asin/atan, where incorrect integer maths was used.
Added a macro (FIXMATH_NO_CACHE) to disable caching.
Added fix16_lerp8 and fix16_lerp32 (should be part of fract module really).
2011-02-23 09:47:08 +00:00
Flatmush e06f826388 Changed consts such as e, pi, one to macros as suggested by mth for compiler optimization purposes. 2011-02-14 21:53:27 +00:00
Flatmush 87c75fa880 Updated code::blocks project file. 2011-02-14 21:02:23 +00:00
Flatmush 75076642f5 Deleted objects and compiled files which should never have been uploaded. 2011-02-14 21:00:45 +00:00
Flatmush 3420855dc0 Initial commit. Since its use in fgl and the Dingoo SDK the functions have been separated into more descriptive files/modules. 2011-02-14 20:59:41 +00:00