View Issue Details

IDProjectCategoryView StatusLast Update
0036108FPCRTLpublic2019-10-07 17:27
ReporterBOSHUAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1Product Build 
Target VersionFixed in Version 
Summary0036108: Identifier MAXEXTENDED is not found when targeting win64
DescriptionWhen I'm trying to build an app crosscompilling to win64, I get an "Error: Identifier not found "MAXEXTENDED"". MaxSingle, MaxDouble and MaxExtended are declared within the math unit.
I expect both maxextended and minextended to be known identifiers when targeting win64. Maybe minextended should equal mindouble and maxextended should equal maxdouble constants, I'm not sure.
Anyway, marcov pointed to me that Delphi seems to define maxextended in win64 mode, too(https://forum.lazarus.freepascal.org/index.php/topic,46881.0.html?PHPSESSID=1eojft31i28u9butt43thdnp93).
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files
  • extended.patch (463 bytes)
    Index: rtl/objpas/math.pp
    ===================================================================
    --- rtl/objpas/math.pp	(revision 43098)
    +++ rtl/objpas/math.pp	(working copy)
    @@ -78,6 +78,10 @@
         const
           MinDouble    =  5.0e-324;
           MaxDouble    =  1.7e+308;
    +  {$ifndef FPC_HAS_TYPE_EXTENDED}      
    +      MinExtended  =  MinDouble;
    +      MaxExtended  =  MaxDouble;
    +   {$endif}
     {$endif FPC_HAS_TYPE_DOUBLE}
     {$ifdef FPC_HAS_TYPE_EXTENDED}
         const
    
    extended.patch (463 bytes)
  • MinMaxExtendedDouble.patch (1,227 bytes)
    --- rtl/objpas/math.pp	2019-10-06 11:11:50.000000000 +0300
    +++ rtl/objpas/math2.pp	2019-10-07 18:19:05.502427651 +0300
    @@ -69,21 +69,36 @@
     {$ENDIF}
     
         { Ranges of the IEEE floating point types, including denormals }
    -{$ifdef FPC_HAS_TYPE_SINGLE}
    +{$if defined(FPC_HAS_TYPE_SINGLE)}
         const
           MinSingle    =  1.5e-45;
           MaxSingle    =  3.4e+38;
    -{$endif FPC_HAS_TYPE_SINGLE}
    -{$ifdef FPC_HAS_TYPE_DOUBLE}
    +{$endif}
    +
    +{$if defined(FPC_HAS_TYPE_DOUBLE)}
         const
           MinDouble    =  5.0e-324;
           MaxDouble    =  1.7e+308;
    -{$endif FPC_HAS_TYPE_DOUBLE}
    -{$ifdef FPC_HAS_TYPE_EXTENDED}
    +{$elseif defined(FPC_HAS_TYPE_SINGLE)}
    +    const
    +      MinDouble    =  MinSingle;
    +      MaxDouble    =  MaxSingle;
    +{$endif}
    +
    +{$if defined(FPC_HAS_TYPE_EXTENDED)}
         const
           MinExtended  =  3.4e-4932;
           MaxExtended  =  1.1e+4932;
    -{$endif FPC_HAS_TYPE_EXTENDED}
    +{$elseif defined(FPC_HAS_TYPE_DOUBLE)}
    +    const
    +      MinExtended  =  MinDouble;
    +      MaxExtended  =  MaxDouble;
    +{$elseif defined(FPC_HAS_TYPE_SINGLE)}
    +    const
    +      MinExtended  =  MinSingle;
    +      MaxExtended  =  MaxSingle;
    +{$endif}
    +
     {$ifdef FPC_HAS_TYPE_COMP}
         const
           MinComp      = -9.223372036854775807e+18;
    

Activities

Thaddy de Koning

2019-09-30 11:02

reporter   ~0118206

Last edited: 2019-09-30 11:05

View 2 revisions

Possible patch attached. On Win64 extended equals double and this seems to satisfy the issue.



extended.patch (463 bytes)
Index: rtl/objpas/math.pp
===================================================================
--- rtl/objpas/math.pp	(revision 43098)
+++ rtl/objpas/math.pp	(working copy)
@@ -78,6 +78,10 @@
     const
       MinDouble    =  5.0e-324;
       MaxDouble    =  1.7e+308;
+  {$ifndef FPC_HAS_TYPE_EXTENDED}      
+      MinExtended  =  MinDouble;
+      MaxExtended  =  MaxDouble;
+   {$endif}
 {$endif FPC_HAS_TYPE_DOUBLE}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
     const
extended.patch (463 bytes)

Thaddy de Koning

2019-09-30 11:11

reporter   ~0118207

Last edited: 2019-09-30 11:12

View 2 revisions

Patch contains a space too many... but is otherwise correct.
----------
Index: rtl/objpas/math.pp
===================================================================
--- rtl/objpas/math.pp (revision 43098)
+++ rtl/objpas/math.pp (working copy)
@@ -78,6 +78,10 @@
     const
       MinDouble = 5.0e-324;
       MaxDouble = 1.7e+308;
+ {$ifndef FPC_HAS_TYPE_EXTENDED}
+ MinExtended = MinDouble;
+ MaxExtended = MaxDouble;
+ {$endif}
 {$endif FPC_HAS_TYPE_DOUBLE}
 {$ifdef FPC_HAS_TYPE_EXTENDED}
     const

Thaddy de Koning

2019-09-30 11:15

reporter   ~0118208

One observation:
Actually these types should maybe all be nested?

BOSHU

2019-09-30 16:38

reporter   ~0118217

If only FPC_HAS_TYPE_SINGLE is defined, FPC_HAS_TYPE_EXTENDED is not defined and FPC_HAS_TYPE_DOUBLE is not defined either, should MaxExtended equal MaxSingle(and MinExtended equal MinSingle)?
I think so, but I don't know Delphi's approach to this situation.

BOSHU

2019-10-07 17:27

reporter   ~0118394

MinMaxExtendedDouble.patch

Current behavior: If FPC_HAS_TYPE_DOUBLE is not defined then MinDouble and MaxDouble are not defined either.
New behaviour: If FPC_HAS_TYPE_DOUBLE is not defined and FPC_HAS_TYPE_SINGLE is defined, then MinDouble is defined and equal to MinSingle and MaxDouble is defined and equal to MaxSingle.

Current behavior: If FPC_HAS_TYPE_EXTENDED is not defined then MinExtended and MaxExtended are not defined either.
New behaviour: If FPC_HAS_TYPE_EXTENDED is not defined and FPC_HAS_TYPE_DOUBLE is defined, then , then MinExtended is defined and equal to MinDouble and MaxExtended is defined and equal to MaxDouble.
If FPC_HAS_TYPE_EXTENDED and FPC_HAS_TYPE_DOUBLE are not defined but FPC_HAS_TYPE_SINGLE is defined, then MinExtended is defined and equal to MinSingle and MaxExtended is defined and equal to MaxSingle.

MinMaxExtendedDouble.patch (1,227 bytes)
--- rtl/objpas/math.pp	2019-10-06 11:11:50.000000000 +0300
+++ rtl/objpas/math2.pp	2019-10-07 18:19:05.502427651 +0300
@@ -69,21 +69,36 @@
 {$ENDIF}
 
     { Ranges of the IEEE floating point types, including denormals }
-{$ifdef FPC_HAS_TYPE_SINGLE}
+{$if defined(FPC_HAS_TYPE_SINGLE)}
     const
       MinSingle    =  1.5e-45;
       MaxSingle    =  3.4e+38;
-{$endif FPC_HAS_TYPE_SINGLE}
-{$ifdef FPC_HAS_TYPE_DOUBLE}
+{$endif}
+
+{$if defined(FPC_HAS_TYPE_DOUBLE)}
     const
       MinDouble    =  5.0e-324;
       MaxDouble    =  1.7e+308;
-{$endif FPC_HAS_TYPE_DOUBLE}
-{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$elseif defined(FPC_HAS_TYPE_SINGLE)}
+    const
+      MinDouble    =  MinSingle;
+      MaxDouble    =  MaxSingle;
+{$endif}
+
+{$if defined(FPC_HAS_TYPE_EXTENDED)}
     const
       MinExtended  =  3.4e-4932;
       MaxExtended  =  1.1e+4932;
-{$endif FPC_HAS_TYPE_EXTENDED}
+{$elseif defined(FPC_HAS_TYPE_DOUBLE)}
+    const
+      MinExtended  =  MinDouble;
+      MaxExtended  =  MaxDouble;
+{$elseif defined(FPC_HAS_TYPE_SINGLE)}
+    const
+      MinExtended  =  MinSingle;
+      MaxExtended  =  MaxSingle;
+{$endif}
+
 {$ifdef FPC_HAS_TYPE_COMP}
     const
       MinComp      = -9.223372036854775807e+18;

Issue History

Date Modified Username Field Change
2019-09-27 14:13 BOSHU New Issue
2019-09-30 11:02 Thaddy de Koning File Added: extended.patch
2019-09-30 11:02 Thaddy de Koning Note Added: 0118206
2019-09-30 11:05 Thaddy de Koning Note Edited: 0118206 View Revisions
2019-09-30 11:11 Thaddy de Koning Note Added: 0118207
2019-09-30 11:12 Thaddy de Koning Note Edited: 0118207 View Revisions
2019-09-30 11:15 Thaddy de Koning Note Added: 0118208
2019-09-30 16:38 BOSHU Note Added: 0118217
2019-10-07 17:27 BOSHU File Added: MinMaxExtendedDouble.patch
2019-10-07 17:27 BOSHU Note Added: 0118394