* * *

Author Topic: Right way to turn FPDOC_MATH on?  (Read 1744 times)

EganSolo

  • Full Member
  • ***
  • Posts: 125
Right way to turn FPDOC_MATH on?
« on: September 11, 2016, 11:34:14 pm »
So I've got a package that references MinExtended and MaxExtended.
These constants are defined in the Math unit and they are available only when the FPOC_MATH conditional is turned on.

I know I could add this as a custom option in my project, but wanted to know if there is a pre-set switch I could enable without having to mess around with FPOC_MATH?

Thanks!


Thaddy

  • Hero Member
  • *****
  • Posts: 4525
Re: Right way to turn FPDOC_MATH on?
« Reply #1 on: September 12, 2016, 08:32:07 am »
Not as far as I know. {$DEFINE FPDOC_MATH} is in my opinion a preset switch...
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5743
Re: Right way to turn FPDOC_MATH on?
« Reply #2 on: September 12, 2016, 09:01:44 am »
fpdoc* conditionals are only true during documentation building, never during normal compilation.


EganSolo

  • Full Member
  • ***
  • Posts: 125
Re: Right way to turn FPDOC_MATH on?
« Reply #3 on: September 12, 2016, 09:08:26 am »
Maybe I've muddled the field by not asking the right question...

What I want is to enable MinExtended and MaxExtended. These two constants are enabled in the Math unit only if FPDOC_MATH is enabled as seen in the fragment taken from the top of the Math unit. So, really, what I need to know is how to enable these constants?

Thanks!

Code: Pascal  [Select]
  1.  
  2. {$IFDEF FPDOC_MATH}
  3. {$DEFINE FPC_HAS_TYPE_SINGLE}
  4. {$DEFINE FPC_HAS_TYPE_DOUBLE}
  5. [b]{$DEFINE FPC_HAS_TYPE_EXTENDED}[/b]
  6. {$DEFINE FPC_HAS_TYPE_COMP}
  7. [snip...]
  8. {$ENDIF}
  9.  
  10. [snip...]
  11.  
  12. [b]{$ifdef FPC_HAS_TYPE_EXTENDED}[/b]
  13.     const
  14.       MinExtended  =  3.4e-4932;
  15.       MaxExtended  =  1.1e+4932;
  16. {$endif FPC_HAS_TYPE_EXTENDED}
  17.  
  18.  

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5743
Re: Right way to turn FPDOC_MATH on?
« Reply #4 on: September 12, 2016, 09:53:56 am »
Ah, no FPC_HAS_TYPE_EXTENDED is enabled by the compiler if the compiler supports the type.

The documentation tool however doesn't have the info what the compiler defines, so this is used to fake this.

Basically if the constants are not visible, your platform does not have support for extended and extended is an alias for double.  (extended is a x87 specific type)

Simply enabling the ifdef is useless since then the compiler doesn't support the range ( exponent 10^4000 something) that the constants have, so it won't compile anyway.

EganSolo

  • Full Member
  • ***
  • Posts: 125
Re: Right way to turn FPDOC_MATH on?
« Reply #5 on: September 12, 2016, 09:12:18 pm »
I see, thanks for the clarification.
Out of curiosity, which processor supports the extended type? I've got an i7-4790 CPU @3.60 GHZ 4 cores. Doesn't it qualify?
Also, if I declare a variable of type extended, Laz doesn't complain. Why is it then that it complains when I try to access MinExtended and MaxExtended? Is it that these constants were not also declared in case Extended is not supported?




EganSolo

  • Full Member
  • ***
  • Posts: 125
Re: Right way to turn FPDOC_MATH on?
« Reply #6 on: September 12, 2016, 09:16:32 pm »
One more thing...
I've gone ahead and (Temporarily) declared the following constants in my code:

Code: Pascal  [Select]
  1. const
  2.   MaxExtended  =  1.1e+4932;
  3.   MinExtended  =  3.4e-4932;  
  4.  

And Lazarus is not complaining about it. If my system is not able to support extended, shouldn't Laz complain about the range of these constants?

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus