Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Hey Y'All, With the rounding function changed, so did the output hash. New hash and archived output from baseline are now up on the repo. Cheers, Gus
  3. Today
  4. darnocian

    Regression - Delphi 12 - IsZero()

    The rationale for it is when it comes to rounding due to the way the float is represented with limited bits... there will be to mismatches. You may be lucky, and comparison may work, but the epsilon comparison approach is a failsafe method to cater for rounding issues in the process of various calculations. Here is a simple example. procedure Test; var d: double; d2: double; diff: double; v, v2: double; begin d := 1.0000002; d2 := 1.0000001; v := 0.0000001; v2 := 0.0000001; diff := d - d2; // 9.99999998363421e-08 assert(v = v2); // values do match assert(diff <> v); // doesn't match because of rounding assert(SameValue(diff, v)); end; above done on win32. I aligned the numbers on purpose... if we do the math, we can see v should be d-d2. v = v2 is true.... then noddy calculation, we have diff = d-d2... and diff <> v, but SameValue with the epsilon shows with the given precision, we assume the numbers to be the same.
  5. Yesterday
  6. Hey Y'All, Looks like there is a simple fix: Not using Double but Currency. function RoundExDouble(x: Currency): Double; begin Result := Ceil(x * 10) / 10; end; Does not fix the issue that Delphi is not consistent with Double across Windows 32,64 and Linux 64. But at least we now have consistency on our end!!! Many thanks to paweld for spotting the fix!! Cheers, Gus
  7. uses Vcl.Forms, MyUnit, //From TrPartUnits.bpl, if remove, breakpoint works in win32 and win64 AppForm in 'AppForm.pas' {Form2}; {$R *.re Based on your info when the myunit is removed it compiles. Delphi 12 in debugger mode even with update often shows the dissembler first under a tab. To avoid compile the program and start the program using the browser in "attach to process" under the run button to start the executable and press f7-f9 buttons if hung up in the dissembler. If blue dots not lined up with the source check path.
  8. Hey Y'All, We seem to have a bit of a problem: https://github.com/gcarreno/1brc-ObjectPascal/tree/main/spelunking/roundex See attached image. Cheers, Gus
  9. DelphiUdIT

    kuLibrary

    @shineworld use the last link ...
  10. @Pat Foley, What does this have to do with the fact that breakpoint doesn't work in win64?
  11. Remy Lebeau

    Bugs - where to write to fix it?

    In case anyone is not already aware of this https://quality.embarcadero.com is now in a permanent read-only mode. A new system is being implemented, but has not been opened to the public yet. So, if you do have a legit bug/feature to report, feel free to post it in a public forum, or write to Embarcadero directly, and someone who has internal access to the new system can open tickets for you until the new system is ready for public use.
  12. kuzduk

    Hotkey Editor

    Strikethrough On the hockey-stick I rotate these combinations reserved by the system: I assign mine global hot keys with Win on top using KeyboardManiac and I wish the same for you!
  13. shineworld

    kuLibrary

    Antivirus block page access:
  14. David Heffernan

    Regression - Delphi 12 - IsZero()

    Floats can be compared for exact equality, in plenty of circumstances. The beginner mistake is to use some epsilon value without any sound rationale for it. Usually, and works pretty good, and for the majority of cases doesn't sound great with my numerical programming head on.
  15. Uwe Raabe

    Regression - Delphi 12 - IsZero()

    I beg to differ here. The approach is to have a decent epsilon when no one is given. It doesn't prohibit anyone to give an epsilon appropriate to the current scenario. The default values currently used actually cover a common beginner's mistake assuming that floats can be compared for exact equality. Usually the IsZero implementation works pretty good for the majority of the cases - at least those I encountered myself. Perhaps you just never stumbled about code using them appropriately?
  16. David Heffernan

    Regression - Delphi 12 - IsZero()

    This entire approach of applying some arbitrary epsilon is rubbish. I can't imagine any scenarios where they'd be useful and I've only ever seen them used inappropriately.
  17. Nice, good points. After implementing a block of code all different ways and then just staring at it for awhile, I also decided Pattern 2 seems best. Sometimes, you don't really know until you try it with real code. Using the anonymous method pattern for the fetch loop code makes it easier to just plainly see that database fetching is going on and just seems more elegant. As for getting column/field data, pattern 3, using implicit, indeed, made the code harder to read and contextualize. Then, your three little lines of code there are all good ideas, too, which I intend to implement. Thanks.
  18. Brandon Staggs

    Hotkey Editor

    There's a good reason this isn't included in the list of possible shortcuts. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerhotkey "Keyboard shortcuts that involve the WINDOWS key are reserved for use by the operating system."
  19. darnocian

    Regression - Delphi 12 - IsZero()

    What do you mean by useless? Just not liking the specific implementation?
  20. Uwe Raabe

    Regression - Delphi 12 - IsZero()

    Actually, they are not that magic:
  21. kuzduk

    kuLibrary

    All screenshot and detailed description u can see in official site of kuLibrary: https://kuzduk.ru/delphi/kulibrary This forum not support bb-code - this is certainly strange in 2024, therefore I give some attaches.
  22. David Heffernan

    Regression - Delphi 12 - IsZero()

    The best way to deal with this is never to call any of these functions in the first place, they are all useless
  23. Sherlock

    Regression - Delphi 12 - IsZero()

    OK here's what I don't get. Seeing this const FuzzFactor = 1000; SingleResolution = 1E-7 * FuzzFactor; DoubleResolution = 1E-15 * FuzzFactor; I have to ask myself, why not const SingleResolution = 1E-4; DoubleResolution = 1E-12; Sure the calculation happens only once, and FuzzFactor seems to explain a magic number but then we still have those other magic numbers... just an observation.
  24. darnocian

    Regression - Delphi 12 - IsZero()

    I was looking at docs: https://docwiki.embarcadero.com/Libraries/Athens/en/System.Extended I'm not a fan of the type being so different between platforms. My memory is still 64kb, so am relying too much on ChatGPT these days 😉 There is float32 and float64... maybe making a few more types indicating how many bits can also help make the size a bit more obvious.
  25. darnocian

    Regression - Delphi 12 - IsZero()

    Floating point is always fun. Math.IsZero has 3 overloads for different types - extended, double, single With a simple test app on Delphi 12: program Project1; {$APPTYPE CONSOLE} {$R *.res} uses System.Math, System.SysUtils; procedure Test; var e: extended; d: double; s: single; te, td, ts: boolean; begin e := 3.5527136788055E-15; d := 3.5527136788055E-15; s := 3.5527136788055E-15; te := iszero(e); td := iszero(d); ts := iszero(s); end; begin try Test; except on e: Exception do Writeln(e.ClassName, ': ', e.Message); end; end. On Win32, I was surprised that 'te' is false. On Win64, the values are as expected. Something to note for those that don't know. In Win64, 'extended' is 64bit like 'double', where on Win32 it is 80bit. I didn't check between versions, but is the resolution the same? Squirrelled away on line 5290 in System.Math, there is: const FuzzFactor = 1000; SingleResolution = 1E-7 * FuzzFactor; DoubleResolution = 1E-15 * FuzzFactor; {$IFDEF EXTENDEDHAS10BYTES} ExtendedResolution = 1E-19 * FuzzFactor; {$ELSE !EXTENDEDHAS10BYTES} ExtendedResolution = DoubleResolution; {$ENDIF !EXTENDEDHAS10BYTES} IMO I think those consts should probably be variables and in the interface section so they can be overridden if required. It does look like something buggy happening with the 'Extended' type on win32... I played with SameValue and Compare( which uses SameValue), which didn't look bad. SameValue/Compare take an Epsilon (the resolution). Stepping through IsZero, what I spotted in the debugger: if Epsilon = 0 then Epsilon := ExtendedResolution; After the assignment to Epsilon, Epsilon was 0 and not 1e-16. On 64bit, Epsilon becomes 1e-12. So something funky with the codegen? I recall some changes to FP operations in the new compiler, but I can't recall offhand.
  26. iqrf

    Using Delphi enum in Python

    OK 😞 So I define an enum in python and use it in delphi, which works. Now I understand why it is like this: procedure TButtonsRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper); begin inherited; APyDelphiWrapper.DefineVar('bkCustom', bkCustom); APyDelphiWrapper.DefineVar('bkOK', bkOK); APyDelphiWrapper.DefineVar('bkCancel', bkCancel); APyDelphiWrapper.DefineVar('bkHelp', bkHelp); APyDelphiWrapper.DefineVar('bkYes', bkYes); APyDelphiWrapper.DefineVar('bkNo', bkNo); APyDelphiWrapper.DefineVar('bkClose', bkClose); APyDelphiWrapper.DefineVar('bkAbort', bkAbort); APyDelphiWrapper.DefineVar('bkRetry', bkRetry); APyDelphiWrapper.DefineVar('bkIgnore', bkIgnore); APyDelphiWrapper.DefineVar('bkAll', bkAll); end; Thanks for your time.
  27. pyscripter

    Using Delphi enum in Python

    It's not how it works.
  1. Load more activity
×