mathftst.c 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. mathftst.c
  9. Abstract:
  10. This module implements the tests for the single-precision floating point
  11. math portion of the C library.
  12. Author:
  13. Chris Stevens 6-Jan-2017
  14. Environment:
  15. Test
  16. --*/
  17. //
  18. // ------------------------------------------------------------------- Includes
  19. //
  20. //
  21. // Define this so it doesn't get defined to an import.
  22. //
  23. #define LIBC_API
  24. #include <minoca/lib/types.h>
  25. #include <minoca/lib/status.h>
  26. #include <minoca/lib/rtl.h>
  27. #include <math.h>
  28. #include <stdio.h>
  29. //
  30. // ---------------------------------------------------------------- Definitions
  31. //
  32. //
  33. // Define the amount that the result is allowed to vary from the known answer.
  34. //
  35. #define MATH_RESULT_SLOP 2
  36. //
  37. // ------------------------------------------------------ Data Type Definitions
  38. //
  39. typedef struct _MATH_TRIG_FLOAT_VALUE {
  40. float Argument;
  41. float Sine;
  42. float Cosine;
  43. float Tangent;
  44. float HyperbolicSine;
  45. float HyperbolicCosine;
  46. float HyperbolicTangent;
  47. } MATH_TRIG_FLOAT_VALUE, *PMATH_TRIG_FLOAT_VALUE;
  48. typedef struct _MATH_TEST_SQUARE_ROOT_FLOAT_VALUE {
  49. float Argument;
  50. float SquareRoot;
  51. } MATH_TEST_SQUARE_ROOT_FLOAT_VALUE, *PMATH_TEST_SQUARE_ROOT_FLOAT_VALUE;
  52. typedef struct _MATH_ARC_FLOAT_VALUE {
  53. float Argument;
  54. float ArcSine;
  55. float ArcCosine;
  56. float ArcTangent;
  57. } MATH_ARC_FLOAT_VALUE, *PMATH_ARC_FLOAT_VALUE;
  58. typedef struct _MATH_ARC_TANGENT_FLOAT {
  59. float Numerator;
  60. float Denominator;
  61. float ArcTangent;
  62. float ArcTangent2;
  63. } MATH_ARC_TANGENT_FLOAT, *PMATH_ARC_TANGENT_FLOAT;
  64. typedef struct _MATH_EXP_FLOAT {
  65. float Argument;
  66. float Exponentiation;
  67. float ExponentiationMinusOne;
  68. } MATH_EXP_FLOAT, *PMATH_EXP_FLOAT;
  69. typedef struct _MATH_POWER_FLOAT {
  70. float Value;
  71. float Exponent;
  72. float Result;
  73. float Hypotenuse;
  74. } MATH_POWER_FLOAT, *PMATH_POWER_FLOAT;
  75. typedef struct _MATH_LOGARITHM_FLOAT {
  76. float Argument;
  77. float Logarithm;
  78. float Log2;
  79. float Log10;
  80. } MATH_LOGARITHM_FLOAT, *PMATH_LOGARITHM_FLOAT;
  81. typedef struct _MATH_DECOMPOSITION_FLOAT {
  82. float Argument;
  83. float IntegerPart;
  84. float FractionalPart;
  85. } MATH_DECOMPOSITION_FLOAT, *PMATH_DECOMPOSITION_FLOAT;
  86. typedef struct _MATH_CEILING_FLOOR_FLOAT_VALUE {
  87. float Argument;
  88. float Ceiling;
  89. float Floor;
  90. } MATH_CEILING_FLOOR_FLOAT_VALUE, *PMATH_CEILING_FLOOR_FLOAT_VALUE;
  91. typedef struct _MATH_MODULO_FLOAT_VALUE {
  92. float Numerator;
  93. float Denominator;
  94. float Remainder;
  95. } MATH_MODULO_FLOAT_VALUE, *PMATH_MODULO_FLOAT_VALUE;
  96. //
  97. // ----------------------------------------------- Internal Function Prototypes
  98. //
  99. ULONG
  100. TestBasicTrigonometryFloat (
  101. VOID
  102. );
  103. ULONG
  104. TestSquareRootFloat (
  105. VOID
  106. );
  107. ULONG
  108. TestArcTrigonometryFloat (
  109. VOID
  110. );
  111. ULONG
  112. TestExponentiationFloat (
  113. VOID
  114. );
  115. ULONG
  116. TestPowerFloat (
  117. VOID
  118. );
  119. ULONG
  120. TestLogarithmFloat (
  121. VOID
  122. );
  123. ULONG
  124. TestDecompositionFloat (
  125. VOID
  126. );
  127. ULONG
  128. TestCeilingAndFloorFloat (
  129. VOID
  130. );
  131. ULONG
  132. TestModuloFloat (
  133. VOID
  134. );
  135. BOOL
  136. TestCompareResultsFloat (
  137. float Value1,
  138. float Value2
  139. );
  140. //
  141. // -------------------------------------------------------------------- Globals
  142. //
  143. MATH_TRIG_FLOAT_VALUE TestBasicTrigonometryFloats[] = {
  144. {-0x1.921fb6p-1,
  145. -0x1.6a09e8p-1,
  146. 0x1.6a09e6p-1,
  147. -0x1.000000p+0,
  148. -0x1.bcc272p-1,
  149. 0x1.531994p+0,
  150. -0x1.4fc444p-1},
  151. {0x1.921fb6p-1,
  152. 0x1.6a09e8p-1,
  153. 0x1.6a09e6p-1,
  154. 0x1.000000p+0,
  155. 0x1.bcc272p-1,
  156. 0x1.531994p+0,
  157. 0x1.4fc444p-1},
  158. {0x1.921fb6p+1,
  159. -0x1.777a5cp-24,
  160. -0x1.000000p+0,
  161. 0x1.777a5cp-24,
  162. 0x1.718f46p+3,
  163. 0x1.72f14cp+3,
  164. 0x1.fe1760p-1},
  165. {-0x1.921fb6p+1,
  166. 0x1.777a5cp-24,
  167. -0x1.000000p+0,
  168. -0x1.777a5cp-24,
  169. -0x1.718f46p+3,
  170. 0x1.72f14cp+3,
  171. -0x1.fe1760p-1},
  172. {0x1.f6a7a2p+1,
  173. -0x1.6a09e6p-1,
  174. -0x1.6a09e8p-1,
  175. 0x1.fffffcp-1,
  176. 0x1.95dfe0p+4,
  177. 0x1.963094p+4,
  178. 0x1.ff9a46p-1},
  179. {-0x1.f6a7a2p+1,
  180. 0x1.6a09e6p-1,
  181. -0x1.6a09e8p-1,
  182. -0x1.fffffcp-1,
  183. -0x1.95dfe0p+4,
  184. 0x1.963094p+4,
  185. -0x1.ff9a46p-1},
  186. {0x1.921fb6p+2,
  187. 0x1.777a5cp-23,
  188. 0x1.000000p+0,
  189. 0x1.777a5cp-23,
  190. 0x1.0bbeb4p+8,
  191. 0x1.0bbf30p+8,
  192. 0x1.ffff16p-1},
  193. {-0x1.921fb6p+2,
  194. -0x1.777a5cp-23,
  195. 0x1.000000p+0,
  196. -0x1.777a5cp-23,
  197. -0x1.0bbeb4p+8,
  198. 0x1.0bbf30p+8,
  199. -0x1.ffff16p-1},
  200. {0x1.f6a7a2p+1,
  201. -0x1.6a09e6p-1,
  202. -0x1.6a09e8p-1,
  203. 0x1.fffffcp-1,
  204. 0x1.95dfe0p+4,
  205. 0x1.963094p+4,
  206. 0x1.ff9a46p-1},
  207. {-0x1.f6a7a2p+1,
  208. 0x1.6a09e6p-1,
  209. -0x1.6a09e8p-1,
  210. -0x1.fffffcp-1,
  211. -0x1.95dfe0p+4,
  212. 0x1.963094p+4,
  213. -0x1.ff9a46p-1},
  214. {0x1.5fdbbep+2,
  215. -0x1.6a09eap-1,
  216. 0x1.6a09e4p-1,
  217. -0x1.000004p+0,
  218. 0x1.e84b3cp+6,
  219. 0x1.e84f6cp+6,
  220. 0x1.fffb9ap-1},
  221. {-0x1.5fdbbep+2,
  222. 0x1.6a09eap-1,
  223. 0x1.6a09e4p-1,
  224. 0x1.000004p+0,
  225. -0x1.e84b3cp+6,
  226. 0x1.e84f6cp+6,
  227. -0x1.fffb9ap-1},
  228. {0x1.86a000p+16,
  229. 0x1.24daaap-5,
  230. -0x1.ffac38p-1,
  231. -0x1.250a9ep-5,
  232. INFINITY,
  233. INFINITY,
  234. 0x1.000000p+0},
  235. {0x1.2a05f2p+33,
  236. -0x1.f334c8p-2,
  237. 0x1.bf098ap-1,
  238. -0x1.1de000p-1,
  239. INFINITY,
  240. INFINITY,
  241. 0x1.000000p+0},
  242. {0x1.c6bf52p+49,
  243. 0x1.fd267ep-1,
  244. 0x1.af8c60p-4,
  245. 0x1.2e08d6p+3,
  246. INFINITY,
  247. INFINITY,
  248. 0x1.000000p+0},
  249. {0x1.5af1d8p+66,
  250. 0x1.502ad2p-1,
  251. 0x1.822e46p-1,
  252. 0x1.bdb120p-1,
  253. INFINITY,
  254. INFINITY,
  255. 0x1.000000p+0},
  256. {0x1.08b2a2p+83,
  257. -0x1.9f9964p-2,
  258. 0x1.d3ef68p-1,
  259. -0x1.c6bc50p-2,
  260. INFINITY,
  261. INFINITY,
  262. 0x1.000000p+0},
  263. {0x1.93e594p+99,
  264. -0x1.951360p-1,
  265. -0x1.392444p-1,
  266. 0x1.4b2876p+0,
  267. INFINITY,
  268. INFINITY,
  269. 0x1.000000p+0},
  270. {0x1.342618p+116,
  271. -0x1.ffaaacp-1,
  272. -0x1.278c42p-5,
  273. 0x1.bb3312p+4,
  274. INFINITY,
  275. INFINITY,
  276. 0x1.000000p+0},
  277. {INFINITY,
  278. -NAN,
  279. -NAN,
  280. -NAN,
  281. INFINITY,
  282. INFINITY,
  283. 0x1.000000p+0},
  284. {INFINITY,
  285. -NAN,
  286. -NAN,
  287. -NAN,
  288. INFINITY,
  289. INFINITY,
  290. 0x1.000000p+0},
  291. {INFINITY,
  292. -NAN,
  293. -NAN,
  294. -NAN,
  295. INFINITY,
  296. INFINITY,
  297. 0x1.000000p+0},
  298. {INFINITY,
  299. -NAN,
  300. -NAN,
  301. -NAN,
  302. INFINITY,
  303. INFINITY,
  304. 0x1.000000p+0},
  305. {INFINITY,
  306. -NAN,
  307. -NAN,
  308. -NAN,
  309. INFINITY,
  310. INFINITY,
  311. 0x1.000000p+0},
  312. {-0x1.24f800p+18,
  313. -0x1.b68860p-4,
  314. -0x1.fd0e9ep-1,
  315. 0x1.b91162p-4,
  316. -INFINITY,
  317. INFINITY,
  318. -0x1.000000p+0},
  319. {-0x1.550f7ep+51,
  320. -0x1.764b5ep-1,
  321. 0x1.5d5a70p-1,
  322. -0x1.1246c4p+0,
  323. -INFINITY,
  324. INFINITY,
  325. -0x1.000000p+0},
  326. {-0x1.8d0bf4p+84,
  327. -0x1.149138p-2,
  328. -0x1.ecf8e6p-1,
  329. 0x1.1f3e02p-2,
  330. -INFINITY,
  331. INFINITY,
  332. -0x1.000000p+0},
  333. {-INFINITY,
  334. -NAN,
  335. -NAN,
  336. -NAN,
  337. -INFINITY,
  338. INFINITY,
  339. -0x1.000000p+0},
  340. {-INFINITY,
  341. -NAN,
  342. -NAN,
  343. -NAN,
  344. -INFINITY,
  345. INFINITY,
  346. -0x1.000000p+0},
  347. {-INFINITY,
  348. -NAN,
  349. -NAN,
  350. -NAN,
  351. -INFINITY,
  352. INFINITY,
  353. -0x1.000000p+0},
  354. {-INFINITY,
  355. -NAN,
  356. -NAN,
  357. -NAN,
  358. -INFINITY,
  359. INFINITY,
  360. -0x1.000000p+0},
  361. {0x1.4f8b58p-17,
  362. 0x1.4f8b58p-17,
  363. 0x1.000000p+0,
  364. 0x1.4f8b58p-17,
  365. 0x1.4f8b58p-17,
  366. 0x1.000000p+0,
  367. 0x1.4f8b58p-17},
  368. {0x1.b7cdfep-34,
  369. 0x1.b7cdfep-34,
  370. 0x1.000000p+0,
  371. 0x1.b7cdfep-34,
  372. 0x1.b7cdfep-34,
  373. 0x1.000000p+0,
  374. 0x1.b7cdfep-34},
  375. {0x1.203afap-50,
  376. 0x1.203afap-50,
  377. 0x1.000000p+0,
  378. 0x1.203afap-50,
  379. 0x1.203afap-50,
  380. 0x1.000000p+0,
  381. 0x1.203afap-50},
  382. {0x1.79ca10p-67,
  383. 0x1.79ca10p-67,
  384. 0x1.000000p+0,
  385. 0x1.79ca10p-67,
  386. 0x1.79ca10p-67,
  387. 0x1.000000p+0,
  388. 0x1.79ca10p-67},
  389. {-0x1.f75104p-16,
  390. -0x1.f75104p-16,
  391. 0x1.000000p+0,
  392. -0x1.f75104p-16,
  393. -0x1.f75104p-16,
  394. 0x1.000000p+0,
  395. -0x1.f75102p-16},
  396. {-0x1.07e1fep-35,
  397. -0x1.07e1fep-35,
  398. 0x1.000000p+0,
  399. -0x1.07e1fep-35,
  400. -0x1.07e1fep-35,
  401. 0x1.000000p+0,
  402. -0x1.07e1fep-35},
  403. {-0x1.59e060p-52,
  404. -0x1.59e060p-52,
  405. 0x1.000000p+0,
  406. -0x1.59e060p-52,
  407. -0x1.59e060p-52,
  408. 0x1.000000p+0,
  409. -0x1.59e060p-52},
  410. {-0x1.1b578cp-65,
  411. -0x1.1b578cp-65,
  412. 0x1.000000p+0,
  413. -0x1.1b578cp-65,
  414. -0x1.1b578cp-65,
  415. 0x1.000000p+0,
  416. -0x1.1b578cp-65},
  417. {-0x0.000000p+0,
  418. -0x0.000000p+0,
  419. 0x1.000000p+0,
  420. -0x0.000000p+0,
  421. -0x0.000000p+0,
  422. 0x1.000000p+0,
  423. -0x0.000000p+0},
  424. {-0x0.000000p+0,
  425. -0x0.000000p+0,
  426. 0x1.000000p+0,
  427. -0x0.000000p+0,
  428. -0x0.000000p+0,
  429. 0x1.000000p+0,
  430. -0x0.000000p+0},
  431. {INFINITY,
  432. -NAN,
  433. -NAN,
  434. -NAN,
  435. INFINITY,
  436. INFINITY,
  437. 0x1.000000p+0},
  438. {-INFINITY,
  439. -NAN,
  440. -NAN,
  441. -NAN,
  442. -INFINITY,
  443. INFINITY,
  444. -0x1.000000p+0},
  445. {NAN,
  446. NAN,
  447. NAN,
  448. NAN,
  449. NAN,
  450. NAN,
  451. NAN},
  452. };
  453. MATH_TEST_SQUARE_ROOT_FLOAT_VALUE TestSquareRootFloats[] = {
  454. {0x1.921fb6p-1, 0x1.c5bf8ap-1},
  455. {0x1.921fb6p+1, 0x1.c5bf8ap+0},
  456. {0x1.f6a7a2p+1, 0x1.fb4e4ep+0},
  457. {0x1.921fb6p+2, 0x1.40d932p+1},
  458. {0x1.f6a7a2p+1, 0x1.fb4e4ep+0},
  459. {0x1.5fdbbep+2, 0x1.2c2050p+1},
  460. {0x1.86a000p+16, 0x1.3c3a4ep+8},
  461. {0x1.2a05f2p+33, 0x1.86a000p+16},
  462. {0x1.c6bf52p+49, 0x1.e28678p+24},
  463. {0x1.5af1d8p+66, 0x1.2a05f2p+33},
  464. {0x1.08b2a2p+83, 0x1.702338p+41},
  465. {0x1.93e594p+99, 0x1.c6bf52p+49},
  466. {0x1.342618p+116, 0x1.18dddep+58},
  467. {INFINITY, INFINITY},
  468. {INFINITY, INFINITY},
  469. {INFINITY, INFINITY},
  470. {INFINITY, INFINITY},
  471. {INFINITY, INFINITY},
  472. {0x1.4f8b58p-17, 0x1.9e7c6ep-9},
  473. {0x1.b7cdfep-34, 0x1.4f8b58p-17},
  474. {0x1.203afap-50, 0x1.0fa338p-25},
  475. {0x1.79ca10p-67, 0x1.b7cdfep-34},
  476. {0x1.000000p+0, 0x1.000000p+0},
  477. {0x1.000000p+1, 0x1.6a09e6p+0},
  478. {0x1.800000p+1, 0x1.bb67aep+0},
  479. {0x1.22ad96p+27, 0x1.81c800p+13},
  480. {0x1.900000p+4, 0x1.400000p+2},
  481. {0x1.fae148p-1, 0x1.fd6efep-1},
  482. {-0x1.000000p+0, -NAN},
  483. {INFINITY, INFINITY},
  484. {-INFINITY, -NAN},
  485. {NAN, NAN},
  486. };
  487. MATH_ARC_FLOAT_VALUE TestArcFloats[] = {
  488. {-0x0.000000p+0,
  489. -0x0.000000p+0,
  490. 0x1.921fb6p+0,
  491. -0x0.000000p+0},
  492. {-0x1.47ae14p-7,
  493. -0x1.47af7ap-7,
  494. 0x1.94af14p+0,
  495. -0x1.47ab48p-7},
  496. {-0x1.47ae14p-6,
  497. -0x1.47b3acp-6,
  498. 0x1.973e84p+0,
  499. -0x1.47a2e6p-6},
  500. {-0x1.eb851ep-6,
  501. -0x1.eb9800p-6,
  502. 0x1.99ce16p+0,
  503. -0x1.eb5f64p-6},
  504. {-0x1.47ae14p-5,
  505. -0x1.47c476p-5,
  506. 0x1.9c5dd8p+0,
  507. -0x1.478162p-5},
  508. {-0x1.99999ap-5,
  509. -0x1.99c558p-5,
  510. 0x1.9eede0p+0,
  511. -0x1.99425ap-5},
  512. {-0x1.eb851ep-5,
  513. -0x1.ebd0bcp-5,
  514. 0x1.a17e3cp+0,
  515. -0x1.eaee72p-5},
  516. {-0x1.1eb852p-4,
  517. -0x1.1ef466p-4,
  518. 0x1.a40efcp+0,
  519. -0x1.1e40c8p-4},
  520. {-0x1.47ae14p-4,
  521. -0x1.4807d0p-4,
  522. 0x1.a6a032p+0,
  523. -0x1.46fbcep-4},
  524. {-0x1.70a3d8p-4,
  525. -0x1.7123b6p-4,
  526. 0x1.a931f0p+0,
  527. -0x1.6fa646p-4},
  528. {-0x1.99999ap-4,
  529. -0x1.9a4928p-4,
  530. 0x1.abc448p+0,
  531. -0x1.983e28p-4},
  532. {-0x1.c28f5cp-4,
  533. -0x1.c3793ep-4,
  534. 0x1.ae574ap+0,
  535. -0x1.c0c17ep-4},
  536. {-0x1.eb851ep-4,
  537. -0x1.ecb514p-4,
  538. 0x1.b0eb06p+0,
  539. -0x1.e92e4ep-4},
  540. {-0x1.0a3d70p-3,
  541. -0x1.0afee4p-3,
  542. 0x1.b37f92p+0,
  543. -0x1.08c154p-3},
  544. {-0x1.1eb852p-3,
  545. -0x1.1faa3cp-3,
  546. 0x1.b614fcp+0,
  547. -0x1.1cde56p-3},
  548. {-0x1.333334p-3,
  549. -0x1.345d24p-3,
  550. 0x1.b8ab5ap+0,
  551. -0x1.30ed38p-3},
  552. {-0x1.47ae14p-3,
  553. -0x1.49182ep-3,
  554. 0x1.bb42bcp+0,
  555. -0x1.44ed0cp-3},
  556. {-0x1.5c28f6p-3,
  557. -0x1.5ddbf2p-3,
  558. 0x1.bddb34p+0,
  559. -0x1.58dcf0p-3},
  560. {-0x1.70a3d8p-3,
  561. -0x1.72a908p-3,
  562. 0x1.c074d6p+0,
  563. -0x1.6cbbfep-3},
  564. {-0x1.851eb8p-3,
  565. -0x1.878004p-3,
  566. 0x1.c30fb6p+0,
  567. -0x1.808956p-3},
  568. {-0x1.99999ap-3,
  569. -0x1.9c618cp-3,
  570. 0x1.c5abe6p+0,
  571. -0x1.944420p-3},
  572. {-0x1.ae147ap-3,
  573. -0x1.b14e36p-3,
  574. 0x1.c8497cp+0,
  575. -0x1.a7eb86p-3},
  576. {-0x1.c28f5cp-3,
  577. -0x1.c646aap-3,
  578. 0x1.cae88ap+0,
  579. -0x1.bb7ebap-3},
  580. {-0x1.d70a3ep-3,
  581. -0x1.db4b8cp-3,
  582. 0x1.cd8926p+0,
  583. -0x1.cefcf2p-3},
  584. {-0x1.eb851ep-3,
  585. -0x1.f05d80p-3,
  586. 0x1.d02b66p+0,
  587. -0x1.e26568p-3},
  588. {-0x1.000000p-2,
  589. -0x1.02be9cp-2,
  590. 0x1.d2cf5cp+0,
  591. -0x1.f5b760p-3},
  592. {-0x1.0a3d70p-2,
  593. -0x1.0d55b0p-2,
  594. 0x1.d57522p+0,
  595. -0x1.04790ep-2},
  596. {-0x1.147ae2p-2,
  597. -0x1.17f458p-2,
  598. 0x1.d81cccp+0,
  599. -0x1.0e0a7ap-2},
  600. {-0x1.1eb852p-2,
  601. -0x1.229aecp-2,
  602. 0x1.dac670p+0,
  603. -0x1.178f98p-2},
  604. {-0x1.28f5c2p-2,
  605. -0x1.2d49ccp-2,
  606. 0x1.dd7228p+0,
  607. -0x1.210816p-2},
  608. {-0x1.333334p-2,
  609. -0x1.38015ap-2,
  610. 0x1.e0200cp+0,
  611. -0x1.2a73a8p-2},
  612. {-0x1.3d70a4p-2,
  613. -0x1.42c1f6p-2,
  614. 0x1.e2d032p+0,
  615. -0x1.33d1fap-2},
  616. {-0x1.47ae14p-2,
  617. -0x1.4d8c08p-2,
  618. 0x1.e582b8p+0,
  619. -0x1.3d22c4p-2},
  620. {-0x1.51eb86p-2,
  621. -0x1.585ff8p-2,
  622. 0x1.e837b4p+0,
  623. -0x1.4665c4p-2},
  624. {-0x1.5c28f6p-2,
  625. -0x1.633e30p-2,
  626. 0x1.eaef42p+0,
  627. -0x1.4f9ab0p-2},
  628. {-0x1.666666p-2,
  629. -0x1.6e271ep-2,
  630. 0x1.eda97cp+0,
  631. -0x1.58c148p-2},
  632. {-0x1.70a3d8p-2,
  633. -0x1.791b3ap-2,
  634. 0x1.f06684p+0,
  635. -0x1.61d954p-2},
  636. {-0x1.7ae148p-2,
  637. -0x1.841af2p-2,
  638. 0x1.f32672p+0,
  639. -0x1.6ae292p-2},
  640. {-0x1.851eb8p-2,
  641. -0x1.8f26c2p-2,
  642. 0x1.f5e966p+0,
  643. -0x1.73dccep-2},
  644. {-0x1.8f5c28p-2,
  645. -0x1.9a3f2ap-2,
  646. 0x1.f8af80p+0,
  647. -0x1.7cc7d6p-2},
  648. {-0x1.99999ap-2,
  649. -0x1.a564acp-2,
  650. 0x1.fb78e0p+0,
  651. -0x1.85a376p-2},
  652. {-0x1.a3d70ap-2,
  653. -0x1.b097ccp-2,
  654. 0x1.fe45a8p+0,
  655. -0x1.8e6f80p-2},
  656. {-0x1.ae147ap-2,
  657. -0x1.bbd916p-2,
  658. 0x1.008afep+1,
  659. -0x1.972bcap-2},
  660. {-0x1.b851ecp-2,
  661. -0x1.c7291ep-2,
  662. 0x1.01f4fep+1,
  663. -0x1.9fd82cp-2},
  664. {-0x1.c28f5cp-2,
  665. -0x1.d28876p-2,
  666. 0x1.0360eap+1,
  667. -0x1.a8747ep-2},
  668. {-0x1.ccccccp-2,
  669. -0x1.ddf7bap-2,
  670. 0x1.04ced2p+1,
  671. -0x1.b1009ep-2},
  672. {-0x1.d70a3ep-2,
  673. -0x1.e97794p-2,
  674. 0x1.063ecep+1,
  675. -0x1.b97c70p-2},
  676. {-0x1.e147aep-2,
  677. -0x1.f508a4p-2,
  678. 0x1.07b0f0p+1,
  679. -0x1.c1e7d2p-2},
  680. {-0x1.eb851ep-2,
  681. -0x1.0055d0p-1,
  682. 0x1.09254ep+1,
  683. -0x1.ca42acp-2},
  684. {-0x1.f5c290p-2,
  685. -0x1.0630a2p-1,
  686. 0x1.0a9c02p+1,
  687. -0x1.d28ceap-2},
  688. {-0x1.000000p-1,
  689. -0x1.0c1528p-1,
  690. 0x1.0c1524p+1,
  691. -0x1.dac670p-2},
  692. {-0x1.051eb8p-1,
  693. -0x1.1203c2p-1,
  694. 0x1.0d90cap+1,
  695. -0x1.e2ef30p-2},
  696. {-0x1.0a3d70p-1,
  697. -0x1.17fcdcp-1,
  698. 0x1.0f0f10p+1,
  699. -0x1.eb071ap-2},
  700. {-0x1.0f5c28p-1,
  701. -0x1.1e00e8p-1,
  702. 0x1.109014p+1,
  703. -0x1.f30e20p-2},
  704. {-0x1.147ae2p-1,
  705. -0x1.24105ap-1,
  706. 0x1.1213f0p+1,
  707. -0x1.fb0438p-2},
  708. {-0x1.19999ap-1,
  709. -0x1.2a2baap-1,
  710. 0x1.139ac4p+1,
  711. -0x1.0174aap-1},
  712. {-0x1.1eb852p-1,
  713. -0x1.30535ap-1,
  714. 0x1.1524b0p+1,
  715. -0x1.055ebap-1},
  716. {-0x1.23d70ap-1,
  717. -0x1.3687f4p-1,
  718. 0x1.16b1d6p+1,
  719. -0x1.094048p-1},
  720. {-0x1.28f5c2p-1,
  721. -0x1.3cca06p-1,
  722. 0x1.18425ap+1,
  723. -0x1.0d1952p-1},
  724. {-0x1.2e147ap-1,
  725. -0x1.431a28p-1,
  726. 0x1.19d664p+1,
  727. -0x1.10e9d8p-1},
  728. {-0x1.333334p-1,
  729. -0x1.497900p-1,
  730. 0x1.1b6e1ap+1,
  731. -0x1.14b1dep-1},
  732. {-0x1.3851ecp-1,
  733. -0x1.4fe732p-1,
  734. 0x1.1d09a6p+1,
  735. -0x1.187162p-1},
  736. {-0x1.3d70a4p-1,
  737. -0x1.566576p-1,
  738. 0x1.1ea936p+1,
  739. -0x1.1c2866p-1},
  740. {-0x1.428f5cp-1,
  741. -0x1.5cf48ep-1,
  742. 0x1.204cfep+1,
  743. -0x1.1fd6f0p-1},
  744. {-0x1.47ae14p-1,
  745. -0x1.63954ap-1,
  746. 0x1.21f52cp+1,
  747. -0x1.237d04p-1},
  748. {-0x1.4cccccp-1,
  749. -0x1.6a4884p-1,
  750. 0x1.23a1fcp+1,
  751. -0x1.271aa6p-1},
  752. {-0x1.51eb86p-1,
  753. -0x1.710f2ep-1,
  754. 0x1.2553a6p+1,
  755. -0x1.2aafdep-1},
  756. {-0x1.570a3ep-1,
  757. -0x1.77ea3cp-1,
  758. 0x1.270a68p+1,
  759. -0x1.2e3cb0p-1},
  760. {-0x1.5c28f6p-1,
  761. -0x1.7edac2p-1,
  762. 0x1.28c68ap+1,
  763. -0x1.31c124p-1},
  764. {-0x1.6147aep-1,
  765. -0x1.85e1e8p-1,
  766. 0x1.2a8854p+1,
  767. -0x1.353d42p-1},
  768. {-0x1.666666p-1,
  769. -0x1.8d00eap-1,
  770. 0x1.2c5014p+1,
  771. -0x1.38b112p-1},
  772. {-0x1.6b851ep-1,
  773. -0x1.94391ep-1,
  774. 0x1.2e1e22p+1,
  775. -0x1.3c1ca0p-1},
  776. {-0x1.70a3d8p-1,
  777. -0x1.9b8c00p-1,
  778. 0x1.2ff2dap+1,
  779. -0x1.3f7ff4p-1},
  780. {-0x1.75c290p-1,
  781. -0x1.a2fb1ep-1,
  782. 0x1.31cea0p+1,
  783. -0x1.42db16p-1},
  784. {-0x1.7ae148p-1,
  785. -0x1.aa8838p-1,
  786. 0x1.33b1e8p+1,
  787. -0x1.462e16p-1},
  788. {-0x1.800000p-1,
  789. -0x1.b23536p-1,
  790. 0x1.359d28p+1,
  791. -0x1.4978fap-1},
  792. {-0x1.851eb8p-1,
  793. -0x1.ba0430p-1,
  794. 0x1.3790e6p+1,
  795. -0x1.4cbbd2p-1},
  796. {-0x1.8a3d70p-1,
  797. -0x1.c1f77ap-1,
  798. 0x1.398db8p+1,
  799. -0x1.4ff6a8p-1},
  800. {-0x1.8f5c28p-1,
  801. -0x1.ca11a6p-1,
  802. 0x1.3b9442p+1,
  803. -0x1.53298ap-1},
  804. {-0x1.947ae2p-1,
  805. -0x1.d25594p-1,
  806. 0x1.3da53ep+1,
  807. -0x1.565484p-1},
  808. {-0x1.99999ap-1,
  809. -0x1.dac674p-1,
  810. 0x1.3fc176p+1,
  811. -0x1.5977a6p-1},
  812. {-0x1.9eb852p-1,
  813. -0x1.e367ecp-1,
  814. 0x1.41e9d4p+1,
  815. -0x1.5c92fap-1},
  816. {-0x1.a3d70ap-1,
  817. -0x1.ec3e14p-1,
  818. 0x1.441f5ep+1,
  819. -0x1.5fa690p-1},
  820. {-0x1.a8f5c2p-1,
  821. -0x1.f54d9ep-1,
  822. 0x1.466342p+1,
  823. -0x1.62b276p-1},
  824. {-0x1.ae147ap-1,
  825. -0x1.fe9beap-1,
  826. 0x1.48b6d4p+1,
  827. -0x1.65b6bep-1},
  828. {-0x1.b33334p-1,
  829. -0x1.0417a0p+0,
  830. 0x1.4b1baap+1,
  831. -0x1.68b372p-1},
  832. {-0x1.b851ecp-1,
  833. -0x1.090772p+0,
  834. 0x1.4d9392p+1,
  835. -0x1.6ba8a4p-1},
  836. {-0x1.bd70a4p-1,
  837. -0x1.0e21c0p+0,
  838. 0x1.5020bap+1,
  839. -0x1.6e9664p-1},
  840. {-0x1.c28f5cp-1,
  841. -0x1.136bb6p+0,
  842. 0x1.52c5b4p+1,
  843. -0x1.717cbep-1},
  844. {-0x1.c7ae14p-1,
  845. -0x1.18eb9ep+0,
  846. 0x1.5585a8p+1,
  847. -0x1.745bc6p-1},
  848. {-0x1.ccccccp-1,
  849. -0x1.1ea938p+0,
  850. 0x1.586476p+1,
  851. -0x1.77338ap-1},
  852. {-0x1.d1eb86p-1,
  853. -0x1.24ae46p+0,
  854. 0x1.5b66fcp+1,
  855. -0x1.7a041cp-1},
  856. {-0x1.d70a3ep-1,
  857. -0x1.2b0756p+0,
  858. 0x1.5e9384p+1,
  859. -0x1.7ccd88p-1},
  860. {-0x1.dc28f6p-1,
  861. -0x1.31c50cp+0,
  862. 0x1.61f260p+1,
  863. -0x1.7f8fe2p-1},
  864. {-0x1.e147aep-1,
  865. -0x1.38fe4ep+0,
  866. 0x1.658f02p+1,
  867. -0x1.824b3ap-1},
  868. {-0x1.e66666p-1,
  869. -0x1.40d412p+0,
  870. 0x1.6979e4p+1,
  871. -0x1.84ffa0p-1},
  872. {-0x1.eb851ep-1,
  873. -0x1.4978fap+0,
  874. 0x1.6dcc58p+1,
  875. -0x1.87ad24p-1},
  876. {-0x1.f0a3d8p-1,
  877. -0x1.534258p+0,
  878. 0x1.72b106p+1,
  879. -0x1.8a53d8p-1},
  880. {-0x1.f5c290p-1,
  881. -0x1.5ed692p+0,
  882. 0x1.787b24p+1,
  883. -0x1.8cf3ccp-1},
  884. {-0x1.fae148p-1,
  885. -0x1.6de3c8p+0,
  886. 0x1.8001bep+1,
  887. -0x1.8f8d10p-1},
  888. {-0x1.000000p+0,
  889. -0x1.921fb6p+0,
  890. 0x1.921fb6p+1,
  891. -0x1.921fb6p-1},
  892. {-0x1.028f5cp+0,
  893. -NAN,
  894. -NAN,
  895. -0x1.94abcep-1},
  896. {-0x1.051eb8p+0,
  897. -NAN,
  898. -NAN,
  899. -0x1.973168p-1},
  900. };
  901. MATH_ARC_TANGENT_FLOAT TestArcTangentFloats[] = {
  902. {NAN,
  903. NAN,
  904. NAN,
  905. NAN},
  906. {NAN,
  907. 0x1.000000p+0,
  908. NAN,
  909. NAN},
  910. {0x1.000000p+0,
  911. NAN,
  912. NAN,
  913. NAN},
  914. {0x1.000000p+0,
  915. 0x1.000000p+0,
  916. 0x1.921fb6p-1,
  917. 0x1.921fb6p-1},
  918. {0x0.000000p+0,
  919. 0x1.19999ap+0,
  920. 0x0.000000p+0,
  921. 0x0.000000p+0},
  922. {-0x0.000000p+0,
  923. 0x1.19999ap+0,
  924. -0x0.000000p+0,
  925. -0x0.000000p+0},
  926. {0x0.000000p+0,
  927. -0x1.19999ap+0,
  928. -0x0.000000p+0,
  929. 0x1.921fb6p+1},
  930. {-0x0.000000p+0,
  931. -0x1.19999ap+0,
  932. 0x0.000000p+0,
  933. -0x1.921fb6p+1},
  934. {0x1.e66666p-1,
  935. 0x0.000000p+0,
  936. 0x1.921fb6p+0,
  937. 0x1.921fb6p+0},
  938. {-0x1.e66666p-1,
  939. -0x0.000000p+0,
  940. 0x1.921fb6p+0,
  941. -0x1.921fb6p+0},
  942. {INFINITY,
  943. INFINITY,
  944. -NAN,
  945. 0x1.921fb6p-1},
  946. {-INFINITY,
  947. INFINITY,
  948. -NAN,
  949. -0x1.921fb6p-1},
  950. {INFINITY,
  951. -INFINITY,
  952. -NAN,
  953. 0x1.2d97c8p+1},
  954. {-INFINITY,
  955. -INFINITY,
  956. -NAN,
  957. -0x1.2d97c8p+1},
  958. {0x1.000000p-1,
  959. INFINITY,
  960. 0x0.000000p+0,
  961. 0x0.000000p+0},
  962. {-0x1.000000p-1,
  963. INFINITY,
  964. -0x0.000000p+0,
  965. -0x0.000000p+0},
  966. {0x1.000000p-1,
  967. -INFINITY,
  968. -0x0.000000p+0,
  969. 0x1.921fb6p+1},
  970. {-0x1.19999ap-1,
  971. -INFINITY,
  972. 0x0.000000p+0,
  973. -0x1.921fb6p+1},
  974. {INFINITY,
  975. 0x1.70a3d8p-4,
  976. 0x1.921fb6p+0,
  977. 0x1.921fb6p+0},
  978. {-INFINITY,
  979. -0x1.70a3d8p-4,
  980. 0x1.921fb6p+0,
  981. -0x1.921fb6p+0},
  982. {INFINITY,
  983. 0x1.000000p-1,
  984. 0x1.921fb6p+0,
  985. 0x1.921fb6p+0},
  986. {0x0.000000p+0,
  987. 0x1.000000p-1,
  988. 0x0.000000p+0,
  989. 0x0.000000p+0},
  990. {0x1.99999ap-2,
  991. 0x1.000000p+0,
  992. 0x1.85a378p-2,
  993. 0x1.85a378p-2},
  994. {-0x1.333334p-1,
  995. 0x0.000000p+0,
  996. -0x1.921fb6p+0,
  997. -0x1.921fb6p+0},
  998. {-0x1.99999ap-3,
  999. 0x1.99999ap-3,
  1000. -0x1.921fb6p-1,
  1001. -0x1.921fb6p-1},
  1002. {-0x1.99999ap-1,
  1003. -0x1.99999ap-1,
  1004. 0x1.921fb6p-1,
  1005. -0x1.2d97c8p+1},
  1006. };
  1007. MATH_EXP_FLOAT TestExpFloats[] = {
  1008. {INFINITY, INFINITY, INFINITY},
  1009. {-INFINITY, 0x0.000000p+0, -0x1.000000p+0},
  1010. {NAN, NAN, NAN},
  1011. {0x1.630000p+9, INFINITY, INFINITY},
  1012. {0x1.900000p+9, INFINITY, INFINITY},
  1013. {-0x1.630000p+9, 0x0.000000p+0, -0x1.000000p+0},
  1014. {-0x1.900000p+9, 0x0.000000p+0, -0x1.000000p+0},
  1015. {0x1.6353f8p-2, 0x1.6a316ep+0, 0x1.a8c5b8p-2},
  1016. {0x1.0a3d70p+0, 0x1.6a23c8p+1, 0x1.d44790p+0},
  1017. {0x1.400000p+3, 0x1.5829dcp+14, 0x1.5825dcp+14},
  1018. {0x1.900000p+6, INFINITY, INFINITY},
  1019. {-0x1.733334p+1, 0x1.c2c00cp-5, -0x1.e3d400p-1},
  1020. {0x1.921fb6p+1, 0x1.72404ap+4, 0x1.624048p+4},
  1021. {0x1.921fb6p+0, 0x1.33dedep+2, 0x1.e7bdbcp+1},
  1022. {-0x1.921fb6p+1, 0x1.620226p-5, -0x1.e9dfdep-1},
  1023. {-0x1.921fb6p+0, 0x1.a9bcc4p-3, -0x1.9590d0p-1},
  1024. };
  1025. MATH_POWER_FLOAT TestPowerFloats[] = {
  1026. {0x1.f40000p+9,
  1027. 0x0.000000p+0,
  1028. 0x1.000000p+0,
  1029. 0x1.f40000p+9},
  1030. {INFINITY,
  1031. 0x0.000000p+0,
  1032. 0x1.000000p+0,
  1033. INFINITY},
  1034. {INFINITY,
  1035. 0x1.000000p+0,
  1036. INFINITY,
  1037. INFINITY},
  1038. {0x1.000000p+2,
  1039. NAN,
  1040. NAN,
  1041. NAN},
  1042. {NAN,
  1043. 0x1.800000p+1,
  1044. NAN,
  1045. NAN},
  1046. {NAN,
  1047. 0x0.000000p+0,
  1048. 0x1.000000p+0,
  1049. NAN},
  1050. {0x1.000000p+1,
  1051. INFINITY,
  1052. INFINITY,
  1053. INFINITY},
  1054. {0x1.000000p+1,
  1055. -INFINITY,
  1056. 0x0.000000p+0,
  1057. INFINITY},
  1058. {0x1.000000p-1,
  1059. INFINITY,
  1060. 0x0.000000p+0,
  1061. INFINITY},
  1062. {0x1.000000p-1,
  1063. -INFINITY,
  1064. INFINITY,
  1065. INFINITY},
  1066. {0x0.000000p+0,
  1067. 0x1.400000p+5,
  1068. 0x0.000000p+0,
  1069. 0x1.400000p+5},
  1070. {-0x0.000000p+0,
  1071. 0x1.400000p+5,
  1072. 0x0.000000p+0,
  1073. 0x1.400000p+5},
  1074. {0x0.000000p+0,
  1075. -0x1.400000p+5,
  1076. INFINITY,
  1077. 0x1.400000p+5},
  1078. {-0x0.000000p+0,
  1079. -0x1.400000p+5,
  1080. INFINITY,
  1081. 0x1.400000p+5},
  1082. {-0x0.000000p+0,
  1083. -0x1.800000p+1,
  1084. -INFINITY,
  1085. 0x1.800000p+1},
  1086. {INFINITY,
  1087. 0x1.388000p+12,
  1088. INFINITY,
  1089. INFINITY},
  1090. {INFINITY,
  1091. 0x1.800000p+1,
  1092. INFINITY,
  1093. INFINITY},
  1094. {-INFINITY,
  1095. 0x1.000000p+2,
  1096. INFINITY,
  1097. INFINITY},
  1098. {-INFINITY,
  1099. -0x1.400000p+2,
  1100. -0x0.000000p+0,
  1101. INFINITY},
  1102. {-0x1.90ccccp+6,
  1103. 0x1.800000p+2,
  1104. 0x1.d746f4p+39,
  1105. 0x1.918496p+6},
  1106. {-0x1.8f0312p+5,
  1107. 0x1.833334p+3,
  1108. -NAN,
  1109. 0x1.9a9600p+5},
  1110. {-0x1.6b851ep+5,
  1111. -0x1.99999ap-4,
  1112. -NAN,
  1113. 0x1.6b8558p+5},
  1114. {0x1.5957aep+8,
  1115. -0x1.333334p-2,
  1116. 0x1.62b1e4p-3,
  1117. 0x1.5957b6p+8},
  1118. {0x1.e00000p+4,
  1119. 0x1.800000p+2,
  1120. 0x1.5b9d42p+29,
  1121. 0x1.e98180p+4},
  1122. {0x1.000054p+1,
  1123. 0x1.638e36p+2,
  1124. 0x1.784328p+5,
  1125. 0x1.79e4dep+2},
  1126. {INFINITY,
  1127. 0x1.333334p-1,
  1128. INFINITY,
  1129. INFINITY},
  1130. {0x1.59fe00p+16,
  1131. 0x1.000000p-1,
  1132. 0x1.299d24p+8,
  1133. 0x1.59fe00p+16},
  1134. {0x1.340000p+6,
  1135. 0x1.000000p+1,
  1136. 0x1.729000p+12,
  1137. 0x1.341a98p+6},
  1138. {-0x1.d40000p+7,
  1139. 0x1.800000p+1,
  1140. -0x1.8704d0p+23,
  1141. 0x1.d409d8p+7},
  1142. {-0x1.200000p+3,
  1143. 0x1.000000p+2,
  1144. 0x1.9a1000p+12,
  1145. 0x1.3b29d8p+3},
  1146. {0x1.13d73cp-99,
  1147. 0x1.99999ap-4,
  1148. 0x1.146e04p-10,
  1149. 0x1.99999ap-4},
  1150. {0x1.c8571cp-20,
  1151. 0x1.c00000p+2,
  1152. 0x1.c98c00p-135,
  1153. 0x1.c00000p+2},
  1154. };
  1155. MATH_LOGARITHM_FLOAT TestLogarithmFloats[] = {
  1156. {0x1.921fb6p-1,
  1157. -0x1.eeb958p-3,
  1158. -0x1.64de30p-2,
  1159. -0x1.adb63ap-4},
  1160. {0x1.921fb6p+1,
  1161. 0x1.250d04p+0,
  1162. 0x1.a6c874p+0,
  1163. 0x1.fd14dcp-2},
  1164. {0x1.f6a7a2p+1,
  1165. 0x1.5e2cf4p+0,
  1166. 0x1.f93254p+0,
  1167. 0x1.3028a0p-1},
  1168. {0x1.921fb6p+2,
  1169. 0x1.d67f1cp+0,
  1170. 0x1.53643ap+1,
  1171. 0x1.98ab08p-1},
  1172. {0x1.f6a7a2p+1,
  1173. 0x1.5e2cf4p+0,
  1174. 0x1.f93254p+0,
  1175. 0x1.3028a0p-1},
  1176. {0x1.5fdbbep+2,
  1177. 0x1.b45000p+0,
  1178. 0x1.3abba2p+1,
  1179. 0x1.7af9e8p-1},
  1180. {0x1.000000p-3,
  1181. -0x1.0a2b24p+1,
  1182. -0x1.800000p+1,
  1183. -0x1.ce61d0p-1},
  1184. {0x1.945b6cp-7,
  1185. -0x1.194632p+2,
  1186. -0x1.95cafap+2,
  1187. -0x1.e89f92p+0},
  1188. {0x1.c560c8p-9,
  1189. -0x1.6aac74p+2,
  1190. -0x1.059d1ep+3,
  1191. -0x1.3b03aap+1},
  1192. {0x1.ba35f2p-11,
  1193. -0x1.c4fe1ep+2,
  1194. -0x1.46c3dep+3,
  1195. -0x1.8976e4p+1},
  1196. {0x1.400000p+3,
  1197. 0x1.26bb1cp+1,
  1198. 0x1.a934f0p+1,
  1199. 0x1.000000p+0},
  1200. {0x1.900000p+6,
  1201. 0x1.26bb1cp+2,
  1202. 0x1.a934f0p+2,
  1203. 0x1.000000p+1},
  1204. {0x1.f40000p+9,
  1205. 0x1.ba18aap+2,
  1206. 0x1.3ee7b4p+3,
  1207. 0x1.800000p+1},
  1208. {0x1.86a000p+16,
  1209. 0x1.7069e2p+3,
  1210. 0x1.09c116p+4,
  1211. 0x1.400000p+2},
  1212. {0x1.24f800p+18,
  1213. 0x1.9391b8p+3,
  1214. 0x1.231d18p+4,
  1215. 0x1.5e8928p+2},
  1216. {0x1.2a05f2p+33,
  1217. 0x1.7069e2p+4,
  1218. 0x1.09c116p+5,
  1219. 0x1.400000p+3},
  1220. {0x1.c6bf52p+49,
  1221. 0x1.144f6ap+5,
  1222. 0x1.8ea1a2p+5,
  1223. 0x1.e00000p+3},
  1224. {0x1.5af1d8p+66,
  1225. 0x1.7069e2p+5,
  1226. 0x1.09c116p+6,
  1227. 0x1.400000p+4},
  1228. {0x1.08b2a2p+83,
  1229. 0x1.cc845cp+5,
  1230. 0x1.4c315cp+6,
  1231. 0x1.900000p+4},
  1232. {0x1.93e594p+99,
  1233. 0x1.144f6ap+6,
  1234. 0x1.8ea1a2p+6,
  1235. 0x1.e00000p+4},
  1236. {0x1.342618p+116,
  1237. 0x1.425ca6p+6,
  1238. 0x1.d111e8p+6,
  1239. 0x1.180000p+5},
  1240. {0x1.4f8b58p-17,
  1241. -0x1.7069e2p+3,
  1242. -0x1.09c116p+4,
  1243. -0x1.400000p+2},
  1244. {0x1.b7cdfep-34,
  1245. -0x1.7069e2p+4,
  1246. -0x1.09c116p+5,
  1247. -0x1.400000p+3},
  1248. {0x1.203afap-50,
  1249. -0x1.144f6ap+5,
  1250. -0x1.8ea1a2p+5,
  1251. -0x1.e00000p+3},
  1252. {0x1.79ca10p-67,
  1253. -0x1.7069e2p+5,
  1254. -0x1.09c116p+6,
  1255. -0x1.400000p+4},
  1256. {0x1.cdef9ep+34,
  1257. 0x1.82841cp+4,
  1258. 0x1.16cffap+5,
  1259. 0x1.4fb93cp+3},
  1260. {0x1.6bcc42p+51,
  1261. 0x1.1d9d8cp+5,
  1262. 0x1.9c0e52p+5,
  1263. 0x1.f02a30p+3},
  1264. {0x1.1e3ab8p+68,
  1265. 0x1.79f70ap+5,
  1266. 0x1.10a4e4p+6,
  1267. 0x1.484bd6p+4},
  1268. {0x1.c1fc7cp+84,
  1269. 0x1.d64ea6p+5,
  1270. 0x1.534144p+6,
  1271. 0x1.9880f0p+4},
  1272. {0x1.6168e2p+101,
  1273. 0x1.19523ep+6,
  1274. 0x1.95dc5cp+6,
  1275. 0x1.e8b480p+4},
  1276. {0x1.15557cp+118,
  1277. 0x1.477c54p+6,
  1278. 0x1.d87640p+6,
  1279. 0x1.1c734ep+5},
  1280. {0x1.000000p+0,
  1281. 0x0.000000p+0,
  1282. 0x0.000000p+0,
  1283. 0x0.000000p+0},
  1284. {0x1.000000p+1,
  1285. 0x1.62e430p-1,
  1286. 0x1.000000p+0,
  1287. 0x1.344136p-2},
  1288. {0x1.800000p+1,
  1289. 0x1.193ea8p+0,
  1290. 0x1.95c01ap+0,
  1291. 0x1.e89278p-2},
  1292. {0x1.22ad96p+27,
  1293. 0x1.2d78e2p+4,
  1294. 0x1.b2eeb6p+4,
  1295. 0x1.05dafep+3},
  1296. {0x1.900000p+4,
  1297. 0x1.9c0420p+1,
  1298. 0x1.2934f0p+2,
  1299. 0x1.65df66p+0},
  1300. {0x1.fae148p-1,
  1301. -0x1.495440p-7,
  1302. -0x1.db1f18p-7,
  1303. -0x1.1e0d38p-8},
  1304. {-0x1.000000p+0,
  1305. -INFINITY,
  1306. -INFINITY,
  1307. -INFINITY},
  1308. {INFINITY,
  1309. INFINITY,
  1310. INFINITY,
  1311. INFINITY},
  1312. {-INFINITY,
  1313. -INFINITY,
  1314. -INFINITY,
  1315. -INFINITY},
  1316. {NAN,
  1317. NAN,
  1318. NAN,
  1319. NAN},
  1320. };
  1321. MATH_DECOMPOSITION_FLOAT TestDecompositionFloats[] = {
  1322. {0x1.921fb6p-1, 0x0.000000p+0, 0x1.921fb6p-1},
  1323. {0x1.921fb6p+1, 0x1.800000p+1, 0x1.21fb60p-3},
  1324. {0x1.f6a7a2p+1, 0x1.800000p+1, 0x1.da9e88p-1},
  1325. {0x1.921fb6p+2, 0x1.800000p+2, 0x1.21fb60p-2},
  1326. {0x1.f6a7a2p+1, 0x1.800000p+1, 0x1.da9e88p-1},
  1327. {0x1.5fdbbep+2, 0x1.400000p+2, 0x1.fdbbe0p-2},
  1328. {0x1.000000p-3, 0x0.000000p+0, 0x1.000000p-3},
  1329. {0x1.945b6cp-7, 0x0.000000p+0, 0x1.945b6cp-7},
  1330. {0x1.c560c8p-9, 0x0.000000p+0, 0x1.c560c8p-9},
  1331. {0x1.ba35f2p-11, 0x0.000000p+0, 0x1.ba35f2p-11},
  1332. {0x1.400000p+3, 0x1.400000p+3, 0x0.000000p+0},
  1333. {0x1.24f800p+18, 0x1.24f800p+18, 0x0.000000p+0},
  1334. {0x1.4f8b58p-17, 0x0.000000p+0, 0x1.4f8b58p-17},
  1335. {0x1.b7cdfep-34, 0x0.000000p+0, 0x1.b7cdfep-34},
  1336. {0x1.203afap-50, 0x0.000000p+0, 0x1.203afap-50},
  1337. {0x1.79ca10p-67, 0x0.000000p+0, 0x1.79ca10p-67},
  1338. {0x1.cdef9ep+34, 0x1.cdef9ep+34, 0x0.000000p+0},
  1339. {0x1.6bcc42p+51, 0x1.6bcc42p+51, 0x0.000000p+0},
  1340. {0x1.1e3ab8p+68, 0x1.1e3ab8p+68, 0x0.000000p+0},
  1341. {0x1.c1fc7cp+84, 0x1.c1fc7cp+84, 0x0.000000p+0},
  1342. {0x1.6168e2p+101, 0x1.6168e2p+101, 0x0.000000p+0},
  1343. {0x1.15557cp+118, 0x1.15557cp+118, 0x0.000000p+0},
  1344. {INFINITY, INFINITY, 0x0.000000p+0},
  1345. {INFINITY, INFINITY, 0x0.000000p+0},
  1346. {INFINITY, INFINITY, 0x0.000000p+0},
  1347. {INFINITY, INFINITY, 0x0.000000p+0},
  1348. {INFINITY, INFINITY, 0x0.000000p+0},
  1349. {0x1.000000p+0, 0x1.000000p+0, 0x0.000000p+0},
  1350. {0x1.000000p+1, 0x1.000000p+1, 0x0.000000p+0},
  1351. {0x1.800000p+1, 0x1.800000p+1, 0x0.000000p+0},
  1352. {0x1.22ad96p+27, 0x1.22ad96p+27, 0x0.000000p+0},
  1353. {0x1.900000p+4, 0x1.900000p+4, 0x0.000000p+0},
  1354. {0x1.fae148p-1, 0x0.000000p+0, 0x1.fae148p-1},
  1355. {-0x1.000000p+0, -0x1.000000p+0, -0x0.000000p+0},
  1356. {-0x1.99999ap-4, -0x0.000000p+0, -0x1.99999ap-4},
  1357. {-0x1.0bb448p+70, -0x1.0bb448p+70, -0x0.000000p+0},
  1358. {0x1.fe9af6p+89, 0x1.fe9af6p+89, 0x0.000000p+0},
  1359. {0x1.122110p+60, 0x1.122110p+60, 0x0.000000p+0},
  1360. {0x1.7c6e3cp+116, 0x1.7c6e3cp+116, 0x0.000000p+0},
  1361. {0x1.b1ae4ep+69, 0x1.b1ae4ep+69, 0x0.000000p+0},
  1362. {0x1.9d971ep+89, 0x1.9d971ep+89, 0x0.000000p+0},
  1363. {0x1.342618p+116, 0x1.342618p+116, 0x0.000000p+0},
  1364. {INFINITY, INFINITY, 0x0.000000p+0},
  1365. {-INFINITY, -INFINITY, -0x0.000000p+0},
  1366. {NAN, NAN, NAN},
  1367. };
  1368. MATH_CEILING_FLOOR_FLOAT_VALUE TestCeilingFloorFloats[] = {
  1369. {-0x1.100000p+5,
  1370. -0x1.100000p+5,
  1371. -0x1.100000p+5},
  1372. {-0x1.05999ap+5,
  1373. -0x1.000000p+5,
  1374. -0x1.080000p+5},
  1375. {-0x1.f66666p+4,
  1376. -0x1.f00000p+4,
  1377. -0x1.000000p+5},
  1378. {-0x1.e1999ap+4,
  1379. -0x1.e00000p+4,
  1380. -0x1.f00000p+4},
  1381. {-0x1.ccccccp+4,
  1382. -0x1.c00000p+4,
  1383. -0x1.d00000p+4},
  1384. {-0x1.b80000p+4,
  1385. -0x1.b00000p+4,
  1386. -0x1.c00000p+4},
  1387. {-0x1.a33334p+4,
  1388. -0x1.a00000p+4,
  1389. -0x1.b00000p+4},
  1390. {-0x1.8e6666p+4,
  1391. -0x1.800000p+4,
  1392. -0x1.900000p+4},
  1393. {-0x1.79999ap+4,
  1394. -0x1.700000p+4,
  1395. -0x1.800000p+4},
  1396. {-0x1.64ccccp+4,
  1397. -0x1.600000p+4,
  1398. -0x1.700000p+4},
  1399. {-0x1.500000p+4,
  1400. -0x1.500000p+4,
  1401. -0x1.500000p+4},
  1402. {-0x1.3b3334p+4,
  1403. -0x1.300000p+4,
  1404. -0x1.400000p+4},
  1405. {-0x1.266666p+4,
  1406. -0x1.200000p+4,
  1407. -0x1.300000p+4},
  1408. {-0x1.11999ap+4,
  1409. -0x1.100000p+4,
  1410. -0x1.200000p+4},
  1411. {-0x1.f9999ap+3,
  1412. -0x1.e00000p+3,
  1413. -0x1.000000p+4},
  1414. {-0x1.d00000p+3,
  1415. -0x1.c00000p+3,
  1416. -0x1.e00000p+3},
  1417. {-0x1.a66666p+3,
  1418. -0x1.a00000p+3,
  1419. -0x1.c00000p+3},
  1420. {-0x1.7cccccp+3,
  1421. -0x1.600000p+3,
  1422. -0x1.800000p+3},
  1423. {-0x1.533334p+3,
  1424. -0x1.400000p+3,
  1425. -0x1.600000p+3},
  1426. {-0x1.29999ap+3,
  1427. -0x1.200000p+3,
  1428. -0x1.400000p+3},
  1429. {-0x1.000000p+3,
  1430. -0x1.000000p+3,
  1431. -0x1.000000p+3},
  1432. {-0x1.acccccp+2,
  1433. -0x1.800000p+2,
  1434. -0x1.c00000p+2},
  1435. {-0x1.59999ap+2,
  1436. -0x1.400000p+2,
  1437. -0x1.800000p+2},
  1438. {-0x1.066666p+2,
  1439. -0x1.000000p+2,
  1440. -0x1.400000p+2},
  1441. {-0x1.666666p+1,
  1442. -0x1.000000p+1,
  1443. -0x1.800000p+1},
  1444. {-0x1.800000p+0,
  1445. -0x1.000000p+0,
  1446. -0x1.000000p+1},
  1447. {-0x1.99999ap-3,
  1448. -0x0.000000p+0,
  1449. -0x1.000000p+0},
  1450. {0x1.19999ap+0,
  1451. 0x1.000000p+1,
  1452. 0x1.000000p+0},
  1453. {0x1.333334p+1,
  1454. 0x1.800000p+1,
  1455. 0x1.000000p+1},
  1456. {0x1.d9999ap+1,
  1457. 0x1.000000p+2,
  1458. 0x1.800000p+1},
  1459. {0x1.400000p+2,
  1460. 0x1.400000p+2,
  1461. 0x1.400000p+2},
  1462. {0x1.933334p+2,
  1463. 0x1.c00000p+2,
  1464. 0x1.800000p+2},
  1465. {0x1.e66666p+2,
  1466. 0x1.000000p+3,
  1467. 0x1.c00000p+2},
  1468. {0x1.1cccccp+3,
  1469. 0x1.200000p+3,
  1470. 0x1.000000p+3},
  1471. {0x1.466666p+3,
  1472. 0x1.600000p+3,
  1473. 0x1.400000p+3},
  1474. {0x1.700000p+3,
  1475. 0x1.800000p+3,
  1476. 0x1.600000p+3},
  1477. {0x1.99999ap+3,
  1478. 0x1.a00000p+3,
  1479. 0x1.800000p+3},
  1480. {0x1.c33334p+3,
  1481. 0x1.e00000p+3,
  1482. 0x1.c00000p+3},
  1483. {0x1.ecccccp+3,
  1484. 0x1.000000p+4,
  1485. 0x1.e00000p+3},
  1486. {0x1.0b3334p+4,
  1487. 0x1.100000p+4,
  1488. 0x1.000000p+4},
  1489. {0x1.200000p+4,
  1490. 0x1.200000p+4,
  1491. 0x1.200000p+4},
  1492. {0x1.34ccccp+4,
  1493. 0x1.400000p+4,
  1494. 0x1.300000p+4},
  1495. {0x1.49999ap+4,
  1496. 0x1.500000p+4,
  1497. 0x1.400000p+4},
  1498. {0x1.5e6666p+4,
  1499. 0x1.600000p+4,
  1500. 0x1.500000p+4},
  1501. {0x1.733334p+4,
  1502. 0x1.800000p+4,
  1503. 0x1.700000p+4},
  1504. {0x1.880000p+4,
  1505. 0x1.900000p+4,
  1506. 0x1.800000p+4},
  1507. {0x1.9cccccp+4,
  1508. 0x1.a00000p+4,
  1509. 0x1.900000p+4},
  1510. {0x1.b1999ap+4,
  1511. 0x1.c00000p+4,
  1512. 0x1.b00000p+4},
  1513. {0x1.c66666p+4,
  1514. 0x1.d00000p+4,
  1515. 0x1.c00000p+4},
  1516. {0x1.db3334p+4,
  1517. 0x1.e00000p+4,
  1518. 0x1.d00000p+4},
  1519. {0x1.f00000p+4,
  1520. 0x1.f00000p+4,
  1521. 0x1.f00000p+4},
  1522. {0x1.026666p+5,
  1523. 0x1.080000p+5,
  1524. 0x1.000000p+5},
  1525. {0x1.0cccccp+5,
  1526. 0x1.100000p+5,
  1527. 0x1.080000p+5},
  1528. };
  1529. MATH_MODULO_FLOAT_VALUE TestModuloFloats[] = {
  1530. {0x0.000000p+0,
  1531. -0x0.000000p+0,
  1532. -INFINITY},
  1533. {0x0.000000p+0,
  1534. -0x1.000000p+0,
  1535. 0x0.000000p+0},
  1536. {-0x0.000000p+0,
  1537. -0x1.000000p+0,
  1538. -0x0.000000p+0},
  1539. {0x1.19999ap+0,
  1540. 0x1.842274p-114,
  1541. 0x1.5c3558p-115},
  1542. {-0x1.880000p+6,
  1543. 0x1.8c0000p+6,
  1544. -0x1.880000p+6},
  1545. {0x1.900000p+6,
  1546. 0x1.400000p+3,
  1547. 0x0.000000p+0},
  1548. {0x1.400000p+3,
  1549. 0x1.99999ap-4,
  1550. 0x1.999972p-4},
  1551. {0x1.9d3f42p+110,
  1552. -0x1.151b07p+120,
  1553. 0x1.9d3f42p+110},
  1554. {0x1.151b07p+120,
  1555. 0x1.000000p+2,
  1556. 0x0.000000p+0},
  1557. {0x1.0624dep-10,
  1558. 0x1.0624dep-10,
  1559. 0x0.000000p+0},
  1560. {0x1.800000p+2,
  1561. 0x1.000000p+1,
  1562. 0x0.000000p+0},
  1563. {-0x1.921fb6p+1,
  1564. -0x1.000000p+1,
  1565. -0x1.243f6ap+0},
  1566. {INFINITY,
  1567. -INFINITY,
  1568. -INFINITY},
  1569. {NAN,
  1570. INFINITY,
  1571. NAN},
  1572. {NAN,
  1573. NAN,
  1574. NAN},
  1575. {INFINITY,
  1576. NAN,
  1577. NAN},
  1578. };
  1579. //
  1580. // ------------------------------------------------------------------ Functions
  1581. //
  1582. ULONG
  1583. TestMathFloat (
  1584. VOID
  1585. )
  1586. /*++
  1587. Routine Description:
  1588. This routine implements the entry point for the C library single-precision
  1589. floating point math test.
  1590. Arguments:
  1591. None.
  1592. Return Value:
  1593. Returns the count of test failures.
  1594. --*/
  1595. {
  1596. ULONG Failures;
  1597. Failures = 0;
  1598. Failures += TestBasicTrigonometryFloat();
  1599. Failures += TestSquareRootFloat();
  1600. Failures += TestArcTrigonometryFloat();
  1601. Failures += TestExponentiationFloat();
  1602. Failures += TestPowerFloat();
  1603. Failures += TestLogarithmFloat();
  1604. Failures += TestDecompositionFloat();
  1605. Failures += TestCeilingAndFloorFloat();
  1606. Failures += TestModuloFloat();
  1607. return Failures;
  1608. }
  1609. //
  1610. // --------------------------------------------------------- Internal Functions
  1611. //
  1612. ULONG
  1613. TestBasicTrigonometryFloat (
  1614. VOID
  1615. )
  1616. /*++
  1617. Routine Description:
  1618. This routine test the basic trig routines: sine, cosine, and tangent.
  1619. Arguments:
  1620. None.
  1621. Return Value:
  1622. Returns the count of test failures.
  1623. --*/
  1624. {
  1625. volatile float Cosine;
  1626. ULONG Failures;
  1627. volatile float HyperbolicCosine;
  1628. volatile float HyperbolicSine;
  1629. volatile float HyperbolicTangent;
  1630. volatile float Sine;
  1631. volatile float Tangent;
  1632. PMATH_TRIG_FLOAT_VALUE Test;
  1633. ULONG TestIndex;
  1634. ULONG ValueCount;
  1635. Failures = 0;
  1636. ValueCount = sizeof(TestBasicTrigonometryFloats) /
  1637. sizeof(TestBasicTrigonometryFloats[0]);
  1638. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1639. Test = &(TestBasicTrigonometryFloats[TestIndex]);
  1640. Sine = sinf(Test->Argument);
  1641. Cosine = cosf(Test->Argument);
  1642. if (TestCompareResultsFloat(Sine, Test->Sine) == FALSE) {
  1643. printf("sinf(%.6a) was %.6a, should have been %.6a. "
  1644. "Diff %.6a\n",
  1645. Test->Argument,
  1646. Sine,
  1647. Test->Sine,
  1648. Sine - Test->Sine);
  1649. Failures += 1;
  1650. }
  1651. if (TestCompareResultsFloat(Cosine, Test->Cosine) == FALSE) {
  1652. printf("cosf(%.6a) was %.6a, should have been %.6a.\n",
  1653. Test->Argument,
  1654. Cosine,
  1655. Test->Cosine);
  1656. Failures += 1;
  1657. }
  1658. Tangent = tanf(Test->Argument);
  1659. if (TestCompareResultsFloat(Tangent, Test->Tangent) == FALSE) {
  1660. printf("tanf(%.6a) was %.6a, should have been %.6a.\n",
  1661. Test->Argument,
  1662. Tangent,
  1663. Test->Tangent);
  1664. Failures += 1;
  1665. }
  1666. HyperbolicSine = sinhf(Test->Argument);
  1667. HyperbolicCosine = coshf(Test->Argument);
  1668. HyperbolicTangent = tanhf(Test->Argument);
  1669. if (TestCompareResultsFloat(HyperbolicSine,
  1670. Test->HyperbolicSine) == FALSE) {
  1671. printf("sinhf(%.6a) was %.6a, should have been %.6a. "
  1672. "Diff %.6a\n",
  1673. Test->Argument,
  1674. HyperbolicSine,
  1675. Test->HyperbolicSine,
  1676. HyperbolicSine - Test->HyperbolicSine);
  1677. Failures += 1;
  1678. }
  1679. if (TestCompareResultsFloat(HyperbolicCosine,
  1680. Test->HyperbolicCosine) == FALSE) {
  1681. printf("coshf(%.6a) was %.6a, should have been %.6a.\n",
  1682. Test->Argument,
  1683. HyperbolicCosine,
  1684. Test->HyperbolicCosine);
  1685. Failures += 1;
  1686. }
  1687. if (TestCompareResultsFloat(HyperbolicTangent,
  1688. Test->HyperbolicTangent) == FALSE) {
  1689. printf("tanhf(%.6a) was %.6a, should have been %.6a.\n",
  1690. Test->Argument,
  1691. HyperbolicTangent,
  1692. Test->HyperbolicTangent);
  1693. Failures += 1;
  1694. }
  1695. }
  1696. return Failures;
  1697. }
  1698. ULONG
  1699. TestSquareRootFloat (
  1700. VOID
  1701. )
  1702. /*++
  1703. Routine Description:
  1704. This routine test the square root function.
  1705. Arguments:
  1706. None.
  1707. Return Value:
  1708. Returns the count of test failures.
  1709. --*/
  1710. {
  1711. ULONG Failures;
  1712. volatile float SquareRoot;
  1713. PMATH_TEST_SQUARE_ROOT_FLOAT_VALUE Test;
  1714. ULONG TestIndex;
  1715. ULONG ValueCount;
  1716. Failures = 0;
  1717. ValueCount = sizeof(TestSquareRootFloats) /
  1718. sizeof(TestSquareRootFloats[0]);
  1719. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1720. Test = &(TestSquareRootFloats[TestIndex]);
  1721. SquareRoot = sqrtf(Test->Argument);
  1722. if (TestCompareResultsFloat(SquareRoot, Test->SquareRoot) == FALSE) {
  1723. printf("sqrt(%.6a) was %.6a, should have been %.6a.\n",
  1724. Test->Argument,
  1725. SquareRoot,
  1726. Test->SquareRoot);
  1727. Failures += 1;
  1728. }
  1729. }
  1730. return Failures;
  1731. }
  1732. ULONG
  1733. TestArcTrigonometryFloat (
  1734. VOID
  1735. )
  1736. /*++
  1737. Routine Description:
  1738. This routine test the inverse trig routines: arc sine, arc cosine, and
  1739. arc tangent.
  1740. Arguments:
  1741. None.
  1742. Return Value:
  1743. Returns the count of test failures.
  1744. --*/
  1745. {
  1746. volatile float ArcCosine;
  1747. volatile float ArcSine;
  1748. volatile float ArcTangent;
  1749. PMATH_ARC_TANGENT_FLOAT ArcTangentTest;
  1750. ULONG Failures;
  1751. float Quotient;
  1752. PMATH_ARC_FLOAT_VALUE Test;
  1753. ULONG TestIndex;
  1754. ULONG ValueCount;
  1755. Failures = 0;
  1756. ValueCount = sizeof(TestArcFloats) / sizeof(TestArcFloats[0]);
  1757. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1758. Test = &(TestArcFloats[TestIndex]);
  1759. ArcSine = asinf(Test->Argument);
  1760. if (TestCompareResultsFloat(ArcSine, Test->ArcSine) == FALSE) {
  1761. printf("asinf(%.6a) was %.6a, should have been %.6a.\n",
  1762. Test->Argument,
  1763. ArcSine,
  1764. Test->ArcSine);
  1765. Failures += 1;
  1766. }
  1767. ArcCosine = acosf(Test->Argument);
  1768. if (TestCompareResultsFloat(ArcCosine, Test->ArcCosine) == FALSE) {
  1769. printf("acosf(%.6a) was %.6a, should have been %.6a.\n",
  1770. Test->Argument,
  1771. ArcCosine,
  1772. Test->ArcCosine);
  1773. Failures += 1;
  1774. }
  1775. ArcTangent = atanf(Test->Argument);
  1776. if (TestCompareResultsFloat(ArcTangent, Test->ArcTangent) == FALSE) {
  1777. printf("atanf(%.6a) was %.6a, should have been %.6a.\n",
  1778. Test->Argument,
  1779. ArcTangent,
  1780. Test->ArcTangent);
  1781. Failures += 1;
  1782. }
  1783. }
  1784. //
  1785. // Test arc tangent 2.
  1786. //
  1787. ValueCount = sizeof(TestArcTangentFloats) / sizeof(TestArcTangentFloats[0]);
  1788. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1789. ArcTangentTest = &(TestArcTangentFloats[TestIndex]);
  1790. Quotient = ArcTangentTest->Numerator /
  1791. ArcTangentTest->Denominator;
  1792. ArcTangent = atanf(Quotient);
  1793. if (TestCompareResultsFloat(ArcTangent,
  1794. ArcTangentTest->ArcTangent) == FALSE) {
  1795. printf("atanf(%.6a) was %.6a, should have been %.6a.\n",
  1796. Quotient,
  1797. ArcTangent,
  1798. ArcTangentTest->ArcTangent);
  1799. Failures += 1;
  1800. }
  1801. ArcTangent = atan2f(ArcTangentTest->Numerator,
  1802. ArcTangentTest->Denominator);
  1803. if (TestCompareResultsFloat(ArcTangent,
  1804. ArcTangentTest->ArcTangent2) == FALSE) {
  1805. printf("atan2f(%.6a, %.6a) was %.6a, should have been %.6a.\n",
  1806. ArcTangentTest->Numerator,
  1807. ArcTangentTest->Denominator,
  1808. ArcTangent,
  1809. ArcTangentTest->ArcTangent2);
  1810. Failures += 1;
  1811. }
  1812. }
  1813. return Failures;
  1814. }
  1815. ULONG
  1816. TestExponentiationFloat (
  1817. VOID
  1818. )
  1819. /*++
  1820. Routine Description:
  1821. This routine test the exponentiation (exp) function.
  1822. Arguments:
  1823. None.
  1824. Return Value:
  1825. Returns the count of test failures.
  1826. --*/
  1827. {
  1828. BOOL Equal;
  1829. volatile float Exponentiation;
  1830. volatile float ExponentiationMinusOne;
  1831. ULONG Failures;
  1832. PMATH_EXP_FLOAT Test;
  1833. ULONG TestIndex;
  1834. ULONG ValueCount;
  1835. Failures = 0;
  1836. ValueCount = sizeof(TestExpFloats) / sizeof(TestExpFloats[0]);
  1837. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1838. Test = &(TestExpFloats[TestIndex]);
  1839. Exponentiation = expf(Test->Argument);
  1840. if (TestCompareResultsFloat(Exponentiation,
  1841. Test->Exponentiation) == FALSE) {
  1842. printf("expf(%.6a) was %.6a, should have been %.6a.\n",
  1843. Test->Argument,
  1844. Exponentiation,
  1845. Test->Exponentiation);
  1846. Failures += 1;
  1847. }
  1848. ExponentiationMinusOne = expm1f(Test->Argument);
  1849. Equal = TestCompareResultsFloat(ExponentiationMinusOne,
  1850. Test->ExponentiationMinusOne);
  1851. if (Equal == FALSE) {
  1852. printf("expm1f(%.6a) was %.6a, should have been %.6a.\n",
  1853. Test->Argument,
  1854. ExponentiationMinusOne,
  1855. Test->ExponentiationMinusOne);
  1856. Failures += 1;
  1857. }
  1858. }
  1859. return Failures;
  1860. }
  1861. ULONG
  1862. TestPowerFloat (
  1863. VOID
  1864. )
  1865. /*++
  1866. Routine Description:
  1867. This routine test the power (pow) function.
  1868. Arguments:
  1869. None.
  1870. Return Value:
  1871. Returns the count of test failures.
  1872. --*/
  1873. {
  1874. ULONG Failures;
  1875. volatile float Hypotenuse;
  1876. volatile float RaisedValue;
  1877. PMATH_POWER_FLOAT Test;
  1878. ULONG TestIndex;
  1879. ULONG ValueCount;
  1880. Failures = 0;
  1881. ValueCount = sizeof(TestPowerFloats) / sizeof(TestPowerFloats[0]);
  1882. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1883. Test = &(TestPowerFloats[TestIndex]);
  1884. RaisedValue = powf(Test->Value, Test->Exponent);
  1885. Hypotenuse = hypotf(Test->Value, Test->Exponent);
  1886. if (TestCompareResultsFloat(RaisedValue, Test->Result) == FALSE) {
  1887. printf("powf(%.6a, %.6a) was %.6a, should have been %.6a.\n",
  1888. Test->Value,
  1889. Test->Exponent,
  1890. RaisedValue,
  1891. Test->Result);
  1892. Failures += 1;
  1893. }
  1894. if (TestCompareResultsFloat(Hypotenuse, Test->Hypotenuse) == FALSE) {
  1895. printf("hypotf(%.6a, %.6a) was %.6a, should have been %.6a.\n",
  1896. Test->Value,
  1897. Test->Exponent,
  1898. Hypotenuse,
  1899. Test->Hypotenuse);
  1900. Failures += 1;
  1901. }
  1902. }
  1903. return Failures;
  1904. }
  1905. ULONG
  1906. TestLogarithmFloat (
  1907. VOID
  1908. )
  1909. /*++
  1910. Routine Description:
  1911. This routine test the logarithm (log) function.
  1912. Arguments:
  1913. None.
  1914. Return Value:
  1915. Returns the count of test failures.
  1916. --*/
  1917. {
  1918. ULONG Failures;
  1919. volatile float Logarithm;
  1920. PMATH_LOGARITHM_FLOAT Test;
  1921. ULONG TestIndex;
  1922. ULONG ValueCount;
  1923. Failures = 0;
  1924. ValueCount = sizeof(TestLogarithmFloats) / sizeof(TestLogarithmFloats[0]);
  1925. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1926. Test = &(TestLogarithmFloats[TestIndex]);
  1927. Logarithm = logf(Test->Argument);
  1928. if (TestCompareResultsFloat(Logarithm, Test->Logarithm) == FALSE) {
  1929. printf("logf(%.6a) was %.6a, should have been %.6a.\n",
  1930. Test->Argument,
  1931. Logarithm,
  1932. Test->Logarithm);
  1933. Failures += 1;
  1934. }
  1935. Logarithm = log2f(Test->Argument);
  1936. if (TestCompareResultsFloat(Logarithm, Test->Log2) == FALSE) {
  1937. printf("log2f(%.6a) was %.6a, should have been %.6a.\n",
  1938. Test->Argument,
  1939. Logarithm,
  1940. Test->Log2);
  1941. Failures += 1;
  1942. }
  1943. Logarithm = log10f(Test->Argument);
  1944. if (TestCompareResultsFloat(Logarithm, Test->Log10) == FALSE) {
  1945. printf("log10f(%.6a) was %.6a, should have been %.6a.\n",
  1946. Test->Argument,
  1947. Logarithm,
  1948. Test->Log10);
  1949. Failures += 1;
  1950. }
  1951. }
  1952. return Failures;
  1953. }
  1954. ULONG
  1955. TestDecompositionFloat (
  1956. VOID
  1957. )
  1958. /*++
  1959. Routine Description:
  1960. This routine test the logarithm (log) function.
  1961. Arguments:
  1962. None.
  1963. Return Value:
  1964. Returns the count of test failures.
  1965. --*/
  1966. {
  1967. ULONG Failures;
  1968. BOOL FractionEqual;
  1969. float FractionalPart;
  1970. BOOL IntegerEqual;
  1971. float IntegerPart;
  1972. PMATH_DECOMPOSITION_FLOAT Test;
  1973. ULONG TestIndex;
  1974. ULONG ValueCount;
  1975. Failures = 0;
  1976. ValueCount = sizeof(TestDecompositionFloats) /
  1977. sizeof(TestDecompositionFloats[0]);
  1978. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1979. Test = &(TestDecompositionFloats[TestIndex]);
  1980. FractionalPart = modff(Test->Argument, &IntegerPart);
  1981. IntegerEqual = TestCompareResultsFloat(IntegerPart, Test->IntegerPart);
  1982. FractionEqual = TestCompareResultsFloat(FractionalPart,
  1983. Test->FractionalPart);
  1984. if ((IntegerEqual == FALSE) || (FractionEqual == FALSE)) {
  1985. printf("modff(%.6a) was {%.6a, %.6a} should have been "
  1986. "{%.6a, %.6a}.\n",
  1987. Test->Argument,
  1988. IntegerPart,
  1989. FractionalPart,
  1990. Test->IntegerPart,
  1991. Test->FractionalPart);
  1992. Failures += 1;
  1993. }
  1994. }
  1995. return Failures;
  1996. }
  1997. ULONG
  1998. TestCeilingAndFloorFloat (
  1999. VOID
  2000. )
  2001. /*++
  2002. Routine Description:
  2003. This routine tests the ceiling (ceil) and floor functions.
  2004. Arguments:
  2005. None.
  2006. Return Value:
  2007. Returns the count of test failures.
  2008. --*/
  2009. {
  2010. volatile float Ceiling;
  2011. ULONG Failures;
  2012. volatile float Floor;
  2013. PMATH_CEILING_FLOOR_FLOAT_VALUE Test;
  2014. ULONG TestIndex;
  2015. ULONG ValueCount;
  2016. Failures = 0;
  2017. ValueCount = sizeof(TestCeilingFloorFloats) /
  2018. sizeof(TestCeilingFloorFloats[0]);
  2019. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  2020. Test = &(TestCeilingFloorFloats[TestIndex]);
  2021. Ceiling = ceilf(Test->Argument);
  2022. Floor = floorf(Test->Argument);
  2023. if (TestCompareResultsFloat(Ceiling, Test->Ceiling) == FALSE) {
  2024. printf("ceilf(%.6a) was %.6a, should have been %.6a.\n",
  2025. Test->Argument,
  2026. Ceiling,
  2027. Test->Ceiling);
  2028. Failures += 1;
  2029. }
  2030. if (TestCompareResultsFloat(Floor, Test->Floor) == FALSE) {
  2031. printf("floorf(%.6a) was %.6a, should have been %.6a.\n",
  2032. Test->Argument,
  2033. Floor,
  2034. Test->Floor);
  2035. Failures += 1;
  2036. }
  2037. }
  2038. return Failures;
  2039. }
  2040. ULONG
  2041. TestModuloFloat (
  2042. VOID
  2043. )
  2044. /*++
  2045. Routine Description:
  2046. This routine tests the module (fmod) function.
  2047. Arguments:
  2048. None.
  2049. Return Value:
  2050. Returns the count of test failures.
  2051. --*/
  2052. {
  2053. ULONG Failures;
  2054. volatile float Remainder;
  2055. PMATH_MODULO_FLOAT_VALUE Test;
  2056. ULONG TestIndex;
  2057. ULONG ValueCount;
  2058. Failures = 0;
  2059. ValueCount = sizeof(TestModuloFloats) / sizeof(TestModuloFloats[0]);
  2060. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  2061. Test = &(TestModuloFloats[TestIndex]);
  2062. Remainder = fmodf(Test->Numerator, Test->Denominator);
  2063. if (TestCompareResultsFloat(Remainder, Test->Remainder) == FALSE) {
  2064. printf("fmodf(%.6a, %.6a) was %.6a, should have been %.6a.\n",
  2065. Test->Numerator,
  2066. Test->Denominator,
  2067. Remainder,
  2068. Test->Remainder);
  2069. Failures += 1;
  2070. }
  2071. }
  2072. return Failures;
  2073. }
  2074. BOOL
  2075. TestCompareResultsFloat (
  2076. float Value1,
  2077. float Value2
  2078. )
  2079. /*++
  2080. Routine Description:
  2081. This routine compares two float values, and returns whether or not they
  2082. are almost equal.
  2083. Arguments:
  2084. Value1 - Supplies the first value.
  2085. Value2 - Supplies the second value.
  2086. Return Value:
  2087. TRUE if the values are nearly equal.
  2088. FALSE if they are not equal.
  2089. --*/
  2090. {
  2091. LONG Word1;
  2092. LONG Word2;
  2093. LONG LowDifference;
  2094. FLOAT_PARTS Parts1;
  2095. FLOAT_PARTS Parts2;
  2096. Parts1.Float = Value1;
  2097. Parts2.Float = Value2;
  2098. Word1 = Parts1.Ulong;
  2099. Word2 = Parts2.Ulong;
  2100. if (((Word1 ^ Word2) & FLOAT_SIGN_BIT) != 0) {
  2101. return FALSE;
  2102. }
  2103. if ((Word1 & ~FLOAT_SIGN_BIT) >= FLOAT_NAN) {
  2104. if ((Word2 & ~FLOAT_SIGN_BIT) >= FLOAT_NAN) {
  2105. return TRUE;
  2106. }
  2107. return FALSE;
  2108. }
  2109. //
  2110. // Check the low twelve bits and allow for somem slop.
  2111. //
  2112. Word1 &= ~FLOAT_TRUNCATE_VALUE_MASK;
  2113. Word2 &= ~FLOAT_TRUNCATE_VALUE_MASK;
  2114. LowDifference = Word1 - Word2;
  2115. if (LowDifference < 0) {
  2116. LowDifference = -LowDifference;
  2117. }
  2118. if (LowDifference < MATH_RESULT_SLOP) {
  2119. return TRUE;
  2120. }
  2121. return FALSE;
  2122. }