Jump to content

David Heffernan

Members
  • Content Count

    3586
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by David Heffernan

  1. David Heffernan

    Rounding issue

    The Delphi RTL can do this in multiple ways, as discussed here, and elsewhere, by me, ad nauseum.
  2. 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.
  3. 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?
  4. 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.
  5. 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
  6. David Heffernan

    Rounding issue

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

    TToolButton.ImageName Delphi 11 vs Delphi 10

    There's also this technique
  10. David Heffernan

    TToolButton.ImageName Delphi 11 vs Delphi 10

    Simple. Develop in the lowest version that you wish to support.
  11. 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.
  12. Buy a GPS watch. Or install strava on your phone.
  13. 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?
  14. 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.
  15. David Heffernan

    Messageloop in Omnithread task

    I wish the language would require parens for parameterless calls.
  16. An HMODULE has always been the base address of the module, as loaded into its process. And it's documented here: https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types#HINSTANCE
  17. Stack location has never been repeatable. And as for the module, it starts at HInstance. As it always has. And DLLs have always needed to be relocatable. It's just Windows EXEs that previously could be relied upon to have a known start address. So yeah, change $00400000 to HInstance and it's all good.
  18. Yeah, don't understand why you think that this is a Delphi issue. The executable that Delphi produces is fine. You then mangle it and it fails. Speak to the developer of the code that mangled your exe. It's common, and always has been, for such so-called protection schemes to fail. It's the risk you take on when you start mangling executable files like this.
  19. Probably the issue is in your code to do this encryption. We don't know what that code is.
  20. David Heffernan

    Hosting a console in a Delphi Application

    If you look at other IDEs that have console windows, they don't do cross process window parenting.
  21. David Heffernan

    Problem writing to memo on main form from thread

    Why would we even need to call Update. I think I'd want to understand that first, because it's probably indicative of a design flaw.
  22. David Heffernan

    Replacement for TBits?

    There's literally one in this thread.
  23. David Heffernan

    Turbo SynEdit & Font Ligatures

    That's pretty funky. Sadly not practical for actual use.
  24. David Heffernan

    Replacement for TBits?

    It's obviously more complicated for the programmer to use MMF than plain memory. Unless there was a benefit to using MMF then there's no point in taking on that complexity.
  25. David Heffernan

    Replacement for TBits?

    If you simple want a block of bytes, just use memory. Why use MMF? Here’s an example of why you might use MMF, for cross process sharing. But that isn't what this topic is abkut. I can't see anything in this topic that suggests that MMF would add anything over plain memory. Or have I missed something?
×