fp.pas 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887
  1. {
  2. File: fp.p
  3. Contains: FPCE Floating-Point Definitions and Declarations.
  4. Version: Technology: MathLib v2
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1987-2002 by Apple Computer, Inc., all rights reserved.
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit fp;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,ConditionalMacros;
  92. {*******************************************************************************
  93. * *
  94. * A collection of numerical functions designed to facilitate a wide *
  95. * range of numerical programming as required by C9X. *
  96. * *
  97. * The <fp.h> declares many functions in support of numerical programming. *
  98. * It provides a superset of <math.h> and <SANE.h> functions. Some *
  99. * functionality previously found in <SANE.h> and not in the FPCE <fp.h> *
  100. * can be found in this <fp.h> under the heading "__NOEXTENSIONS__". *
  101. * *
  102. * All of these functions are IEEE 754 aware and treat exceptions, NaNs, *
  103. * positive and negative zero and infinity consistent with the floating- *
  104. * point standard. *
  105. * *
  106. *******************************************************************************}
  107. {$ALIGN MAC68K}
  108. {*******************************************************************************
  109. * *
  110. * Efficient types *
  111. * *
  112. * float_t Most efficient type at least as wide as float *
  113. * double_t Most efficient type at least as wide as double *
  114. * *
  115. * CPU float_t(bits) double_t(bits) *
  116. * -------- ----------------- ----------------- *
  117. * PowerPC float(32) double(64) *
  118. * 68K long double(80/96) long double(80/96) *
  119. * x86 double(64) double(64) *
  120. * *
  121. *******************************************************************************}
  122. {$ifc TARGET_CPU_PPC}
  123. type
  124. float_t = Float32;
  125. double_t = Float64;
  126. {$elsec}
  127. {$ifc TARGET_CPU_68K}
  128. type
  129. float_t = extended;
  130. double_t = extended;
  131. {$elsec}
  132. {$ifc TARGET_CPU_X86}
  133. type
  134. float_t = Float64;
  135. double_t = Float64;
  136. {$elsec}
  137. {$ifc TARGET_CPU_MIPS}
  138. type
  139. float_t = Double;
  140. double_t = Double;
  141. {$elsec}
  142. {$ifc TARGET_CPU_ALPHA}
  143. type
  144. float_t = Double;
  145. double_t = Double;
  146. {$elsec}
  147. {$ifc TARGET_CPU_SPARC}
  148. type
  149. float_t = Double;
  150. double_t = Double;
  151. {$elsec}
  152. { Unsupported CPU }
  153. {$endc}
  154. {$endc}
  155. {$endc}
  156. {$endc}
  157. {$endc}
  158. {$endc}
  159. {*******************************************************************************
  160. * *
  161. * Define some constants. *
  162. * *
  163. * HUGE_VAL IEEE 754 value of infinity. *
  164. * INFINITY IEEE 754 value of infinity. *
  165. * NAN A generic NaN (Not A Number). *
  166. * DECIMAL_DIG Satisfies the constraint that the conversion from *
  167. * double to decimal and back is the identity function. *
  168. * *
  169. *******************************************************************************}
  170. const
  171. {$ifc TARGET_CPU_PPC}
  172. DECIMAL_DIG = 17;
  173. {$elsec}
  174. DECIMAL_DIG = 21;
  175. {$endc}
  176. {$ifc TARGET_OS_MAC}
  177. {*******************************************************************************
  178. * *
  179. * Trigonometric functions *
  180. * *
  181. * acos result is in [0,pi]. *
  182. * asin result is in [-pi/2,pi/2]. *
  183. * atan result is in [-pi/2,pi/2]. *
  184. * atan2 Computes the arc tangent of y/x in [-pi,pi] using the sign of *
  185. * both arguments to determine the quadrant of the computed value. *
  186. * *
  187. *******************************************************************************}
  188. {
  189. * cos()
  190. *
  191. * Availability:
  192. * Non-Carbon CFM: in MathLib 1.0 and later
  193. * CarbonLib: in CarbonLib 1.0 and later
  194. * Mac OS X: in version 10.0 and later
  195. }
  196. function cos(x: double_t): double_t; external name '_cos';
  197. {
  198. * sin()
  199. *
  200. * Availability:
  201. * Non-Carbon CFM: in MathLib 1.0 and later
  202. * CarbonLib: in CarbonLib 1.0 and later
  203. * Mac OS X: in version 10.0 and later
  204. }
  205. function sin(x: double_t): double_t; external name '_sin';
  206. {
  207. * tan()
  208. *
  209. * Availability:
  210. * Non-Carbon CFM: in MathLib 1.0 and later
  211. * CarbonLib: in CarbonLib 1.0 and later
  212. * Mac OS X: in version 10.0 and later
  213. }
  214. function tan(x: double_t): double_t; external name '_tan';
  215. {
  216. * acos()
  217. *
  218. * Availability:
  219. * Non-Carbon CFM: in MathLib 1.0 and later
  220. * CarbonLib: in CarbonLib 1.0 and later
  221. * Mac OS X: in version 10.0 and later
  222. }
  223. function acos(x: double_t): double_t; external name '_acos';
  224. {
  225. * asin()
  226. *
  227. * Availability:
  228. * Non-Carbon CFM: in MathLib 1.0 and later
  229. * CarbonLib: in CarbonLib 1.0 and later
  230. * Mac OS X: in version 10.0 and later
  231. }
  232. function asin(x: double_t): double_t; external name '_asin';
  233. {
  234. * atan()
  235. *
  236. * Availability:
  237. * Non-Carbon CFM: in MathLib 1.0 and later
  238. * CarbonLib: in CarbonLib 1.0 and later
  239. * Mac OS X: in version 10.0 and later
  240. }
  241. function atan(x: double_t): double_t; external name '_atan';
  242. {
  243. * atan2()
  244. *
  245. * Availability:
  246. * Non-Carbon CFM: in MathLib 1.0 and later
  247. * CarbonLib: in CarbonLib 1.0 and later
  248. * Mac OS X: in version 10.0 and later
  249. }
  250. function atan2(y: double_t; x: double_t): double_t; external name '_atan2';
  251. {*******************************************************************************
  252. * *
  253. * Hyperbolic functions *
  254. * *
  255. *******************************************************************************}
  256. {
  257. * cosh()
  258. *
  259. * Availability:
  260. * Non-Carbon CFM: in MathLib 1.0 and later
  261. * CarbonLib: in CarbonLib 1.0 and later
  262. * Mac OS X: in version 10.0 and later
  263. }
  264. function cosh(x: double_t): double_t; external name '_cosh';
  265. {
  266. * sinh()
  267. *
  268. * Availability:
  269. * Non-Carbon CFM: in MathLib 1.0 and later
  270. * CarbonLib: in CarbonLib 1.0 and later
  271. * Mac OS X: in version 10.0 and later
  272. }
  273. function sinh(x: double_t): double_t; external name '_sinh';
  274. {
  275. * tanh()
  276. *
  277. * Availability:
  278. * Non-Carbon CFM: in MathLib 1.0 and later
  279. * CarbonLib: in CarbonLib 1.0 and later
  280. * Mac OS X: in version 10.0 and later
  281. }
  282. function tanh(x: double_t): double_t; external name '_tanh';
  283. {
  284. * acosh()
  285. *
  286. * Availability:
  287. * Non-Carbon CFM: in MathLib 1.0 and later
  288. * CarbonLib: in CarbonLib 1.0 and later
  289. * Mac OS X: in version 10.0 and later
  290. }
  291. function acosh(x: double_t): double_t; external name '_acosh';
  292. {
  293. * asinh()
  294. *
  295. * Availability:
  296. * Non-Carbon CFM: in MathLib 1.0 and later
  297. * CarbonLib: in CarbonLib 1.0 and later
  298. * Mac OS X: in version 10.0 and later
  299. }
  300. function asinh(x: double_t): double_t; external name '_asinh';
  301. {
  302. * atanh()
  303. *
  304. * Availability:
  305. * Non-Carbon CFM: in MathLib 1.0 and later
  306. * CarbonLib: in CarbonLib 1.0 and later
  307. * Mac OS X: in version 10.0 and later
  308. }
  309. function atanh(x: double_t): double_t; external name '_atanh';
  310. {*******************************************************************************
  311. * *
  312. * Exponential functions *
  313. * *
  314. * expm1 expm1(x) = exp(x) - 1. But, for small enough arguments, *
  315. * expm1(x) is expected to be more accurate than exp(x) - 1. *
  316. * frexp Breaks a floating-point number into a normalized fraction *
  317. * and an integral power of 2. It stores the SInt16 in the *
  318. * object pointed by *exponent. *
  319. * ldexp Multiplies a floating-point number by an SInt16 power of 2. *
  320. * log1p log1p = log(1 + x). But, for small enough arguments, *
  321. * log1p is expected to be more accurate than log(1 + x). *
  322. * logb Extracts the exponent of its argument, as a signed integral *
  323. * value. A subnormal argument is treated as though it were first *
  324. * normalized. Thus: *
  325. * 1 <= x * 2^(-logb(x)) < 2 *
  326. * modf Returns fractional part of x as function result and returns *
  327. * integral part of x via iptr. Note C9X uses double not double_t. *
  328. * scalb Computes x * 2^n efficently. This is not normally done by *
  329. * computing 2^n explicitly. *
  330. * *
  331. *******************************************************************************}
  332. {
  333. * exp()
  334. *
  335. * Availability:
  336. * Non-Carbon CFM: in MathLib 1.0 and later
  337. * CarbonLib: in CarbonLib 1.0 and later
  338. * Mac OS X: in version 10.0 and later
  339. }
  340. function exp(x: double_t): double_t; external name '_exp';
  341. {
  342. * expm1()
  343. *
  344. * Availability:
  345. * Non-Carbon CFM: in MathLib 1.0 and later
  346. * CarbonLib: in CarbonLib 1.0 and later
  347. * Mac OS X: in version 10.0 and later
  348. }
  349. function expm1(x: double_t): double_t; external name '_expm1';
  350. {
  351. * exp2()
  352. *
  353. * Availability:
  354. * Non-Carbon CFM: in MathLib 1.0 and later
  355. * CarbonLib: in CarbonLib 1.0 and later
  356. * Mac OS X: in version 10.0 and later
  357. }
  358. function exp2(x: double_t): double_t; external name '_exp2';
  359. {
  360. * frexp()
  361. *
  362. * Availability:
  363. * Non-Carbon CFM: in MathLib 1.0 and later
  364. * CarbonLib: in CarbonLib 1.0 and later
  365. * Mac OS X: in version 10.0 and later
  366. }
  367. function frexp(x: double_t; var exponent: SInt32): double_t; external name '_frexp';
  368. {
  369. * ldexp()
  370. *
  371. * Availability:
  372. * Non-Carbon CFM: in MathLib 1.0 and later
  373. * CarbonLib: in CarbonLib 1.0 and later
  374. * Mac OS X: in version 10.0 and later
  375. }
  376. function ldexp(x: double_t; n: SInt32): double_t; external name '_ldexp';
  377. {
  378. * log()
  379. *
  380. * Availability:
  381. * Non-Carbon CFM: in MathLib 1.0 and later
  382. * CarbonLib: in CarbonLib 1.0 and later
  383. * Mac OS X: in version 10.0 and later
  384. }
  385. function log(x: double_t): double_t; external name '_log';
  386. {
  387. * log2()
  388. *
  389. * Availability:
  390. * Non-Carbon CFM: in MathLib 1.0 and later
  391. * CarbonLib: in CarbonLib 1.0 and later
  392. * Mac OS X: in version 10.0 and later
  393. }
  394. function log2(x: double_t): double_t; external name '_log2';
  395. {
  396. * log1p()
  397. *
  398. * Availability:
  399. * Non-Carbon CFM: in MathLib 1.0 and later
  400. * CarbonLib: in CarbonLib 1.0 and later
  401. * Mac OS X: in version 10.0 and later
  402. }
  403. function log1p(x: double_t): double_t; external name '_log1p';
  404. {
  405. * log10()
  406. *
  407. * Availability:
  408. * Non-Carbon CFM: in MathLib 1.0 and later
  409. * CarbonLib: in CarbonLib 1.0 and later
  410. * Mac OS X: in version 10.0 and later
  411. }
  412. function log10(x: double_t): double_t; external name '_log10';
  413. {
  414. * logb()
  415. *
  416. * Availability:
  417. * Non-Carbon CFM: in MathLib 1.0 and later
  418. * CarbonLib: in CarbonLib 1.0 and later
  419. * Mac OS X: in version 10.0 and later
  420. }
  421. function logb(x: double_t): double_t; external name '_logb';
  422. {
  423. * modf()
  424. *
  425. * Availability:
  426. * Non-Carbon CFM: in MathLib 1.0 and later
  427. * CarbonLib: in CarbonLib 1.0 and later
  428. * Mac OS X: in version 10.0 and later
  429. }
  430. function modf(x: double_t; var iptr: double_t): double_t; external name '_modf';
  431. {
  432. * modff()
  433. *
  434. * Availability:
  435. * Non-Carbon CFM: in MathLib 1.0 and later
  436. * CarbonLib: in CarbonLib 1.0 and later
  437. * Mac OS X: in version 10.0 and later
  438. }
  439. function modff(x: Single; var iptrf: Single): Single; external name '_modff';
  440. {
  441. Note: For compatiblity scalb(x,n) has n of type
  442. int on Mac OS X
  443. long on Mac OS
  444. }
  445. type
  446. _scalb_n_type = SInt32;
  447. {
  448. * scalb()
  449. *
  450. * Availability:
  451. * Non-Carbon CFM: in MathLib 1.0 and later
  452. * CarbonLib: in CarbonLib 1.0 and later
  453. * Mac OS X: in version 10.0 and later
  454. }
  455. function scalb(x: double_t; n: _scalb_n_type): double_t; external name '_scalb';
  456. {*******************************************************************************
  457. * *
  458. * Power and absolute value functions *
  459. * *
  460. * hypot Computes the square root of the sum of the squares of its *
  461. * arguments, without undue overflow or underflow. *
  462. * pow Returns x raised to the power of y. Result is more accurate *
  463. * than using exp(log(x)*y). *
  464. * *
  465. *******************************************************************************}
  466. {
  467. * fabs()
  468. *
  469. * Availability:
  470. * Non-Carbon CFM: in MathLib 1.0 and later
  471. * CarbonLib: in CarbonLib 1.0 and later
  472. * Mac OS X: in version 10.0 and later
  473. }
  474. function fabs(x: double_t): double_t; external name '_fabs';
  475. {
  476. * hypot()
  477. *
  478. * Availability:
  479. * Non-Carbon CFM: in MathLib 1.0 and later
  480. * CarbonLib: in CarbonLib 1.0 and later
  481. * Mac OS X: in version 10.0 and later
  482. }
  483. function hypot(x: double_t; y: double_t): double_t; external name '_hypot';
  484. {
  485. * pow()
  486. *
  487. * Availability:
  488. * Non-Carbon CFM: in MathLib 2.0 and later
  489. * CarbonLib: in CarbonLib 1.0 and later
  490. * Mac OS X: in version 10.0 and later
  491. }
  492. function pow(x: double_t; y: double_t): double_t; external name '_pow';
  493. {
  494. * sqrt()
  495. *
  496. * Availability:
  497. * Non-Carbon CFM: in MathLib 1.0 and later
  498. * CarbonLib: in CarbonLib 1.0 and later
  499. * Mac OS X: in version 10.0 and later
  500. }
  501. function sqrt(x: double_t): double_t; external name '_sqrt';
  502. {*******************************************************************************
  503. * *
  504. * Gamma and Error functions *
  505. * *
  506. * erf The error function. *
  507. * erfc Complementary error function. *
  508. * gamma The gamma function. *
  509. * lgamma Computes the base-e logarithm of the absolute value of *
  510. * gamma of its argument x, for x > 0. *
  511. * *
  512. *******************************************************************************}
  513. {
  514. * erf()
  515. *
  516. * Availability:
  517. * Non-Carbon CFM: in MathLib 1.0 and later
  518. * CarbonLib: in CarbonLib 1.0 and later
  519. * Mac OS X: in version 10.0 and later
  520. }
  521. function erf(x: double_t): double_t; external name '_erf';
  522. {
  523. * erfc()
  524. *
  525. * Availability:
  526. * Non-Carbon CFM: in MathLib 1.0 and later
  527. * CarbonLib: in CarbonLib 1.0 and later
  528. * Mac OS X: in version 10.0 and later
  529. }
  530. function erfc(x: double_t): double_t; external name '_erfc';
  531. {
  532. * gamma()
  533. *
  534. * Availability:
  535. * Non-Carbon CFM: in MathLib 1.0 and later
  536. * CarbonLib: in CarbonLib 1.0 and later
  537. * Mac OS X: in version 10.0 and later
  538. }
  539. function gamma(x: double_t): double_t; external name '_gamma';
  540. {
  541. * lgamma()
  542. *
  543. * Availability:
  544. * Non-Carbon CFM: in MathLib 1.0 and later
  545. * CarbonLib: in CarbonLib 1.0 and later
  546. * Mac OS X: in version 10.0 and later
  547. }
  548. function lgamma(x: double_t): double_t; external name '_lgamma';
  549. {*******************************************************************************
  550. * *
  551. * Nearest SInt16 functions *
  552. * *
  553. * rint Rounds its argument to an integral value in floating point *
  554. * format, honoring the current rounding direction. *
  555. * *
  556. * nearbyint Differs from rint only in that it does not raise the inexact *
  557. * exception. It is the nearbyint function recommended by the *
  558. * IEEE floating-point standard 854. *
  559. * *
  560. * rinttol Rounds its argument to the nearest long int using the current *
  561. * rounding direction. NOTE: if the rounded value is outside *
  562. * the range of long int, then the result is undefined. *
  563. * *
  564. * round Rounds the argument to the nearest integral value in floating *
  565. * point format similar to the Fortran "anint" function. That is: *
  566. * add half to the magnitude and chop. *
  567. * *
  568. * roundtol Similar to the Fortran function nint or to the Pascal round. *
  569. * NOTE: if the rounded value is outside the range of long int, *
  570. * then the result is undefined. *
  571. * *
  572. * trunc Computes the integral value, in floating format, nearest to *
  573. * but no larger in magnitude than its argument. NOTE: on 68K *
  574. * compilers when using -elems881, trunc must return an int *
  575. * *
  576. *******************************************************************************}
  577. {
  578. * ceil()
  579. *
  580. * Availability:
  581. * Non-Carbon CFM: in MathLib 1.0 and later
  582. * CarbonLib: in CarbonLib 1.0 and later
  583. * Mac OS X: in version 10.0 and later
  584. }
  585. function ceil(x: double_t): double_t; external name '_ceil';
  586. {
  587. * floor()
  588. *
  589. * Availability:
  590. * Non-Carbon CFM: in MathLib 1.0 and later
  591. * CarbonLib: in CarbonLib 1.0 and later
  592. * Mac OS X: in version 10.0 and later
  593. }
  594. function floor(x: double_t): double_t; external name '_floor';
  595. {
  596. * rint()
  597. *
  598. * Availability:
  599. * Non-Carbon CFM: in MathLib 1.0 and later
  600. * CarbonLib: in CarbonLib 1.0 and later
  601. * Mac OS X: in version 10.0 and later
  602. }
  603. function rint(x: double_t): double_t; external name '_rint';
  604. {
  605. * nearbyint()
  606. *
  607. * Availability:
  608. * Non-Carbon CFM: in MathLib 1.0 and later
  609. * CarbonLib: in CarbonLib 1.0 and later
  610. * Mac OS X: in version 10.0 and later
  611. }
  612. function nearbyint(x: double_t): double_t; external name '_nearbyint';
  613. {
  614. * rinttol()
  615. *
  616. * Availability:
  617. * Non-Carbon CFM: in MathLib 1.0 and later
  618. * CarbonLib: in CarbonLib 1.0 and later
  619. * Mac OS X: in version 10.0 and later
  620. }
  621. function rinttol(x: double_t): SInt32; external name '_rinttol';
  622. {
  623. * round()
  624. *
  625. * Availability:
  626. * Non-Carbon CFM: in MathLib 1.0 and later
  627. * CarbonLib: in CarbonLib 1.0 and later
  628. * Mac OS X: in version 10.0 and later
  629. }
  630. function roundd(x: double_t): double_t; external name '_round';
  631. {
  632. * roundtol()
  633. *
  634. * Availability:
  635. * Non-Carbon CFM: in MathLib 1.0 and later
  636. * CarbonLib: in CarbonLib 1.0 and later
  637. * Mac OS X: in version 10.0 and later
  638. }
  639. function roundtol(round: double_t): SInt32; external name '_roundtol';
  640. {
  641. Note: For compatiblity trunc(x) has a return type of
  642. int for classic 68K with FPU enabled
  643. double_t everywhere else
  644. }
  645. {$ifc TARGET_RT_MAC_68881}
  646. type
  647. _trunc_return_type = SInt32;
  648. {$elsec}
  649. type
  650. _trunc_return_type = double_t;
  651. {$endc} {TARGET_RT_MAC_68881}
  652. {
  653. * trunc()
  654. *
  655. * Availability:
  656. * Non-Carbon CFM: in MathLib 1.0 and later
  657. * CarbonLib: in CarbonLib 1.0 and later
  658. * Mac OS X: in version 10.0 and later
  659. }
  660. function truncd(x: double_t): _trunc_return_type; external name '_trunc';
  661. {*******************************************************************************
  662. * *
  663. * Remainder functions *
  664. * *
  665. * remainder IEEE 754 floating point standard for remainder. *
  666. * remquo SANE remainder. It stores into 'quotient' the 7 low-order *
  667. * bits of the SInt16 quotient x/y, such that: *
  668. * -127 <= quotient <= 127. *
  669. * *
  670. *******************************************************************************}
  671. {
  672. * fmod()
  673. *
  674. * Availability:
  675. * Non-Carbon CFM: in MathLib 1.0 and later
  676. * CarbonLib: in CarbonLib 1.0 and later
  677. * Mac OS X: in version 10.0 and later
  678. }
  679. function fmod(x: double_t; y: double_t): double_t; external name '_fmod';
  680. {
  681. * remainder()
  682. *
  683. * Availability:
  684. * Non-Carbon CFM: in MathLib 1.0 and later
  685. * CarbonLib: in CarbonLib 1.0 and later
  686. * Mac OS X: in version 10.0 and later
  687. }
  688. function remainder(x: double_t; y: double_t): double_t; external name '_remainder';
  689. {
  690. * remquo()
  691. *
  692. * Availability:
  693. * Non-Carbon CFM: in MathLib 1.0 and later
  694. * CarbonLib: in CarbonLib 1.0 and later
  695. * Mac OS X: in version 10.0 and later
  696. }
  697. function remquo(x: double_t; y: double_t; var quo: SInt32): double_t; external name '_remquo';
  698. {*******************************************************************************
  699. * *
  700. * Auxiliary functions *
  701. * *
  702. * copysign Produces a value with the magnitude of its first argument *
  703. * and sign of its second argument. NOTE: the order of the *
  704. * arguments matches the recommendation of the IEEE 754 *
  705. * floating point standard, which is opposite from the SANE *
  706. * copysign function. *
  707. * *
  708. * nan The call 'nan("n-char-sequence")' returns a quiet NaN *
  709. * with content indicated through tagp in the selected *
  710. * data type format. *
  711. * *
  712. * nextafter Computes the next representable value after 'x' in the *
  713. * direction of 'y'. if x == y, then y is returned. *
  714. * *
  715. *******************************************************************************}
  716. {
  717. * copysign()
  718. *
  719. * Availability:
  720. * Non-Carbon CFM: in MathLib 1.0 and later
  721. * CarbonLib: in CarbonLib 1.0 and later
  722. * Mac OS X: in version 10.0 and later
  723. }
  724. function copysign(x: double_t; y: double_t): double_t; external name '_copysign';
  725. {
  726. * nan()
  727. *
  728. * Availability:
  729. * Non-Carbon CFM: in MathLib 1.0 and later
  730. * CarbonLib: in CarbonLib 1.0 and later
  731. * Mac OS X: in version 10.0 and later
  732. }
  733. function nan(tagp: ConstCStringPtr): Double; external name '_nan';
  734. {
  735. * nanf()
  736. *
  737. * Availability:
  738. * Non-Carbon CFM: in MathLib 1.0 and later
  739. * CarbonLib: in CarbonLib 1.0 and later
  740. * Mac OS X: in version 10.0 and later
  741. }
  742. function nanf(tagp: ConstCStringPtr): Single; external name '_nanf';
  743. {
  744. * nextafterd()
  745. *
  746. * Availability:
  747. * Non-Carbon CFM: in MathLib 1.0 and later
  748. * CarbonLib: in CarbonLib 1.0 and later
  749. * Mac OS X: in version 10.0 and later
  750. }
  751. function nextafterd(x: Double; y: Double): Double; external name '_nextafterd';
  752. {
  753. * nextafterf()
  754. *
  755. * Availability:
  756. * Non-Carbon CFM: in MathLib 1.0 and later
  757. * CarbonLib: in CarbonLib 1.0 and later
  758. * Mac OS X: in version 10.0 and later
  759. }
  760. function nextafterf(x: Single; y: Single): Single; external name '_nextafterf';
  761. {
  762. * __fpclassifyd()
  763. *
  764. * Availability:
  765. * Non-Carbon CFM: in MathLib 1.0 and later
  766. * CarbonLib: in CarbonLib 1.0 and later
  767. * Mac OS X: in version 10.0 and later
  768. }
  769. function __fpclassifyd(x: Double): SInt32; external name '___fpclassifyd';
  770. {
  771. * __fpclassifyf()
  772. *
  773. * Availability:
  774. * Non-Carbon CFM: in MathLib 1.0 and later
  775. * CarbonLib: in CarbonLib 1.0 and later
  776. * Mac OS X: in version 10.0 and later
  777. }
  778. function __fpclassifyf(x: Single): SInt32; external name '___fpclassifyf';
  779. {
  780. * __isnormald()
  781. *
  782. * Availability:
  783. * Non-Carbon CFM: in MathLib 1.0 and later
  784. * CarbonLib: in CarbonLib 1.0 and later
  785. * Mac OS X: in version 10.0 and later
  786. }
  787. function __isnormald(x: Double): SInt32; external name '___isnormald';
  788. {
  789. * __isnormalf()
  790. *
  791. * Availability:
  792. * Non-Carbon CFM: in MathLib 1.0 and later
  793. * CarbonLib: in CarbonLib 1.0 and later
  794. * Mac OS X: in version 10.0 and later
  795. }
  796. function __isnormalf(x: Single): SInt32; external name '___isnormalf';
  797. {
  798. * __isfinited()
  799. *
  800. * Availability:
  801. * Non-Carbon CFM: in MathLib 1.0 and later
  802. * CarbonLib: in CarbonLib 1.0 and later
  803. * Mac OS X: in version 10.0 and later
  804. }
  805. function __isfinited(x: Double): SInt32; external name '___isfinited';
  806. {
  807. * __isfinitef()
  808. *
  809. * Availability:
  810. * Non-Carbon CFM: in MathLib 1.0 and later
  811. * CarbonLib: in CarbonLib 1.0 and later
  812. * Mac OS X: in version 10.0 and later
  813. }
  814. function __isfinitef(x: Single): SInt32; external name '___isfinitef';
  815. {
  816. * __isnand()
  817. *
  818. * Availability:
  819. * Non-Carbon CFM: in MathLib 1.0 and later
  820. * CarbonLib: in CarbonLib 1.0 and later
  821. * Mac OS X: in version 10.0 and later
  822. }
  823. function __isnand(x: Double): SInt32; external name '___isnand';
  824. {
  825. * __isnanf()
  826. *
  827. * Availability:
  828. * Non-Carbon CFM: in MathLib 1.0 and later
  829. * CarbonLib: in CarbonLib 1.0 and later
  830. * Mac OS X: in version 10.0 and later
  831. }
  832. function __isnanf(x: Single): SInt32; external name '___isnanf';
  833. {
  834. * __signbitd()
  835. *
  836. * Availability:
  837. * Non-Carbon CFM: in MathLib 1.0 and later
  838. * CarbonLib: in CarbonLib 1.0 and later
  839. * Mac OS X: in version 10.0 and later
  840. }
  841. function __signbitd(x: Double): SInt32; external name '___signbitd';
  842. {
  843. * __signbitf()
  844. *
  845. * Availability:
  846. * Non-Carbon CFM: in MathLib 1.0 and later
  847. * CarbonLib: in CarbonLib 1.0 and later
  848. * Mac OS X: in version 10.0 and later
  849. }
  850. function __signbitf(x: Single): SInt32; external name '___signbitf';
  851. {
  852. * __inf()
  853. *
  854. * Availability:
  855. * Non-Carbon CFM: in MathLib 1.0 and later
  856. * CarbonLib: in CarbonLib 1.0 and later
  857. * Mac OS X: in version 10.0 and later
  858. }
  859. function __inf: double_t; external name '___inf';
  860. {*******************************************************************************
  861. * *
  862. * Inquiry macros *
  863. * *
  864. * fpclassify Returns one of the FP_Å values. *
  865. * isnormal Non-zero if and only if the argument x is normalized. *
  866. * isfinite Non-zero if and only if the argument x is finite. *
  867. * isnan Non-zero if and only if the argument x is a NaN. *
  868. * signbit Non-zero if and only if the sign of the argument x is *
  869. * negative. This includes, NaNs, infinities and zeros. *
  870. * *
  871. *******************************************************************************}
  872. const
  873. FP_SNAN = 0; { signaling NaN }
  874. FP_QNAN = 1; { quiet NaN }
  875. FP_INFINITE = 2; { + or - infinity }
  876. FP_ZERO = 3; { + or - zero }
  877. FP_NORMAL = 4; { all normal numbers }
  878. FP_SUBNORMAL = 5; { denormal numbers }
  879. { *******************************************************************************
  880. * *
  881. * Max, Min and Positive Difference *
  882. * *
  883. * fdim Determines the 'positive difference' between its arguments: *
  884. * ( x - y, if x > y ), ( +0, if x <= y ). If one argument is *
  885. * NaN, then fdim returns that NaN. if both arguments are NaNs, *
  886. * then fdim returns the first argument. *
  887. * *
  888. * fmax Returns the maximum of the two arguments. Corresponds to the *
  889. * max function in FORTRAN. NaN arguments are treated as missing *
  890. * data. If one argument is NaN and the other is a number, then *
  891. * the number is returned. If both are NaNs then the first *
  892. * argument is returned. *
  893. * *
  894. * fmin Returns the minimum of the two arguments. Corresponds to the *
  895. * min function in FORTRAN. NaN arguments are treated as missing *
  896. * data. If one argument is NaN and the other is a number, then *
  897. * the number is returned. If both are NaNs then the first *
  898. * argument is returned. *
  899. * *
  900. ******************************************************************************* }
  901. {
  902. * fdim()
  903. *
  904. * Availability:
  905. * Non-Carbon CFM: in MathLib 1.0 and later
  906. * CarbonLib: in CarbonLib 1.0 and later
  907. * Mac OS X: in version 10.0 and later
  908. }
  909. function fdim(x: double_t; y: double_t): double_t; external name '_fdim';
  910. {
  911. * fmax()
  912. *
  913. * Availability:
  914. * Non-Carbon CFM: in MathLib 1.0 and later
  915. * CarbonLib: in CarbonLib 1.0 and later
  916. * Mac OS X: in version 10.0 and later
  917. }
  918. function fmax(x: double_t; y: double_t): double_t; external name '_fmax';
  919. {
  920. * fmin()
  921. *
  922. * Availability:
  923. * Non-Carbon CFM: in MathLib 1.0 and later
  924. * CarbonLib: in CarbonLib 1.0 and later
  925. * Mac OS X: in version 10.0 and later
  926. }
  927. function fmin(x: double_t; y: double_t): double_t; external name '_fmin';
  928. {******************************************************************************
  929. * Constants *
  930. ******************************************************************************}
  931. {*******************************************************************************
  932. * *
  933. * Non NCEG extensions *
  934. * *
  935. *******************************************************************************}
  936. {$ifc undefined __NOEXTENSIONS__}
  937. {*******************************************************************************
  938. * *
  939. * Financial functions *
  940. * *
  941. * compound Computes the compound interest factor "(1 + rate)^periods" *
  942. * more accurately than the straightforward computation with *
  943. * the Power function. This is SANE's compound function. *
  944. * *
  945. * annuity Computes the present value factor for an annuity *
  946. * "(1 - (1 + rate)^(-periods)) /rate" more accurately than *
  947. * the straightforward computation with the Power function. *
  948. * This is SANE's annuity function. *
  949. * *
  950. *******************************************************************************}
  951. {
  952. * compound()
  953. *
  954. * Availability:
  955. * Non-Carbon CFM: in MathLib 1.0 and later
  956. * CarbonLib: in CarbonLib 1.0 and later
  957. * Mac OS X: in version 10.0 and later
  958. }
  959. function compound(rate: double_t; periods: double_t): double_t; external name '_compound';
  960. {
  961. * annuity()
  962. *
  963. * Availability:
  964. * Non-Carbon CFM: in MathLib 1.0 and later
  965. * CarbonLib: in CarbonLib 1.0 and later
  966. * Mac OS X: in version 10.0 and later
  967. }
  968. function annuity(rate: double_t; periods: double_t): double_t; external name '_annuity';
  969. {*******************************************************************************
  970. * *
  971. * Random function *
  972. * *
  973. * randomx A pseudorandom number generator. It uses the iteration: *
  974. * (7^5*x)mod(2^31-1) *
  975. * *
  976. *******************************************************************************}
  977. {
  978. * randomx()
  979. *
  980. * Availability:
  981. * Non-Carbon CFM: in MathLib 1.0 and later
  982. * CarbonLib: in CarbonLib 1.0 and later
  983. * Mac OS X: in version 10.0 and later
  984. }
  985. function randomx(var x: double_t): double_t; external name '_randomx';
  986. {******************************************************************************
  987. * Relational operator *
  988. ******************************************************************************}
  989. { relational operator }
  990. type
  991. relop = SInt16;
  992. const
  993. GREATERTHAN = 0;
  994. LESSTHAN = 1;
  995. EQUALTO = 2;
  996. UNORDERED = 3;
  997. {
  998. * relation()
  999. *
  1000. * Availability:
  1001. * Non-Carbon CFM: in MathLib 1.0 and later
  1002. * CarbonLib: in CarbonLib 1.0 and later
  1003. * Mac OS X: in version 10.0 and later
  1004. }
  1005. function relation(x: double_t; y: double_t): relop; external name '_relation';
  1006. {*******************************************************************************
  1007. * *
  1008. * Binary to decimal conversions *
  1009. * *
  1010. * SIGDIGLEN Significant decimal digits. *
  1011. * *
  1012. * decimal A record which provides an intermediate unpacked form for *
  1013. * programmers who wish to do their own parsing of numeric input *
  1014. * or formatting of numeric output. *
  1015. * *
  1016. * decform Controls each conversion to a decimal string. The style field *
  1017. * is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the *
  1018. * value of the field digits is the number of significant digits. *
  1019. * If FIXEDDECIMAL value of the field digits is the number of *
  1020. * digits to the right of the decimal point. *
  1021. * *
  1022. * num2dec Converts a double_t to a decimal record using a decform. *
  1023. * dec2num Converts a decimal record d to a double_t value. *
  1024. * dec2str Converts a decform and decimal to a string using a decform. *
  1025. * str2dec Converts a string to a decimal struct. *
  1026. * dec2d Similar to dec2num except a double is returned (68k only). *
  1027. * dec2f Similar to dec2num except a float is returned. *
  1028. * dec2s Similar to dec2num except a short is returned. *
  1029. * dec2l Similar to dec2num except a long is returned. *
  1030. * *
  1031. *******************************************************************************}
  1032. const
  1033. SIGDIGLEN = 36;
  1034. DECSTROUTLEN = 80;
  1035. type
  1036. DecimalKindItem = (FLOATDECIMAL, FIXEDDECIMAL);
  1037. DecimalKind = DecimalKindItem;
  1038. decimal = record
  1039. sgn: 0..1; { sign 0 for +, 1 for - }
  1040. exp: SInt16;
  1041. sig: Str36;
  1042. end;
  1043. decform = record
  1044. style: DecimalKind;
  1045. digits: SInt16;
  1046. end;
  1047. {
  1048. * num2dec()
  1049. *
  1050. * Availability:
  1051. * Non-Carbon CFM: in MathLib 1.0 and later
  1052. * CarbonLib: in CarbonLib 1.0 and later
  1053. * Mac OS X: in version 10.0 and later
  1054. }
  1055. procedure num2dec(const (*var*) f: decform; x: double_t; var d: decimal); external name '_num2dec';
  1056. {
  1057. * dec2num()
  1058. *
  1059. * Availability:
  1060. * Non-Carbon CFM: in MathLib 1.0 and later
  1061. * CarbonLib: in CarbonLib 1.0 and later
  1062. * Mac OS X: in version 10.0 and later
  1063. }
  1064. function dec2num(const (*var*) d: decimal): double_t; external name '_dec2num';
  1065. {
  1066. * dec2str()
  1067. *
  1068. * Availability:
  1069. * Non-Carbon CFM: in MathLib 1.0 and later
  1070. * CarbonLib: in CarbonLib 1.0 and later
  1071. * Mac OS X: in version 10.0 and later
  1072. }
  1073. procedure dec2str(const (*var*) f: decform; const (*var*) d: decimal; s: CStringPtr); external name '_dec2str';
  1074. {
  1075. * str2dec()
  1076. *
  1077. * Availability:
  1078. * Non-Carbon CFM: in MathLib 1.0 and later
  1079. * CarbonLib: in CarbonLib 1.0 and later
  1080. * Mac OS X: in version 10.0 and later
  1081. }
  1082. procedure str2dec(s: ConstCStringPtr; var ix: SInt16; var d: decimal; var vp: SInt16); external name '_str2dec';
  1083. {$ifc TARGET_CPU_68K}
  1084. {$ifc CALL_NOT_IN_CARBON}
  1085. {
  1086. * dec2d()
  1087. *
  1088. * Availability:
  1089. * Non-Carbon CFM: not available
  1090. * CarbonLib: not available
  1091. * Mac OS X: not available
  1092. }
  1093. function dec2d(const (*var*) d: decimal): Double; external name '_dec2d';
  1094. {$endc} {CALL_NOT_IN_CARBON}
  1095. {$endc} {TARGET_CPU_68K}
  1096. {
  1097. * dec2f()
  1098. *
  1099. * Availability:
  1100. * Non-Carbon CFM: in MathLib 1.0 and later
  1101. * CarbonLib: in CarbonLib 1.0 and later
  1102. * Mac OS X: in version 10.0 and later
  1103. }
  1104. function dec2f(const (*var*) d: decimal): Single; external name '_dec2f';
  1105. {
  1106. * dec2s()
  1107. *
  1108. * Availability:
  1109. * Non-Carbon CFM: in MathLib 1.0 and later
  1110. * CarbonLib: in CarbonLib 1.0 and later
  1111. * Mac OS X: in version 10.0 and later
  1112. }
  1113. function dec2s(const (*var*) d: decimal): SInt16; external name '_dec2s';
  1114. {
  1115. * dec2l()
  1116. *
  1117. * Availability:
  1118. * Non-Carbon CFM: in MathLib 1.0 and later
  1119. * CarbonLib: in CarbonLib 1.0 and later
  1120. * Mac OS X: in version 10.0 and later
  1121. }
  1122. function dec2l(const (*var*) d: decimal): SInt32; external name '_dec2l';
  1123. {*******************************************************************************
  1124. * *
  1125. * 68k-only Transfer Function Prototypes *
  1126. * *
  1127. *******************************************************************************}
  1128. {$ifc TARGET_CPU_68K}
  1129. {$ifc CALL_NOT_IN_CARBON}
  1130. {
  1131. * x96tox80()
  1132. *
  1133. * Availability:
  1134. * Non-Carbon CFM: not available
  1135. * CarbonLib: not available
  1136. * Mac OS X: not available
  1137. }
  1138. procedure x96tox80(const (*var*) x: extended96; var x80: extended80); external name '_x96tox80';
  1139. {
  1140. * x80tox96()
  1141. *
  1142. * Availability:
  1143. * Non-Carbon CFM: not available
  1144. * CarbonLib: not available
  1145. * Mac OS X: not available
  1146. }
  1147. procedure x80tox96(const (*var*) x80: extended80; var x: extended96); external name '_x80tox96';
  1148. {$endc} {CALL_NOT_IN_CARBON}
  1149. {$endc} {TARGET_CPU_68K}
  1150. {$endc}
  1151. {*******************************************************************************
  1152. * *
  1153. * PowerPC-only Function Prototypes *
  1154. * *
  1155. *******************************************************************************}
  1156. {$ifc TARGET_CPU_PPC}
  1157. {
  1158. * cosl()
  1159. *
  1160. * Availability:
  1161. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1162. * CarbonLib: in CarbonLib 1.0 and later
  1163. * Mac OS X: not available
  1164. }
  1165. function cosl(x: LongDouble): LongDouble; external name '_cosl';
  1166. {
  1167. * sinl()
  1168. *
  1169. * Availability:
  1170. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1171. * CarbonLib: in CarbonLib 1.0 and later
  1172. * Mac OS X: not available
  1173. }
  1174. function sinl(x: LongDouble): LongDouble; external name '_sinl';
  1175. {
  1176. * tanl()
  1177. *
  1178. * Availability:
  1179. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1180. * CarbonLib: in CarbonLib 1.0 and later
  1181. * Mac OS X: not available
  1182. }
  1183. function tanl(x: LongDouble): LongDouble; external name '_tanl';
  1184. {
  1185. * acosl()
  1186. *
  1187. * Availability:
  1188. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1189. * CarbonLib: in CarbonLib 1.0 and later
  1190. * Mac OS X: not available
  1191. }
  1192. function acosl(x: LongDouble): LongDouble; external name '_acosl';
  1193. {
  1194. * asinl()
  1195. *
  1196. * Availability:
  1197. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1198. * CarbonLib: in CarbonLib 1.0 and later
  1199. * Mac OS X: not available
  1200. }
  1201. function asinl(x: LongDouble): LongDouble; external name '_asinl';
  1202. {
  1203. * atanl()
  1204. *
  1205. * Availability:
  1206. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1207. * CarbonLib: in CarbonLib 1.0 and later
  1208. * Mac OS X: not available
  1209. }
  1210. function atanl(x: LongDouble): LongDouble; external name '_atanl';
  1211. {
  1212. * atan2l()
  1213. *
  1214. * Availability:
  1215. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1216. * CarbonLib: in CarbonLib 1.0 and later
  1217. * Mac OS X: not available
  1218. }
  1219. function atan2l(y: LongDouble; x: LongDouble): LongDouble; external name '_atan2l';
  1220. {
  1221. * coshl()
  1222. *
  1223. * Availability:
  1224. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1225. * CarbonLib: in CarbonLib 1.0 and later
  1226. * Mac OS X: not available
  1227. }
  1228. function coshl(x: LongDouble): LongDouble; external name '_coshl';
  1229. {
  1230. * sinhl()
  1231. *
  1232. * Availability:
  1233. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1234. * CarbonLib: in CarbonLib 1.0 and later
  1235. * Mac OS X: not available
  1236. }
  1237. function sinhl(x: LongDouble): LongDouble; external name '_sinhl';
  1238. {
  1239. * tanhl()
  1240. *
  1241. * Availability:
  1242. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1243. * CarbonLib: in CarbonLib 1.0 and later
  1244. * Mac OS X: not available
  1245. }
  1246. function tanhl(x: LongDouble): LongDouble; external name '_tanhl';
  1247. {
  1248. * acoshl()
  1249. *
  1250. * Availability:
  1251. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1252. * CarbonLib: in CarbonLib 1.0 and later
  1253. * Mac OS X: not available
  1254. }
  1255. function acoshl(x: LongDouble): LongDouble; external name '_acoshl';
  1256. {
  1257. * asinhl()
  1258. *
  1259. * Availability:
  1260. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1261. * CarbonLib: in CarbonLib 1.0 and later
  1262. * Mac OS X: not available
  1263. }
  1264. function asinhl(x: LongDouble): LongDouble; external name '_asinhl';
  1265. {
  1266. * atanhl()
  1267. *
  1268. * Availability:
  1269. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1270. * CarbonLib: in CarbonLib 1.0 and later
  1271. * Mac OS X: not available
  1272. }
  1273. function atanhl(x: LongDouble): LongDouble; external name '_atanhl';
  1274. {
  1275. * expl()
  1276. *
  1277. * Availability:
  1278. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1279. * CarbonLib: in CarbonLib 1.0 and later
  1280. * Mac OS X: not available
  1281. }
  1282. function expl(x: LongDouble): LongDouble; external name '_expl';
  1283. {
  1284. * expm1l()
  1285. *
  1286. * Availability:
  1287. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1288. * CarbonLib: in CarbonLib 1.0 and later
  1289. * Mac OS X: not available
  1290. }
  1291. function expm1l(x: LongDouble): LongDouble; external name '_expm1l';
  1292. {
  1293. * exp2l()
  1294. *
  1295. * Availability:
  1296. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1297. * CarbonLib: in CarbonLib 1.0 and later
  1298. * Mac OS X: not available
  1299. }
  1300. function exp2l(x: LongDouble): LongDouble; external name '_exp2l';
  1301. {
  1302. * frexpl()
  1303. *
  1304. * Availability:
  1305. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1306. * CarbonLib: in CarbonLib 1.0 and later
  1307. * Mac OS X: not available
  1308. }
  1309. function frexpl(x: LongDouble; var exponent: SInt32): LongDouble; external name '_frexpl';
  1310. {
  1311. * ldexpl()
  1312. *
  1313. * Availability:
  1314. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1315. * CarbonLib: in CarbonLib 1.0 and later
  1316. * Mac OS X: not available
  1317. }
  1318. function ldexpl(x: LongDouble; n: SInt32): LongDouble; external name '_ldexpl';
  1319. {
  1320. * logl()
  1321. *
  1322. * Availability:
  1323. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1324. * CarbonLib: in CarbonLib 1.0 and later
  1325. * Mac OS X: not available
  1326. }
  1327. function logl(x: LongDouble): LongDouble; external name '_logl';
  1328. {
  1329. * log1pl()
  1330. *
  1331. * Availability:
  1332. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1333. * CarbonLib: in CarbonLib 1.0 and later
  1334. * Mac OS X: not available
  1335. }
  1336. function log1pl(x: LongDouble): LongDouble; external name '_log1pl';
  1337. {
  1338. * log10l()
  1339. *
  1340. * Availability:
  1341. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1342. * CarbonLib: in CarbonLib 1.0 and later
  1343. * Mac OS X: not available
  1344. }
  1345. function log10l(x: LongDouble): LongDouble; external name '_log10l';
  1346. {
  1347. * log2l()
  1348. *
  1349. * Availability:
  1350. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1351. * CarbonLib: in CarbonLib 1.0 and later
  1352. * Mac OS X: not available
  1353. }
  1354. function log2l(x: LongDouble): LongDouble; external name '_log2l';
  1355. {
  1356. * logbl()
  1357. *
  1358. * Availability:
  1359. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1360. * CarbonLib: in CarbonLib 1.0 and later
  1361. * Mac OS X: not available
  1362. }
  1363. function logbl(x: LongDouble): LongDouble; external name '_logbl';
  1364. {
  1365. * scalbl()
  1366. *
  1367. * Availability:
  1368. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1369. * CarbonLib: in CarbonLib 1.0 and later
  1370. * Mac OS X: not available
  1371. }
  1372. function scalbl(x: LongDouble; n: SInt32): LongDouble; external name '_scalbl';
  1373. {
  1374. * fabsl()
  1375. *
  1376. * Availability:
  1377. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1378. * CarbonLib: in CarbonLib 1.0 and later
  1379. * Mac OS X: not available
  1380. }
  1381. function fabsl(x: LongDouble): LongDouble; external name '_fabsl';
  1382. {
  1383. * hypotl()
  1384. *
  1385. * Availability:
  1386. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1387. * CarbonLib: in CarbonLib 1.0 and later
  1388. * Mac OS X: not available
  1389. }
  1390. function hypotl(x: LongDouble; y: LongDouble): LongDouble; external name '_hypotl';
  1391. {
  1392. * powl()
  1393. *
  1394. * Availability:
  1395. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1396. * CarbonLib: in CarbonLib 1.0 and later
  1397. * Mac OS X: not available
  1398. }
  1399. function powl(x: LongDouble; y: LongDouble): LongDouble; external name '_powl';
  1400. {
  1401. * sqrtl()
  1402. *
  1403. * Availability:
  1404. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1405. * CarbonLib: in CarbonLib 1.0 and later
  1406. * Mac OS X: not available
  1407. }
  1408. function sqrtl(x: LongDouble): LongDouble; external name '_sqrtl';
  1409. {
  1410. * erfl()
  1411. *
  1412. * Availability:
  1413. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1414. * CarbonLib: in CarbonLib 1.0 and later
  1415. * Mac OS X: not available
  1416. }
  1417. function erfl(x: LongDouble): LongDouble; external name '_erfl';
  1418. {
  1419. * erfcl()
  1420. *
  1421. * Availability:
  1422. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1423. * CarbonLib: in CarbonLib 1.0 and later
  1424. * Mac OS X: not available
  1425. }
  1426. function erfcl(x: LongDouble): LongDouble; external name '_erfcl';
  1427. {
  1428. * gammal()
  1429. *
  1430. * Availability:
  1431. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1432. * CarbonLib: in CarbonLib 1.0 and later
  1433. * Mac OS X: not available
  1434. }
  1435. function gammal(x: LongDouble): LongDouble; external name '_gammal';
  1436. {
  1437. * lgammal()
  1438. *
  1439. * Availability:
  1440. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1441. * CarbonLib: in CarbonLib 1.0 and later
  1442. * Mac OS X: not available
  1443. }
  1444. function lgammal(x: LongDouble): LongDouble; external name '_lgammal';
  1445. {
  1446. * ceill()
  1447. *
  1448. * Availability:
  1449. * Non-Carbon CFM: in MathLib 2.0 and later or as macro/inline
  1450. * CarbonLib: in CarbonLib 1.0 and later
  1451. * Mac OS X: not available
  1452. }
  1453. function ceill(x: LongDouble): LongDouble; external name '_ceill';
  1454. {
  1455. * floorl()
  1456. *
  1457. * Availability:
  1458. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1459. * CarbonLib: in CarbonLib 1.0 and later
  1460. * Mac OS X: not available
  1461. }
  1462. function floorl(x: LongDouble): LongDouble; external name '_floorl';
  1463. {
  1464. * rintl()
  1465. *
  1466. * Availability:
  1467. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1468. * CarbonLib: in CarbonLib 1.0 and later
  1469. * Mac OS X: not available
  1470. }
  1471. function rintl(x: LongDouble): LongDouble; external name '_rintl';
  1472. {
  1473. * nearbyintl()
  1474. *
  1475. * Availability:
  1476. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1477. * CarbonLib: in CarbonLib 1.0 and later
  1478. * Mac OS X: not available
  1479. }
  1480. function nearbyintl(x: LongDouble): LongDouble; external name '_nearbyintl';
  1481. {
  1482. * rinttoll()
  1483. *
  1484. * Availability:
  1485. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1486. * CarbonLib: in CarbonLib 1.0 and later
  1487. * Mac OS X: not available
  1488. }
  1489. function rinttoll(x: LongDouble): SInt32; external name '_rinttoll';
  1490. {
  1491. * roundl()
  1492. *
  1493. * Availability:
  1494. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1495. * CarbonLib: in CarbonLib 1.0 and later
  1496. * Mac OS X: not available
  1497. }
  1498. function roundl(x: LongDouble): LongDouble; external name '_roundl';
  1499. {
  1500. * roundtoll()
  1501. *
  1502. * Availability:
  1503. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1504. * CarbonLib: in CarbonLib 1.0 and later
  1505. * Mac OS X: not available
  1506. }
  1507. function roundtoll(x: LongDouble): SInt32; external name '_roundtoll';
  1508. {
  1509. * truncl()
  1510. *
  1511. * Availability:
  1512. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1513. * CarbonLib: in CarbonLib 1.0 and later
  1514. * Mac OS X: not available
  1515. }
  1516. function truncl(x: LongDouble): LongDouble; external name '_truncl';
  1517. {
  1518. * remainderl()
  1519. *
  1520. * Availability:
  1521. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1522. * CarbonLib: in CarbonLib 1.0 and later
  1523. * Mac OS X: not available
  1524. }
  1525. function remainderl(x: LongDouble; y: LongDouble): LongDouble; external name '_remainderl';
  1526. {
  1527. * remquol()
  1528. *
  1529. * Availability:
  1530. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1531. * CarbonLib: in CarbonLib 1.0 and later
  1532. * Mac OS X: not available
  1533. }
  1534. function remquol(x: LongDouble; y: LongDouble; var quo: SInt32): LongDouble; external name '_remquol';
  1535. {
  1536. * copysignl()
  1537. *
  1538. * Availability:
  1539. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1540. * CarbonLib: in CarbonLib 1.0 and later
  1541. * Mac OS X: not available
  1542. }
  1543. function copysignl(x: LongDouble; y: LongDouble): LongDouble; external name '_copysignl';
  1544. {
  1545. * fdiml()
  1546. *
  1547. * Availability:
  1548. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1549. * CarbonLib: in CarbonLib 1.0 and later
  1550. * Mac OS X: not available
  1551. }
  1552. function fdiml(x: LongDouble; y: LongDouble): LongDouble; external name '_fdiml';
  1553. {
  1554. * fmaxl()
  1555. *
  1556. * Availability:
  1557. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1558. * CarbonLib: in CarbonLib 1.0 and later
  1559. * Mac OS X: not available
  1560. }
  1561. function fmaxl(x: LongDouble; y: LongDouble): LongDouble; external name '_fmaxl';
  1562. {
  1563. * fminl()
  1564. *
  1565. * Availability:
  1566. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1567. * CarbonLib: in CarbonLib 1.0 and later
  1568. * Mac OS X: not available
  1569. }
  1570. function fminl(x: LongDouble; y: LongDouble): LongDouble; external name '_fminl';
  1571. {$ifc undefined __NOEXTENSIONS__}
  1572. {
  1573. * relationl()
  1574. *
  1575. * Availability:
  1576. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1577. * CarbonLib: in CarbonLib 1.0 and later
  1578. * Mac OS X: not available
  1579. }
  1580. function relationl(x: LongDouble; y: LongDouble): relop; external name '_relationl';
  1581. {
  1582. * num2decl()
  1583. *
  1584. * Availability:
  1585. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1586. * CarbonLib: in CarbonLib 1.0 and later
  1587. * Mac OS X: not available
  1588. }
  1589. procedure num2decl(const (*var*) f: decform; x: LongDouble; var d: decimal); external name '_num2decl';
  1590. {
  1591. * dec2numl()
  1592. *
  1593. * Availability:
  1594. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1595. * CarbonLib: in CarbonLib 1.0 and later
  1596. * Mac OS X: not available
  1597. }
  1598. function dec2numl(const (*var*) d: decimal): LongDouble; external name '_dec2numl';
  1599. {$endc}
  1600. {$endc} {TARGET_CPU_PPC}
  1601. {$endc} {TARGET_OS_MAC}
  1602. {$ifc undefined __NOEXTENSIONS__}
  1603. {
  1604. MathLib v2 has two new transfer functions: x80tod and dtox80. They can
  1605. be used to directly transform 68k 80-bit extended data types to double
  1606. and back for PowerPC based machines without using the functions
  1607. x80told or ldtox80. Double rounding may occur.
  1608. }
  1609. {
  1610. * x80tod()
  1611. *
  1612. * Availability:
  1613. * Non-Carbon CFM: in MathLib 2.0 and later
  1614. * CarbonLib: in CarbonLib 1.0 and later
  1615. * Mac OS X: in version 10.0 and later
  1616. }
  1617. function x80tod(const (*var*) x80: extended80): Double; external name '_x80tod';
  1618. {
  1619. * dtox80()
  1620. *
  1621. * Availability:
  1622. * Non-Carbon CFM: in MathLib 2.0 and later
  1623. * CarbonLib: in CarbonLib 1.0 and later
  1624. * Mac OS X: in version 10.0 and later
  1625. }
  1626. procedure dtox80((*const*) var x: Double; var x80: extended80); external name '_dtox80';
  1627. {$ifc TARGET_CPU_PPC}
  1628. {
  1629. * x80told()
  1630. *
  1631. * Availability:
  1632. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1633. * CarbonLib: in CarbonLib 1.0 and later
  1634. * Mac OS X: not available
  1635. }
  1636. procedure x80told(const (*var*) x80: extended80; var x: LongDouble); external name '_x80told';
  1637. {
  1638. * ldtox80()
  1639. *
  1640. * Availability:
  1641. * Non-Carbon CFM: in MathLib 1.0 and later or as macro/inline
  1642. * CarbonLib: in CarbonLib 1.0 and later
  1643. * Mac OS X: not available
  1644. }
  1645. procedure ldtox80((*const*) var x: LongDouble; var x80: extended80); external name '_ldtox80';
  1646. {$endc} {TARGET_CPU_PPC}
  1647. {$endc}
  1648. {$ALIGN MAC68K}
  1649. end.