Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fixed is broken (*solved*)
#4
boriel Wrote:This is related to the completely rewritten backend compiler module (1.2.7 undergone an entire new preprocessor which now allows function inlining -using complex macros with parameter substitution). Now it's time to fix backend when I realised the bug I introduced in 1.2.6 :oops: This means I have to re-check almost every expression case in every context for every type (array, assignation, evaluation, etc for UByte, Byte, Uinteger, Integer, Ulong, Long, Fixed, Float, String) :oops:

Oh dear. Cry Sorry! Some of the adjustments you've made have been pretty big - and quite clever - but sadly, that sort of thing almost always causes bugs. If there's anything I can do to help, please let me know.

boriel Wrote:PS: I think fsin.bas should be renamed to fmath.bas since it contains many math functions (even sqrt?). It you think it's ready it can be packaged with the compiler from now on.

Um, no? fSin only does Sine functions, as a fast and rougher (less accurate) calculation as written there. I have fcos.bas and ftan.bas as separate files, though they do call fSin. I suppose we could package them all up as fTrig.

There's are two square root functions in the library; fSqrt, which uses the FP calculator to calculate square roots six times faster than the rom code, with full decimal accuracy. I still think that's small enough you might want to default to it if someone uses square roots. iSqrt does integer square roots - so iSqrt(10) comes back as 3 - it basically loses the decimal in the answer. It's about 100X faster than the ROM code for 16 bit numbers, and 50X faster for 32 bit numbers; and given how slow the ROM code is, it can be quite a big difference. If anyone is ever thinking of doing anything like 3d/2d vector graphics, these two will come in very useful.

The maths functions in the library seem solid, apart from issues with the fixed point type.

Please see <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Library">http://www.boriel.com/wiki/en/index.php ... IC:Library</a><!-- m --> for details.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)