Jump to content

David Heffernan

Members
  • Content Count

    3622
  • Joined

  • Last visited

  • Days Won

    179

Everything posted by David Heffernan

  1. David Heffernan

    Rounding issue

    Seems like bad advice. Why would you do this?
  2. David Heffernan

    How do I upgrade an old 2007 project ?

    Generics in 2010 were super bugged but generics is irrelevant for a port. Trying to find versions of all libraries that work with 2010 could be tricky. I see no reason in doing multiple ports here.
  3. David Heffernan

    String comparison in HashTable

    This is the part I didn't watch, but yeah, that makes so much more sense now!
  4. David Heffernan

    String comparison in HashTable

    He's probably using UTF-8
  5. David Heffernan

    Windows 11 (22H2) 8bit bitmap problem

    It's a sign from above
  6. David Heffernan

    String comparison in HashTable

    Perfect hash only works if you can restrict your input domain, or am I wrong?
  7. David Heffernan

    String comparison in HashTable

    The thing is, how are you going to get to the stage where you have got a token that you know is a valid keyword? Perfect hashes are cool and all, but I wonder if this is the best example.
  8. David Heffernan

    String comparison in HashTable

    What seems missing to me is how to restrict the input data to be just valid typescript keywords.
  9. I use option sets. They are in my repo and if I want to change the all my projects pick them up.
  10. David Heffernan

    How do I upgrade an old 2007 project ?

    Nah, I'd go all the way to the latest. Multiple stepping stones is just adding extra complexity. The big change is Unicode. Everything else is simple.
  11. David Heffernan

    Rounding issue

    The Delphi RTL can do this in multiple ways, as discussed here, and elsewhere, by me, ad nauseum.
  12. David Heffernan

    Rounding issue

    Not strictly true. It depends on where they are coming from. It's much more complex than this blanket advice which I always regard as poor advice.
  13. David Heffernan

    Rounding issue

    It's exactly as @Stefan Glienke said. The 32 and 64 bit hardware is different. On 32 bit there are 80 bit floating point registers used for intemediate values. On 64 bit there are not and all FP registers are 64 bit. Did you read the link I gave you? If you have not read that yet then this conversation is rather pointless? You first of all have to appreciate that these values cannot be represented exactly in binary floating point format. Perhaps your real problem is that you are using the wrong data types. Maybe you should be using a decimal data type so that you can represent these values exactly? What are these values? Sometimes floating point is correct, sometimes decimal is correct. Without context we can't know. Or perhaps you already know about floating point representability issues. Do you?
  14. David Heffernan

    Rounding issue

    Here's some Python output that should help: >>> from decimal import Decimal >>> Decimal.from_float(1.015) Decimal('1.0149999999999999023003738329862244427204132080078125') >>> Decimal.from_float(3.015) Decimal('3.015000000000000124344978758017532527446746826171875') >>> Decimal.from_float(1.015*100) Decimal('101.4999999999999857891452847979962825775146484375') >>> Decimal.from_float(3.015*100) Decimal('301.5') And @Stefan Glienke explained why results differ on 32 bit because that uses an intermediate 80 bit extended register that will have different values for the closest representable value.
  15. David Heffernan

    Rounding issue

    You are going to lose your mind when you learn that 1.015 is not representable, and when you write 1.015 in your delphi source code, the compiler turns it into the closest representable number which happens to be 1.0149999999999999023003738329862244427204132080078125 You might want to take a look at this famous question on SO: https://stackoverflow.com/questions/588004/is-floating-point-math-broken
  16. David Heffernan

    Rounding issue

    Why should we do this?
  17. You'd have the answer by now if you'd started stripping stuff out
  18. What does the debugger tell you
  19. David Heffernan

    TToolButton.ImageName Delphi 11 vs Delphi 10

    There's also this technique
  20. David Heffernan

    TToolButton.ImageName Delphi 11 vs Delphi 10

    Simple. Develop in the lowest version that you wish to support.
  21. David Heffernan

    Profiler for Delphi

    That's not what AQtime does. Vtune is essentially analogous to AQtime but far more capable. You aren't going to find this magic solution that you want, whereby you wave a magic wand and your program is suddenly much faster. Optimisation though is going to take effort from you to understand your program. No shortcuts.
  22. Buy a GPS watch. Or install strava on your phone.
  23. David Heffernan

    Wow64EnableWow64FsRedirection

    I can't make any sense of this. Maybe an complete but minimal program would help, and knowledge of whether your process is 32 or 64 bit. Also, do you know about sysnative?
  24. Well, true, but everything would break. So it's not going to change. And I think that's why it has been documented. I think it wasn't originally documented but at some point MS realised that this has become a contract that can't be broken.
  25. David Heffernan

    Messageloop in Omnithread task

    I wish the language would require parens for parameterless calls.
×