fp.pas 66 KB

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