lanceboyle@bluebottle.com wrote:
I might be confused about how to import math functions in GPC.
GPC itself doesn't seem to have the functions that I need (I'm looking in gpc.pas), but in the docs there is a mention of math.pas. However, I can't find such a file in my GPC installation.
This file is part of the GPC source distribution. Its interface are the functions in gpc.pas indeed.
Do I need to use (non-portable) Mac math libraries? If so, is fp.p still the preferred interface?
You might want to let us know which functions you actually need ...
In the case of more common functions such as trig stuff, does fp.p override the Pascal built-ins?
If they have the same name and (in case of routines declared in gpc.pas) you import your module after gpc.pas, then yes.
I believe that pow() is a problem with respect to conflicts and I see that some headers seem to note this in a compiler directive.
Well, pow is an operator, not a function, in Extended Pascal. But as long as you don't use strict EP mode, GPC should allow overriding it with a function. (BTW, what kind of compiler directive?)
Also, I see that floating point types Double and Real are the same and eight bytes, while Extended and LongReal are 16 bytes--is that correct?
Yes. (The exact sizes are platform dependent, but the equivalence of the two pairs of types is always so. Real is 8 byte on most if not all current targets, LongReal e.g. is 10 bytes on IA32.)
To make old code work that assumed that Extended is eight bytes, can I write type Extended = Real without my computer exploding?
Yes (though I decline any warranty for hardware destruction ;-).
Frank