fp.pas 66 KB

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