Welcome, Guest
Username: Password: Remember me
CodeTyphon MS Windows (Win7, Win8.x, Win10 and Win11) OS Development, discussions and problems
  • Page:
  • 1

TOPIC:

The trunс() does not support Extended 3 days 18 hours ago #18654

  • Roman
  • Roman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 99
  • Thank you received: 0
According to the documentation, the trunc function takes an argument of type ValReal, which in turn is defined as Extended(www.freepascal.org/docs-html/rtl/system/valreal.html). However, in systemh.inc the definition is different:
{$ifdef CPUX86_64}
{$ifdef FPC_HAS_TYPE_EXTENDED}
  { win64 doesn't support the legacy fpu }
  {$define DEFAULT_EXTENDED}
  {$define SUPPORT_EXTENDED}
  {$define SUPPORT_COMP}
  {$ifndef FPUNONE}
    ValReal = Extended;
  {$endif}
{$else FPC_HAS_TYPE_EXTENDED}
  {$define DEFAULT_DOUBLE}
  {$ifndef FPUNONE}
    ValReal = Double;
  {$endif}
{$endif FPC_HAS_TYPE_EXTENDED}

When installing CT64 on Windows10 64bit with Intel i5 or i7  ValReal is Double, but for CT32  VarReal is Extended!!! Why?!?!?!
Because of this, using Extended is impossible, because trunc generates an exception in many cases. In particular, this is a big problem in PascalSCADA, where this function is used to work with 32-bit numbers.

Please Log in or Create an account to join the conversation.

Last edit: by Roman.

The trunс() does not support Extended 3 days 15 hours ago #18655

  • Matis A.
  • Matis A.'s Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1102
  • Thank you received: 160
It's FreePascal staff, Sir

In many CT packages, we use "Single" or "Float"
PilotLogic Core Programmer
The following user(s) said Thank You: Roman

Please Log in or Create an account to join the conversation.

Last edit: by Matis A..

The trunс() does not support Extended 3 days 47 minutes ago #18656

  • Roman
  • Roman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 99
  • Thank you received: 0
Thank you, but your answer did not help me .
What should I do?
1. Change the PascalSCADA source code, adding my own trunc edition, and making my program effectively incompatible with the main PascalSCADA package
2. Rebuild СT64 with manually forced specification of options for ValReal=Extended
3. Refuse to build a 64-bit application in favor of a 32-bit one, where everything works correctly
4. ???????

Please Log in or Create an account to join the conversation.

The trunс() does not support Extended 3 days 44 minutes ago #18657

  • Roman
  • Roman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 99
  • Thank you received: 0
I also intend to compile my application in Linux - how are things with my problem there? I haven't tried to do it myself yet...

Please Log in or Create an account to join the conversation.

The trunс() does not support Extended 2 days 21 hours ago #18659

  • Matis A.
  • Matis A.'s Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1102
  • Thank you received: 160
Please,
a sample with the problem for testing...

My suggestion is to use 64bit 
PilotLogic Core Programmer
The following user(s) said Thank You: Roman

Please Log in or Create an account to join the conversation.

  • Page:
  • 1