Jump to content

Leif Uneus

  • Content Count

  • Joined

  • Last visited

Community Reputation

40 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Leif Uneus

    A gem from the past (Goto)

    Ahh, the horror of programming games with the Commodore VIC-20 using the tape recorder ...
  2. Leif Uneus

    Quality Portal going to be moved

    Last time this happened you were supposed to repost your unresolved QC contributions into the new system. And after some time the old QC portal was completely removed.
  3. You have to declare the array type in order to use RTTI. RTTI only works on pre-defined types. TMyArray = array[0..1] of Integer;
  4. Leif Uneus

    Removing String

    In short, you want to remove all strings in brackets, including the brackets.
  5. We have equipment for linear movement that is controlled by 4 nanometer precision. All controlled by stepper motors with the help of integers. Even though it is pascal, the programming language is not important.
  6. First of all, precision depends on the hardware. If you have a 6 axis movement, how accurate is the movement of all those axis? Secondly, how is the movement controlled? Resolution? Error in the resolution? Last in that chain comes the controlling equipment, speed and other things that might concern the precision.
  7. Leif Uneus

    Rounding issue

    Threads can have different rounding modes. Raymond Chen. https://stackoverflow.com/q/72244777/576719 Are floating point operations deterministic when running in multiple threads? Some of your code may change the floating point settings, or even change them without restoring them. That goes for third party code in your program as well. And don´t get @David started with what dll's can surprise you with.
  8. Leif Uneus

    Open IDE in DPI Unaware??

    I wish the IDE could have a zoom option when displaying/editing forms.
  9. Leif Uneus

    32bit vs 64bit

    Just for fun, read this article by W. Kahan and J.D. Darcy about the usefulness of extra precision. "How Java’s Floating-Point Hurts Everyone Everywhere" https://people.eecs.berkeley.edu/~wkahan/JAVAhurt.pdf
  10. Leif Uneus

    32bit vs 64bit

    No, I know what he meant. And from a discussion we had a couple of years ago I can only agree. I may have to rewrite the code eventually if I move to another platform, but until then I have a well working application.
  11. Leif Uneus

    32bit vs 64bit

    At the time it was like a Concorde. Name a mean of travel that is faster for the public today.
  12. Leif Uneus

    32bit vs 64bit

    I'm nobody. I still use the extended type, and I'm a developer of mathematical software. The algorithm was the only one that could be executed fast enough (and with the precision needed) in the days of Turbo Pascal. Sure, there are other algorithms today that has better performance without the extended types, but why invest time when it's still fully functional.
  13. @Fr0sT.Brutal The algo is using floating point values, hence the bad performance. I made a mistake in my previous code. There is a gap between MaxLongInt and the next upper boundry. Your code suffers from that too. Test with AltCntCaseTbl2(Int64(MaxLongInt)+1) Here is my correction: function AltCntCaseTbl(v : Int64) : Int64; inline; begin if (v <= MaxLongInt) then begin if (v >= 1000000000) then Exit(10); if (v >= 100000000) then Exit(9); if (v >= 10000000) then Exit(8); if (v >= 1000000) then Exit(7); if (v >= 100000) then Exit(6); if (v >= 10000) then Exit(5); if (v >= 1000) then Exit(4); if (v >= 100) then Exit(3); if (v >= 10) then Exit(2); if (v >= 0) then Exit(1); Exit(0); end; if (v >= 1000000000000000000) then Exit(19); if (v >= 100000000000000000) then Exit(18); if (v >= 10000000000000000) then Exit(17); if (v >= 1000000000000000) then Exit(16); if (v >= 100000000000000) then Exit(15); if (v >= 10000000000000) then Exit(14); if (v >= 1000000000000) then Exit(13); if (v >= 100000000000) then Exit(12); if (v >= 10000000000) then Exit(11); Exit(10); end;
  14. Almost a magnitude faster algorithm: function AltCntCaseTbl( v : Int64) : Int64; inline; begin if (v < 0) then Exit(0); if (v > MaxLongInt) then begin if (v >= UInt64(10000000000000000000)) then Exit(20); if (v >= UInt64(1000000000000000000)) then Exit(19); if (v >= UInt64(100000000000000000)) then Exit(18); if (v >= UInt64(10000000000000000)) then Exit(17); if (v >= UInt64(1000000000000000)) then Exit(16); if (v >= UInt64(100000000000000)) then Exit(15); if (v >= UInt64(10000000000000)) then Exit(14); if (v >= UInt64(1000000000000)) then Exit(13); if (v >= UInt64(100000000000)) then Exit(12); if (v >= UInt64(10000000000)) then Exit(11); end; if (v >= UInt64(1000000000)) then Exit(10); if (v >= UInt64(100000000)) then Exit(9); if (v >= UInt64(10000000)) then Exit(8); if (v >= UInt64(1000000)) then Exit(7); if (v >= UInt64(100000)) then Exit(6); if (v >= UInt64(10000)) then Exit(5); if (v >= UInt64(1000)) then Exit(4); if (v >= UInt64(100)) then Exit(3); if (v >= UInt64(10)) then Exit(2); Result := 1; end;