Frank Heckenbach wrote:
Boris Herman wrote:
[snip]
Thanks! That did it. I had to implement an arcsin function myself as there isn't a "math" unit for GPC, right?
For a Pascal "math" unit for GPC on Mac OS X, Apple has already supplied a solution in the fp.p unit of the Universal Interfaces. The comment from fp.p [.pas] pretty much explains the functionality:
{******************************************************************************* * * * A collection of numerical functions designed to facilitate a wide * * range of numerical programming as required by C9X. * * * * The <fp.h> declares many functions in support of numerical programming. * * It provides a superset of <math.h> and <SANE.h> functions. Some * * functionality previously found in <SANE.h> and not in the FPCE <fp.h> * * can be found in this <fp.h> under the heading "__NOEXTENSIONS__". * * * * All of these functions are IEEE 754 aware and treat exceptions, NaNs, * * positive and negative zero and infinity consistent with the floating- * * point standard. * * * *******************************************************************************}
Thanks to the efforts of Adriaan van Os and Peter N Lewis, a Mac OS X GPC compatible version of Apple's Universal Interfaces which includes fp.pas is available in two download packages which installs the GPCInterfaces (i.e., the GPC compatible translation of Apple's Universal Interfaces) for use with Mac OS X GPC. The Mac OS X GPC binary install package http://www.microbizz.nl/gpc321d11.bin.tar includes GPCInterfaces as part of the installation or a GPCInterfaces only install package http://www.microbizz.nl/GPCInterfacesA.tar will add the GPCInterfaces to a Mac OS X configuration if it doesn't already have a copy installed.
You could declare the libm function external.
double asin (double x);
If I'm not mistaken, the gcc math.h for Mac OS X is configured to use Apple's math.h. Since the math.h subset of the GPCInterfaces fp.pas ends up linking with Apple's math.h implementation, there isn't any need to do this. The original poster can get the asin implemetation on Mac OS X just by using the fp.pas unit from GPCInterfaces. Since fp.pas contains a trunc function which is incompatible with Pascal's trunc fuction, it would be less troublesome to either selectively import the specificly need routines from fp.pas or to selectively rename the import of the fp.pas trunc routine to avoid conflicts with Pascal's trunc function.
Gale Paeper gpaeper@empirenet.com