Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2026-10

Currency update

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth "Kit" Moreton

Hi everyone,

I have to apologise for my recent absence and lack of progress fixing the bugs I've caused.  I'm currently fixing the failure in webtbs/tw41865c.pp which is centred around the division of two Currency types.  I've got it to work on x86_64-win64 (which internally stores it as an Int64) but my fix doesn't work on x86_64-linux (which internally stores it as an Extended). However, while writing this e-mail, the fact I said "Extended" just clued me in... the test itself may be incorrect because the storage formats between integral and floating-point values are fundamentally different.  Back to work I go!

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. www.avast.com

Reply by email

Sven Harazim
to J. Gareth "Kit" Moreton

Hi Gareth,

tw41865c comes from my reproducers for #41865, so here are some measurements that may help.

On x86_64-linux (cross compiler from current main 7a7ff6e731, run under qemu-x86_64) the storage is not the issue: Currency is 8 bytes and holds the scaled Int64 - Currency(10) is raw 100000, as on AArch64. What fails is the compilation:

  tw41865c.pp(12,10) Error: Operator is not overloaded: "Currency" div "Currency"

There Currency is a floating type (s64currency, computed on the x87), and div/mod are not defined for floating types. Would guarding the test with {$ifdef FPC_CURRENCY_IS_INT64} match what you intend, or should div/mod work there too?

On aarch64-win64, !1560 already makes tw41865c pass, and !1576 fixes your tw41865g/h at -O4:
https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1560 https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1576 Could you check whether they overlap with your changes?

Sven

Reply by email

J. Gareth "Kit" Moreton
to Sven Harazim

Ah yes, that makes sense.  My fix-in-progress for div and mod is very similar to 1560 but I use a distinct method to create the Currency scalar that handles the flags etc (although it's otherwise the same).  I like the look of your i and j tests though.

For 1576 I want to avoid using a recursive node search if possible because the "nf_is_currency" flag should be propagated.

Gareth aka. Kit

Sven Harazim wrote 28 lines
Hi Gareth, tw41865c comes from my reproducers for #41865, so here are some measurements that may help. On x86_64-linux (cross compiler from current main 7a7ff6e731, run under qemu-x86_64) the storage is not the issue: Currency is 8 bytes and holds the scaled Int64 - Currency(10) is raw 100000, as on AArch64. What fails is the compilation: tw41865c.pp(12,10) Error: Operator is not overloaded: "Currency" div "Currency" There Currency is a floating type (s64currency, computed on the x87), and div/mod are not defined for floating types. Would guarding the test with {$ifdef FPC_CURRENCY_IS_INT64} match what you intend, or should div/mod work there too? On aarch64-win64, !1560 already makes tw41865c pass, and !1576 fixes your tw41865g/h at -O4: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1560 https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/1576 Could you check whether they overlap with your changes? Sven _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. www.avast.com

Reply by email