mathtst.c 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729
  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. mathtst.c
  9. Abstract:
  10. This module implements the tests for the math portion of the C library.
  11. Author:
  12. Evan Green 23-Jul-2013
  13. Environment:
  14. Test
  15. --*/
  16. //
  17. // ------------------------------------------------------------------- Includes
  18. //
  19. //
  20. // Define this so it doesn't get defined to an import.
  21. //
  22. #define LIBC_API
  23. #include <minoca/lib/types.h>
  24. #include <minoca/lib/status.h>
  25. #include <minoca/lib/rtl.h>
  26. #include <math.h>
  27. #include <stdio.h>
  28. //
  29. // ---------------------------------------------------------------- Definitions
  30. //
  31. //
  32. // Define the amount that the result is allowed to vary from the known answer.
  33. //
  34. #define MATH_RESULT_SLOP 2
  35. //
  36. // ------------------------------------------------------ Data Type Definitions
  37. //
  38. typedef struct _MATH_TRIG_DOUBLE_VALUE {
  39. double Argument;
  40. double Sine;
  41. double Cosine;
  42. double Tangent;
  43. double HyperbolicSine;
  44. double HyperbolicCosine;
  45. double HyperbolicTangent;
  46. } MATH_TRIG_DOUBLE_VALUE, *PMATH_TRIG_DOUBLE_VALUE;
  47. typedef struct _MATH_TEST_SQUARE_ROOT_DOUBLE_VALUE {
  48. double Argument;
  49. double SquareRoot;
  50. } MATH_TEST_SQUARE_ROOT_DOUBLE_VALUE, *PMATH_TEST_SQUARE_ROOT_DOUBLE_VALUE;
  51. typedef struct _MATH_ARC_DOUBLE_VALUE {
  52. double Argument;
  53. double ArcSine;
  54. double ArcCosine;
  55. double ArcTangent;
  56. } MATH_ARC_DOUBLE_VALUE, *PMATH_ARC_DOUBLE_VALUE;
  57. typedef struct _MATH_ARC_TANGENT_DOUBLE {
  58. double Numerator;
  59. double Denominator;
  60. double ArcTangent;
  61. double ArcTangent2;
  62. } MATH_ARC_TANGENT_DOUBLE, *PMATH_ARC_TANGENT_DOUBLE;
  63. typedef struct _MATH_EXP_DOUBLE {
  64. double Argument;
  65. double Exponentiation;
  66. double ExponentiationMinusOne;
  67. } MATH_EXP_DOUBLE, *PMATH_EXP_DOUBLE;
  68. typedef struct _MATH_POWER_DOUBLE {
  69. double Value;
  70. double Exponent;
  71. double Result;
  72. double Hypotenuse;
  73. } MATH_POWER_DOUBLE, *PMATH_POWER_DOUBLE;
  74. typedef struct _MATH_LOGARITHM_DOUBLE {
  75. double Argument;
  76. double Logarithm;
  77. double Log2;
  78. double Log10;
  79. } MATH_LOGARITHM_DOUBLE, *PMATH_LOGARITHM_DOUBLE;
  80. typedef struct _MATH_DECOMPOSITION_DOUBLE {
  81. double Argument;
  82. double IntegerPart;
  83. double FractionalPart;
  84. } MATH_DECOMPOSITION_DOUBLE, *PMATH_DECOMPOSITION_DOUBLE;
  85. typedef struct _MATH_CEILING_FLOOR_DOUBLE_VALUE {
  86. double Argument;
  87. double Ceiling;
  88. double Floor;
  89. } MATH_CEILING_FLOOR_DOUBLE_VALUE, *PMATH_CEILING_FLOOR_DOUBLE_VALUE;
  90. typedef struct _MATH_MODULO_DOUBLE_VALUE {
  91. double Numerator;
  92. double Denominator;
  93. double Remainder;
  94. } MATH_MODULO_DOUBLE_VALUE, *PMATH_MODULO_DOUBLE_VALUE;
  95. //
  96. // ----------------------------------------------- Internal Function Prototypes
  97. //
  98. ULONG
  99. TestBasicTrigonometry (
  100. VOID
  101. );
  102. ULONG
  103. TestSquareRoot (
  104. VOID
  105. );
  106. ULONG
  107. TestArcTrigonometry (
  108. VOID
  109. );
  110. ULONG
  111. TestExponentiation (
  112. VOID
  113. );
  114. ULONG
  115. TestPower (
  116. VOID
  117. );
  118. ULONG
  119. TestLogarithm (
  120. VOID
  121. );
  122. ULONG
  123. TestDecomposition (
  124. VOID
  125. );
  126. ULONG
  127. TestCeilingAndFloor (
  128. VOID
  129. );
  130. ULONG
  131. TestModulo (
  132. VOID
  133. );
  134. BOOL
  135. TestCompareResults (
  136. double Value1,
  137. double Value2
  138. );
  139. //
  140. // -------------------------------------------------------------------- Globals
  141. //
  142. MATH_TRIG_DOUBLE_VALUE TestBasicTrigonometryDoubles[] = {
  143. {-0x1.921fb54442d18p-1,
  144. -0x1.6a09e667f3bccp-1,
  145. 0x1.6a09e667f3bcdp-1,
  146. -0x1.fffffffffffffp-1,
  147. -0x1.bcc270b522737p-1,
  148. 0x1.531994ce525b9p+0,
  149. -0x1.4fc441fa6d6d6p-1},
  150. {0x1.921fb54442d18p-1,
  151. 0x1.6a09e667f3bccp-1,
  152. 0x1.6a09e667f3bcdp-1,
  153. 0x1.fffffffffffffp-1,
  154. 0x1.bcc270b522737p-1,
  155. 0x1.531994ce525b9p+0,
  156. 0x1.4fc441fa6d6d6p-1},
  157. {0x1.921fb54442d18p+1,
  158. 0x1.1a62633145c07p-53,
  159. -0x1.0000000000000p+0,
  160. -0x1.1a62633145c07p-53,
  161. 0x1.718f45d72e672p+3,
  162. 0x1.72f147fee4000p+3,
  163. 0x1.fe175fa292810p-1},
  164. {-0x1.921fb54442d18p+1,
  165. -0x1.1a62633145c07p-53,
  166. -0x1.0000000000000p+0,
  167. 0x1.1a62633145c07p-53,
  168. -0x1.718f45d72e672p+3,
  169. 0x1.72f147fee4000p+3,
  170. -0x1.fe175fa292810p-1},
  171. {0x1.f6a7a2955385ep+1,
  172. -0x1.6a09e667f3bccp-1,
  173. -0x1.6a09e667f3bcep-1,
  174. 0x1.ffffffffffffdp-1,
  175. 0x1.95dfe166e2a93p+4,
  176. 0x1.9630955c947f5p+4,
  177. 0x1.ff9a463bc5610p-1},
  178. {-0x1.f6a7a2955385ep+1,
  179. 0x1.6a09e667f3bccp-1,
  180. -0x1.6a09e667f3bcep-1,
  181. -0x1.ffffffffffffdp-1,
  182. -0x1.95dfe166e2a93p+4,
  183. 0x1.9630955c947f5p+4,
  184. -0x1.ff9a463bc5610p-1},
  185. {0x1.921fb54442d18p+2,
  186. -0x1.1a62633145c07p-52,
  187. 0x1.0000000000000p+0,
  188. -0x1.1a62633145c07p-52,
  189. 0x1.0bbeb1603926ap+8,
  190. 0x1.0bbf2bc2b69c6p+8,
  191. 0x1.ffff15f81f9abp-1},
  192. {-0x1.921fb54442d18p+2,
  193. 0x1.1a62633145c07p-52,
  194. 0x1.0000000000000p+0,
  195. 0x1.1a62633145c07p-52,
  196. -0x1.0bbeb1603926ap+8,
  197. 0x1.0bbf2bc2b69c6p+8,
  198. -0x1.ffff15f81f9abp-1},
  199. {0x1.f6a7a2955385ep+1,
  200. -0x1.6a09e667f3bccp-1,
  201. -0x1.6a09e667f3bcep-1,
  202. 0x1.ffffffffffffdp-1,
  203. 0x1.95dfe166e2a93p+4,
  204. 0x1.9630955c947f5p+4,
  205. 0x1.ff9a463bc5610p-1},
  206. {-0x1.f6a7a2955385ep+1,
  207. 0x1.6a09e667f3bccp-1,
  208. -0x1.6a09e667f3bcep-1,
  209. -0x1.ffffffffffffdp-1,
  210. -0x1.95dfe166e2a93p+4,
  211. 0x1.9630955c947f5p+4,
  212. -0x1.ff9a463bc5610p-1},
  213. {0x1.5fdbbe9bba775p+2,
  214. -0x1.6a09e667f3bcep-1,
  215. 0x1.6a09e667f3bcbp-1,
  216. -0x1.0000000000002p+0,
  217. 0x1.e84b3f43319a6p+6,
  218. 0x1.e84f70f559672p+6,
  219. 0x1.fffb9a371a4ddp-1},
  220. {-0x1.5fdbbe9bba775p+2,
  221. 0x1.6a09e667f3bcep-1,
  222. 0x1.6a09e667f3bcbp-1,
  223. 0x1.0000000000002p+0,
  224. -0x1.e84b3f43319a6p+6,
  225. 0x1.e84f70f559672p+6,
  226. -0x1.fffb9a371a4ddp-1},
  227. {0x1.86a0000000000p+16,
  228. 0x1.24daa9c527e96p-5,
  229. -0x1.ffac3841b3da7p-1,
  230. -0x1.250a9d503313dp-5,
  231. INFINITY,
  232. INFINITY,
  233. 0x1.0000000000000p+0},
  234. {0x1.2a05f20000000p+33,
  235. -0x1.f334c7896a4e3p-2,
  236. 0x1.bf098901c931ap-1,
  237. -0x1.1de000f443f50p-1,
  238. INFINITY,
  239. INFINITY,
  240. 0x1.0000000000000p+0},
  241. {0x1.c6bf526340000p+49,
  242. 0x1.b76f88136cebap-1,
  243. -0x1.06c154609d33fp-1,
  244. -0x1.ac23600a95be4p+0,
  245. INFINITY,
  246. INFINITY,
  247. 0x1.0000000000000p+0},
  248. {0x1.5af1d78b58c40p+66,
  249. -0x1.4a5e605fd6450p-1,
  250. 0x1.872720fc60d3dp-1,
  251. -0x1.b06fbbe995394p-1,
  252. INFINITY,
  253. INFINITY,
  254. 0x1.0000000000000p+0},
  255. {0x1.08b2a2c280291p+83,
  256. -0x1.38958031b7978p-2,
  257. 0x1.e78fe68c89fadp-1,
  258. -0x1.4840633f93616p-2,
  259. INFINITY,
  260. INFINITY,
  261. 0x1.0000000000000p+0},
  262. {0x1.93e5939a08ceap+99,
  263. 0x1.31c608f107767p-7,
  264. -0x1.fffa4b11f1b45p-1,
  265. -0x1.31c97177a2330p-7,
  266. INFINITY,
  267. INFINITY,
  268. 0x1.0000000000000p+0},
  269. {0x1.3426172c74d82p+116,
  270. 0x1.b116c776f2d43p-1,
  271. 0x1.1116f09af4b68p-1,
  272. 0x1.95fc9f95b7229p+0,
  273. INFINITY,
  274. INFINITY,
  275. 0x1.0000000000000p+0},
  276. {0x1.d6329f1c35ca5p+132,
  277. 0x1.4b27597db33cep-1,
  278. -0x1.867d0a5330fd0p-1,
  279. -0x1.b2339b1756c72p-1,
  280. INFINITY,
  281. INFINITY,
  282. 0x1.0000000000000p+0},
  283. {0x1.11b0ec57e649ap+166,
  284. -0x1.ec083ac81db28p-2,
  285. 0x1.c105714551003p-1,
  286. -0x1.1885916b6549dp-1,
  287. INFINITY,
  288. INFINITY,
  289. 0x1.0000000000000p+0},
  290. {0x1.1afd6ec0e1411p+249,
  291. 0x1.53a921e12790ep-1,
  292. -0x1.7f1c9cda5213dp-1,
  293. -0x1.c5ee4e954e803p-1,
  294. INFINITY,
  295. INFINITY,
  296. 0x1.0000000000000p+0},
  297. {0x1.249ad2594c37dp+332,
  298. -0x1.85c5e5b929359p-2,
  299. 0x1.d9757496841f5p-1,
  300. -0x1.a5807d6f76f7dp-2,
  301. INFINITY,
  302. INFINITY,
  303. 0x1.0000000000000p+0},
  304. {0x1.38d352e5096afp+498,
  305. 0x1.619a65c3554bdp-1,
  306. -0x1.724837ff05667p-1,
  307. -0x1.e8effdfae250dp-1,
  308. INFINITY,
  309. INFINITY,
  310. 0x1.0000000000000p+0},
  311. {-0x1.24f8000000000p+18,
  312. -0x1.b6885f8d1df45p-4,
  313. -0x1.fd0e9ec921065p-1,
  314. 0x1.b911615bdd6c4p-4,
  315. -INFINITY,
  316. INFINITY,
  317. -0x1.0000000000000p+0},
  318. {-0x1.550f7dca70000p+51,
  319. -0x1.77f46d55870efp-5,
  320. 0x1.ff75e5df884a4p-1,
  321. -0x1.7859f0c7dbc4ep-5,
  322. -INFINITY,
  323. INFINITY,
  324. -0x1.0000000000000p+0},
  325. {-0x1.8d0bf423c03d9p+84,
  326. -0x1.8ed03bfc145a6p-2,
  327. 0x1.d792a723383ecp-1,
  328. -0x1.b100c5350e6fcp-2,
  329. -INFINITY,
  330. INFINITY,
  331. -0x1.0000000000000p+0},
  332. {-0x1.9a896283d96e6p+167,
  333. -0x1.696b9d610b33fp-3,
  334. 0x1.f7f6d890ee3a7p-1,
  335. -0x1.6f2ee9a26a6ecp-3,
  336. -INFINITY,
  337. INFINITY,
  338. -0x1.0000000000000p+0},
  339. {-0x1.a87c262151e1ap+250,
  340. -0x1.2fd0478111051p-1,
  341. 0x1.9c1e39b28692fp-1,
  342. -0x1.797253994412fp-1,
  343. -INFINITY,
  344. INFINITY,
  345. -0x1.0000000000000p+0},
  346. {-0x1.b6e83b85f253bp+333,
  347. -0x1.ff8d25c220595p-1,
  348. -0x1.56ddd3281e346p-5,
  349. 0x1.7df2aad5eaf57p+4,
  350. -INFINITY,
  351. INFINITY,
  352. -0x1.0000000000000p+0},
  353. {-0x1.d53cfc578e207p+499,
  354. -0x1.a6f0516b9968dp-2,
  355. 0x1.d249c8da1556cp-1,
  356. -0x1.d0669cb032948p-2,
  357. -INFINITY,
  358. INFINITY,
  359. -0x1.0000000000000p+0},
  360. {0x1.4f8b588e368f1p-17,
  361. 0x1.4f8b588e1e8a2p-17,
  362. 0x1.ffffffff920c8p-1,
  363. 0x1.4f8b588e6698ep-17,
  364. 0x1.4f8b588e4e940p-17,
  365. 0x1.0000000036f9cp+0,
  366. 0x1.4f8b588e06854p-17},
  367. {0x1.b7cdfd9d7bdbbp-34,
  368. 0x1.b7cdfd9d7bdbbp-34,
  369. 0x1.0000000000000p+0,
  370. 0x1.b7cdfd9d7bdbbp-34,
  371. 0x1.b7cdfd9d7bdbbp-34,
  372. 0x1.0000000000000p+0,
  373. 0x1.b7cdfd9d7bdbbp-34},
  374. {0x1.203af9ee75616p-50,
  375. 0x1.203af9ee75616p-50,
  376. 0x1.0000000000000p+0,
  377. 0x1.203af9ee75616p-50,
  378. 0x1.203af9ee75616p-50,
  379. 0x1.0000000000000p+0,
  380. 0x1.203af9ee75616p-50},
  381. {0x1.79ca10c924223p-67,
  382. 0x1.79ca10c924223p-67,
  383. 0x1.0000000000000p+0,
  384. 0x1.79ca10c924223p-67,
  385. 0x1.79ca10c924223p-67,
  386. 0x1.0000000000000p+0,
  387. 0x1.79ca10c924223p-67},
  388. {-0x1.f75104d551d69p-16,
  389. -0x1.f75104d40d943p-16,
  390. 0x1.fffffffc22708p-1,
  391. -0x1.f75104d7da5b4p-16,
  392. -0x1.f75104d69618ep-16,
  393. 0x1.00000001eec7cp+0,
  394. -0x1.f75104d2c951ep-16},
  395. {-0x1.07e1fe91b0b70p-35,
  396. -0x1.07e1fe91b0b70p-35,
  397. 0x1.0000000000000p+0,
  398. -0x1.07e1fe91b0b70p-35,
  399. -0x1.07e1fe91b0b70p-35,
  400. 0x1.0000000000000p+0,
  401. -0x1.07e1fe91b0b70p-35},
  402. {-0x1.59e05f1e2674dp-52,
  403. -0x1.59e05f1e2674dp-52,
  404. 0x1.0000000000000p+0,
  405. -0x1.59e05f1e2674dp-52,
  406. -0x1.59e05f1e2674dp-52,
  407. 0x1.0000000000000p+0,
  408. -0x1.59e05f1e2674dp-52},
  409. {-0x1.1b578c96db19bp-65,
  410. -0x1.1b578c96db19bp-65,
  411. 0x1.0000000000000p+0,
  412. -0x1.1b578c96db19bp-65,
  413. -0x1.1b578c96db19bp-65,
  414. 0x1.0000000000000p+0,
  415. -0x1.1b578c96db19bp-65},
  416. {-0x1.672dbb81f8a17p-165,
  417. -0x1.672dbb81f8a17p-165,
  418. 0x1.0000000000000p+0,
  419. -0x1.672dbb81f8a17p-165,
  420. -0x1.672dbb81f8a17p-165,
  421. 0x1.0000000000000p+0,
  422. -0x1.672dbb81f8a17p-165},
  423. {-0x1.5b605314ad5c2p-248,
  424. -0x1.5b605314ad5c2p-248,
  425. 0x1.0000000000000p+0,
  426. -0x1.5b605314ad5c2p-248,
  427. -0x1.5b605314ad5c2p-248,
  428. 0x1.0000000000000p+0,
  429. -0x1.5b605314ad5c2p-248},
  430. {INFINITY,
  431. -INFINITY,
  432. -INFINITY,
  433. -INFINITY,
  434. INFINITY,
  435. INFINITY,
  436. 0x1.0000000000000p+0},
  437. {-INFINITY,
  438. -INFINITY,
  439. -INFINITY,
  440. -INFINITY,
  441. -INFINITY,
  442. INFINITY,
  443. -0x1.0000000000000p+0},
  444. {NAN,
  445. NAN,
  446. NAN,
  447. NAN,
  448. NAN,
  449. NAN,
  450. NAN},
  451. };
  452. MATH_TEST_SQUARE_ROOT_DOUBLE_VALUE TestSquareRootDoubles[] = {
  453. {0x1.921fb54442d18p-1, 0x1.c5bf891b4ef6ap-1},
  454. {0x1.921fb54442d18p+1, 0x1.c5bf891b4ef6ap+0},
  455. {0x1.f6a7a2955385ep+1, 0x1.fb4e4f1347eb9p+0},
  456. {0x1.921fb54442d18p+2, 0x1.40d931ff62705p+1},
  457. {0x1.f6a7a2955385ep+1, 0x1.fb4e4f1347eb9p+0},
  458. {0x1.5fdbbe9bba775p+2, 0x1.2c204f9612dc7p+1},
  459. {0x1.86a0000000000p+16, 0x1.3c3a4edfa9759p+8},
  460. {0x1.2a05f20000000p+33, 0x1.86a0000000000p+16},
  461. {0x1.c6bf526340000p+49, 0x1.e286789a07f2fp+24},
  462. {0x1.5af1d78b58c40p+66, 0x1.2a05f20000000p+33},
  463. {0x1.08b2a2c280291p+83, 0x1.702337e304309p+41},
  464. {0x1.93e5939a08ceap+99, 0x1.c6bf526340000p+49},
  465. {0x1.3426172c74d82p+116, 0x1.18ddde9363225p+58},
  466. {0x1.d6329f1c35ca5p+132, 0x1.5af1d78b58c40p+66},
  467. {0x1.11b0ec57e649ap+166, 0x1.08b2a2c280291p+83},
  468. {0x1.1afd6ec0e1411p+249, 0x1.7ca5342cf485ap+124},
  469. {0x1.249ad2594c37dp+332, 0x1.11b0ec57e649ap+166},
  470. {0x1.38d352e5096afp+498, 0x1.1afd6ec0e1411p+249},
  471. {0x1.4f8b588e368f1p-17, 0x1.9e7c6e43390b7p-9},
  472. {0x1.b7cdfd9d7bdbbp-34, 0x1.4f8b588e368f1p-17},
  473. {0x1.203af9ee75616p-50, 0x1.0fa3389d6eb40p-25},
  474. {0x1.79ca10c924223p-67, 0x1.b7cdfd9d7bdbbp-34},
  475. {0x1.0000000000000p+0, 0x1.0000000000000p+0},
  476. {0x1.0000000000000p+1, 0x1.6a09e667f3bcdp+0},
  477. {0x1.8000000000000p+1, 0x1.bb67ae8584caap+0},
  478. {0x1.22ad962000000p+27, 0x1.81c8000000000p+13},
  479. {0x1.9000000000000p+4, 0x1.4000000000000p+2},
  480. {0x1.fae147ae147aep-1, 0x1.fd6efe4c9b8a5p-1},
  481. {-0x1.0000000000000p+0, -INFINITY},
  482. {INFINITY, INFINITY},
  483. {-INFINITY, -INFINITY},
  484. {NAN, NAN},
  485. };
  486. MATH_ARC_DOUBLE_VALUE TestArcDoubles[] = {
  487. {-0x0.0000000000000p+0,
  488. -0x0.0000000000000p+0,
  489. 0x1.921fb54442d18p+0,
  490. -0x0.0000000000000p+0},
  491. {-0x1.47ae147ae147bp-7,
  492. -0x1.47af7a68f8eefp-7,
  493. 0x1.94af143914c36p+0,
  494. -0x1.47ab48b1efb5dp-7},
  495. {-0x1.47ae147ae147bp-6,
  496. -0x1.47b3ac64be09ap-6,
  497. 0x1.973e83f5d5c9bp+0,
  498. -0x1.47a2e5dafff07p-6},
  499. {-0x1.eb851eb851eb8p-6,
  500. -0x1.eb98008422806p-6,
  501. 0x1.99ce1546535b8p+0,
  502. -0x1.eb5f644234b83p-6},
  503. {-0x1.47ae147ae147bp-5,
  504. -0x1.47c4773aebd59p-5,
  505. 0x1.9c5dd8fe1a303p+0,
  506. -0x1.4781623768d56p-5},
  507. {-0x1.999999999999ap-5,
  508. -0x1.99c5570328659p-5,
  509. 0x1.9eeddffc5c14bp+0,
  510. -0x1.9942597929f27p-5},
  511. {-0x1.eb851eb851eb8p-5,
  512. -0x1.ebd0bd734d8a7p-5,
  513. 0x1.a17e3b2fdd3ddp+0,
  514. -0x1.eaee734b5dd23p-5},
  515. {-0x1.1eb851eb851ecp-4,
  516. -0x1.1ef4656a8d28cp-4,
  517. 0x1.a40efb9aeba41p+0,
  518. -0x1.1e40c8b780fdep-4},
  519. {-0x1.47ae147ae147bp-4,
  520. -0x1.4807d1320318cp-4,
  521. 0x1.a6a0325763031p+0,
  522. -0x1.46fbce9dfcc00p-4},
  523. {-0x1.70a3d70a3d70ap-4,
  524. -0x1.7123b567d5638p-4,
  525. 0x1.a931f09ac027cp+0,
  526. -0x1.6fa6446b1cb54p-4},
  527. {-0x1.999999999999ap-4,
  528. -0x1.9a49276037884p-4,
  529. 0x1.abc447ba464a1p+0,
  530. -0x1.983e282e2cc4dp-4},
  531. {-0x1.c28f5c28f5c29p-4,
  532. -0x1.c3793eaf67675p-4,
  533. 0x1.ae57492f39480p+0,
  534. -0x1.c0c17d875967ap-4},
  535. {-0x1.eb851eb851eb8p-4,
  536. -0x1.ecb5156ece085p-4,
  537. 0x1.b0eb069b2fb21p+0,
  538. -0x1.e92e4e371f679p-4},
  539. {-0x1.0a3d70a3d70a4p-3,
  540. -0x1.0afee441e736fp-3,
  541. 0x1.b37f91cc7fb86p+0,
  542. -0x1.08c155549dc84p-3},
  543. {-0x1.1eb851eb851ecp-3,
  544. -0x1.1faa3bf43ad3bp-3,
  545. 0x1.b614fcc2ca2c0p+0,
  546. -0x1.1cde553d5fe66p-3},
  547. {-0x1.3333333333333p-3,
  548. -0x1.345d237b20eb3p-3,
  549. 0x1.b8ab59b3a6eefp+0,
  550. -0x1.30ed367d7cd04p-3},
  551. {-0x1.47ae147ae147bp-3,
  552. -0x1.49182e599c592p-3,
  553. 0x1.bb42bb0f765cbp+0,
  554. -0x1.44ed0cd36e62ep-3},
  555. {-0x1.5c28f5c28f5c3p-3,
  556. -0x1.5ddbf210c49e2p-3,
  557. 0x1.bddb33865b654p+0,
  558. -0x1.58dcf04f55e58p-3},
  559. {-0x1.70a3d70a3d70ap-3,
  560. -0x1.72a90648fbf25p-3,
  561. 0x1.c074d60d624fdp+0,
  562. -0x1.6cbbfd8acff50p-3},
  563. {-0x1.851eb851eb852p-3,
  564. -0x1.878004fcac282p-3,
  565. 0x1.c30fb5e3d8568p+0,
  566. -0x1.808955ddac693p-3},
  567. {-0x1.999999999999ap-3,
  568. -0x1.9c618aa4ae23dp-3,
  569. 0x1.c5abe698d8960p+0,
  570. -0x1.94441f8f7260cp-3},
  571. {-0x1.ae147ae147ae1p-3,
  572. -0x1.b14e3666821f8p-3,
  573. 0x1.c8497c1113157p+0,
  574. -0x1.a7eb86059c7dap-3},
  575. {-0x1.c28f5c28f5c29p-3,
  576. -0x1.c646aa44819dap-3,
  577. 0x1.cae88a8cd3053p+0,
  578. -0x1.bb7eb9ee7d317p-3},
  579. {-0x1.d70a3d70a3d71p-3,
  580. -0x1.db4b8b5036e9ap-3,
  581. 0x1.cd8926ae49aecp+0,
  582. -0x1.cefcf168bed02p-3},
  583. {-0x1.eb851eb851eb8p-3,
  584. -0x1.f05d81df0953fp-3,
  585. 0x1.d02b658023fc0p+0,
  586. -0x1.e265682776e76p-3},
  587. {-0x1.0000000000000p-2,
  588. -0x1.02be9ce0b87cdp-2,
  589. 0x1.d2cf5c7c70f0cp+0,
  590. -0x1.f5b75f92c80ddp-3},
  591. {-0x1.0a3d70a3d70a4p-2,
  592. -0x1.0d55b13e747aep-2,
  593. 0x1.d5752193dff04p+0,
  594. -0x1.04790f72887d4p-2},
  595. {-0x1.147ae147ae148p-2,
  596. -0x1.17f457c46daabp-2,
  597. 0x1.d81ccb355e3c3p+0,
  598. -0x1.0e0a79a2559afp-2},
  599. {-0x1.1eb851eb851ecp-2,
  600. -0x1.229aec47638ddp-2,
  601. 0x1.dac670561bb50p+0,
  602. -0x1.178f97ed1f891p-2},
  603. {-0x1.28f5c28f5c28fp-2,
  604. -0x1.2d49ccd6f3133p-2,
  605. 0x1.dd722879ff965p+0,
  606. -0x1.210816f1dae81p-2},
  607. {-0x1.3333333333333p-2,
  608. -0x1.380159e14f6ffp-2,
  609. 0x1.e0200bbc96ad8p+0,
  610. -0x1.2a73a661eaf06p-2},
  611. {-0x1.3d70a3d70a3d7p-2,
  612. -0x1.42c1f6590a37dp-2,
  613. 0x1.e2d032da855f8p+0,
  614. -0x1.33d1f9074c099p-2},
  615. {-0x1.47ae147ae147bp-2,
  616. -0x1.4d8c07dd17d7dp-2,
  617. 0x1.e582b73b88c77p+0,
  618. -0x1.3d22c4c92395dp-2},
  619. {-0x1.51eb851eb851fp-2,
  620. -0x1.585ff6e341c3ep-2,
  621. 0x1.e837b2fd13428p+0,
  622. -0x1.4665c2aebeed4p-2},
  623. {-0x1.5c28f5c28f5c3p-2,
  624. -0x1.633e2ee53c5b9p-2,
  625. 0x1.eaef40fd91e86p+0,
  626. -0x1.4f9aaee10ca82p-2},
  627. {-0x1.6666666666667p-2,
  628. -0x1.6e271e909bbe5p-2,
  629. 0x1.eda97ce869c12p+0,
  630. -0x1.58c148aa9c5d7p-2},
  631. {-0x1.70a3d70a3d70ap-2,
  632. -0x1.791b37f9e8a25p-2,
  633. 0x1.f0668342bcfa2p+0,
  634. -0x1.61d9527631ea9p-2},
  635. {-0x1.7ae147ae147aep-2,
  636. -0x1.841af0d31cc53p-2,
  637. 0x1.f32671790a02dp+0,
  638. -0x1.6ae291cbfa274p-2},
  639. {-0x1.851eb851eb852p-2,
  640. -0x1.8f26c2a5d5e1dp-2,
  641. 0x1.f5e965edb84a0p+0,
  642. -0x1.73dccf4d6fa15p-2},
  643. {-0x1.8f5c28f5c28f6p-2,
  644. -0x1.9a3f2b11964ecp-2,
  645. 0x1.f8af8008a8653p+0,
  646. -0x1.7cc7d6affe959p-2},
  647. {-0x1.999999999999ap-2,
  648. -0x1.a564ac0e73a34p-2,
  649. 0x1.fb78e047dfba5p+0,
  650. -0x1.85a376b677dc0p-2},
  651. {-0x1.a3d70a3d70a3ep-2,
  652. -0x1.b097cc349e2c7p-2,
  653. 0x1.fe45a8516a5cap+0,
  654. -0x1.8e6f812962e4fp-2},
  655. {-0x1.ae147ae147ae1p-2,
  656. -0x1.bbd9170937b7fp-2,
  657. 0x1.008afd83485fcp+1,
  658. -0x1.972bcace3f311p-2},
  659. {-0x1.b851eb851eb85p-2,
  660. -0x1.c7291d50fd81ep-2,
  661. 0x1.01f4fe4c41190p+1,
  662. -0x1.9fd82b5dc5e5fp-2},
  663. {-0x1.c28f5c28f5c29p-2,
  664. -0x1.d2887569581cap-2,
  665. 0x1.0360e94f4c6c5p+1,
  666. -0x1.a8747d793c3dbp-2},
  667. {-0x1.ccccccccccccdp-2,
  668. -0x1.ddf7bba8753cdp-2,
  669. 0x1.04ced21730106p+1,
  670. -0x1.b1009e9ee79bcp-2},
  671. {-0x1.d70a3d70a3d71p-2,
  672. -0x1.e97792c522be1p-2,
  673. 0x1.063eccfac5c08p+1,
  674. -0x1.b97c6f1db4032p-2},
  675. {-0x1.e147ae147ae15p-2,
  676. -0x1.f508a4473857fp-2,
  677. 0x1.07b0ef2b0873cp+1,
  678. -0x1.c1e7d2081d8e2p-2},
  679. {-0x1.eb851eb851eb8p-2,
  680. -0x1.0055d080bb634p-1,
  681. 0x1.09254ec250419p+1,
  682. -0x1.ca42ad266d56fp-2},
  683. {-0x1.f5c28f5c28f5cp-2,
  684. -0x1.0630a0caf011ap-1,
  685. 0x1.0a9c02d4dd6d3p+1,
  686. -0x1.d28ce8e859fefp-2},
  687. {-0x1.0000000000000p-1,
  688. -0x1.0c152382d7366p-1,
  689. 0x1.0c152382d7366p+1,
  690. -0x1.dac670561bb4fp-2},
  691. {-0x1.051eb851eb852p-1,
  692. -0x1.1203bda719c39p-1,
  693. 0x1.0d90ca0be7d9ap+1,
  694. -0x1.e2ef3101033dfp-2},
  695. {-0x1.0a3d70a3d70a4p-1,
  696. -0x1.17fcd90a0d19fp-1,
  697. 0x1.0f0f10e4a4af4p+1,
  698. -0x1.eb071af3a3191p-2},
  699. {-0x1.0f5c28f5c28f6p-1,
  700. -0x1.1e00e4af59504p-1,
  701. 0x1.109013cdf7bcdp+1,
  702. -0x1.f30e20a199675p-2},
  703. {-0x1.147ae147ae148p-1,
  704. -0x1.241055329849fp-1,
  705. 0x1.1213efeec77b4p+1,
  706. -0x1.fb0436d708c0ap-2},
  707. {-0x1.199999999999ap-1,
  708. -0x1.2a2ba538032f0p-1,
  709. 0x1.139ac3f022348p+1,
  710. -0x1.0174aa53e6ce4p-1},
  711. {-0x1.1eb851eb851ecp-1,
  712. -0x1.305355e86c374p-1,
  713. 0x1.1524b01c3c769p+1,
  714. -0x1.055eb9af3eb4bp-1},
  715. {-0x1.23d70a3d70a3ep-1,
  716. -0x1.3687ef79f2085p-1,
  717. 0x1.16b1d6809deadp+1,
  718. -0x1.094047359deecp-1},
  719. {-0x1.28f5c28f5c28fp-1,
  720. -0x1.3cca01c711851p-1,
  721. 0x1.18425b13e5ca0p+1,
  722. -0x1.0d1951a9393b7p-1},
  723. {-0x1.2e147ae147ae1p-1,
  724. -0x1.431a24f5fc8e4p-1,
  725. 0x1.19d663dfa08c5p+1,
  726. -0x1.10e9d8cdbac48p-1},
  727. {-0x1.3333333333333p-1,
  728. -0x1.4978fa3269ee1p-1,
  729. 0x1.1b6e192ebbe44p+1,
  730. -0x1.14b1dd5f90ce1p-1},
  731. {-0x1.3851eb851eb85p-1,
  732. -0x1.4fe72c7c6f17ap-1,
  733. 0x1.1d09a5c13d2ebp+1,
  734. -0x1.1871610b3da41p-1},
  735. {-0x1.3d70a3d70a3d7p-1,
  736. -0x1.5665718f62b97p-1,
  737. 0x1.1ea93705fa172p+1,
  738. -0x1.1c286664ad8c9p-1},
  739. {-0x1.428f5c28f5c29p-1,
  740. -0x1.5cf48ae44b724p-1,
  741. 0x1.204cfd5b34455p+1,
  742. -0x1.1fd6f0de97388p-1},
  743. {-0x1.47ae147ae147bp-1,
  744. -0x1.639546d3fd53bp-1,
  745. 0x1.21f52c5720bdbp+1,
  746. -0x1.237d04c1eae02p-1},
  747. {-0x1.4cccccccccccdp-1,
  748. -0x1.6a4881ddc9b84p-1,
  749. 0x1.23a1fb1993d6dp+1,
  750. -0x1.271aa72553ed5p-1},
  751. {-0x1.51eb851eb851fp-1,
  752. -0x1.710f28188f80dp-1,
  753. 0x1.2553a4a84548fp+1,
  754. -0x1.2aafdde4d0c9fp-1},
  755. {-0x1.570a3d70a3d71p-1,
  756. -0x1.77ea36d518926p-1,
  757. 0x1.270a6857678d6p+1,
  758. -0x1.2e3caf996421ep-1},
  759. {-0x1.5c28f5c28f5c3p-1,
  760. -0x1.7edabe7a11ffep-1,
  761. 0x1.28c68a40a5e8cp+1,
  762. -0x1.31c12390e29fap-1},
  763. {-0x1.6147ae147ae15p-1,
  764. -0x1.85e1e4a3a04f3p-1,
  765. 0x1.2a8853cb097c9p+1,
  766. -0x1.353d41c5dfe68p-1},
  767. {-0x1.6666666666667p-1,
  768. -0x1.8d00e692afd97p-1,
  769. 0x1.2c501446cd5f2p+1,
  770. -0x1.38b112d7bd4aep-1},
  771. {-0x1.6b851eb851eb8p-1,
  772. -0x1.94391bfac8e4bp-1,
  773. 0x1.2e1e21a0d3a1fp+1,
  774. -0x1.3c1ca002dc877p-1},
  775. {-0x1.70a3d70a3d70ap-1,
  776. -0x1.9b8bfa40885bdp-1,
  777. 0x1.2ff2d932437fbp+1,
  778. -0x1.3f7ff318f8723p-1},
  779. {-0x1.75c28f5c28f5cp-1,
  780. -0x1.a2fb183f1f79cp-1,
  781. 0x1.31cea0b1e9473p+1,
  782. -0x1.42db1679a576fp-1},
  783. {-0x1.7ae147ae147aep-1,
  784. -0x1.aa8832b0b0525p-1,
  785. 0x1.33b1e74e4d7d5p+1,
  786. -0x1.462e150afb65fp-1},
  787. {-0x1.8000000000000p-1,
  788. -0x1.b235315c680dcp-1,
  789. 0x1.359d26f93b6c3p+1,
  790. -0x1.4978fa3269ee1p-1},
  791. {-0x1.851eb851eb852p-1,
  792. -0x1.ba042d36663dbp-1,
  793. 0x1.3790e5efbaf83p+1,
  794. -0x1.4cbbd1cdb8e70p-1},
  795. {-0x1.8a3d70a3d70a4p-1,
  796. -0x1.c1f777a9974f2p-1,
  797. 0x1.398db88c873c9p+1,
  798. -0x1.4ff6a82c35600p-1},
  799. {-0x1.8f5c28f5c28f6p-1,
  800. -0x1.ca11a353bd84cp-1,
  801. 0x1.3b94437710c9fp+1,
  802. -0x1.53298a080c38dp-1},
  803. {-0x1.947ae147ae148p-1,
  804. -0x1.d2558e9188decp-1,
  805. 0x1.3da53e4683a07p+1,
  806. -0x1.5654847fd2e00p-1},
  807. {-0x1.999999999999ap-1,
  808. -0x1.dac670561bb50p-1,
  809. 0x1.3fc176b7a8560p+1,
  810. -0x1.5977a5103ea93p-1},
  811. {-0x1.9eb851eb851ecp-1,
  812. -0x1.e367e7f212996p-1,
  813. 0x1.41e9d49ea60f2p+1,
  814. -0x1.5c92f98e0b072p-1},
  815. {-0x1.a3d70a3d70a3ep-1,
  816. -0x1.ec3e10a736333p-1,
  817. 0x1.441f5ecbeef59p+1,
  818. -0x1.5fa690200ed46p-1},
  819. {-0x1.a8f5c28f5c290p-1,
  820. -0x1.f54d9a373facep-1,
  821. 0x1.4663412ff1540p+1,
  822. -0x1.62b2773980b12p-1},
  823. {-0x1.ae147ae147ae1p-1,
  824. -0x1.fe9be811df6cap-1,
  825. 0x1.48b6d4a69943fp+1,
  826. -0x1.65b6bd946a61bp-1},
  827. {-0x1.b333333333333p-1,
  828. -0x1.04179cba26d0ep+0,
  829. 0x1.4b1ba8ff34d13p+1,
  830. -0x1.68b3722c4afb4p-1},
  831. {-0x1.b851eb851eb85p-1,
  832. -0x1.09076ee9d82bbp+0,
  833. 0x1.4d9392170d7e9p+1,
  834. -0x1.6ba8a438e7926p-1},
  835. {-0x1.bd70a3d70a3d7p-1,
  836. -0x1.0e21bd416ba16p+0,
  837. 0x1.5020b942d7397p+1,
  838. -0x1.6e9663294a097p-1},
  839. {-0x1.c28f5c28f5c29p-1,
  840. -0x1.136bb485f3d91p+0,
  841. 0x1.52c5b4e51b555p+1,
  842. -0x1.717cbe9eed853p-1},
  843. {-0x1.c7ae147ae147bp-1,
  844. -0x1.18eb9cef862d9p+0,
  845. 0x1.5585a919e47f9p+1,
  846. -0x1.745bc66917fb0p-1},
  847. {-0x1.ccccccccccccdp-1,
  848. -0x1.1ea93705fa172p+0,
  849. 0x1.586476251e745p+1,
  850. -0x1.77338a80603bep-1},
  851. {-0x1.d1eb851eb851fp-1,
  852. -0x1.24ae43a7af149p+0,
  853. 0x1.5b66fc75f8f31p+1,
  854. -0x1.7a041b025fce9p-1},
  855. {-0x1.d70a3d70a3d71p-1,
  856. -0x1.2b07529b1748ap+0,
  857. 0x1.5e9383efad0d1p+1,
  858. -0x1.7ccd882d8fdbep-1},
  859. {-0x1.dc28f5c28f5c3p-1,
  860. -0x1.31c50a48f3a76p+0,
  861. 0x1.61f25fc69b3c7p+1,
  862. -0x1.7f8fe25d5067bp-1},
  863. {-0x1.e147ae147ae15p-1,
  864. -0x1.38fe4cb950b12p+0,
  865. 0x1.658f00fec9c15p+1,
  866. -0x1.824b3a061901ap-1},
  867. {-0x1.e666666666667p-1,
  868. -0x1.40d41159f340bp+0,
  869. 0x1.6979e34f1b092p+1,
  870. -0x1.84ff9fb1d212ep-1},
  871. {-0x1.eb851eb851eb8p-1,
  872. -0x1.4978fa3269ee1p+0,
  873. 0x1.6dcc57bb565fcp+1,
  874. -0x1.87ad23fc55e47p-1},
  875. {-0x1.f0a3d70a3d70ap-1,
  876. -0x1.5342538981ec8p+0,
  877. 0x1.72b10466e25f0p+1,
  878. -0x1.8a53d7901872ap-1},
  879. {-0x1.f5c28f5c28f5cp-1,
  880. -0x1.5ed690583be07p+0,
  881. 0x1.787b22ce3f590p+1,
  882. -0x1.8cf3cb22f51e5p-1},
  883. {-0x1.fae147ae147aep-1,
  884. -0x1.6de3c6f33d51dp+0,
  885. 0x1.8001be1bc011bp+1,
  886. -0x1.8f8d0f7321467p-1},
  887. {-0x1.0000000000000p+0,
  888. -0x1.921fb54442d18p+0,
  889. 0x1.921fb54442d18p+1,
  890. -0x1.921fb54442d18p-1},
  891. {-0x1.028f5c28f5c29p+0,
  892. -NAN,
  893. -NAN,
  894. -0x1.94abcd5ca9acfp-1},
  895. {-0x1.051eb851eb852p+0,
  896. -NAN,
  897. -NAN,
  898. -0x1.97316882ab45ap-1},
  899. };
  900. MATH_ARC_TANGENT_DOUBLE TestArcTangentDoubles[] = {
  901. {NAN,
  902. NAN,
  903. NAN,
  904. NAN},
  905. {NAN,
  906. 0x1.0000000000000p+0,
  907. NAN,
  908. NAN},
  909. {0x1.0000000000000p+0,
  910. NAN,
  911. NAN,
  912. NAN},
  913. {0x1.0000000000000p+0,
  914. 0x1.0000000000000p+0,
  915. 0x1.921fb54442d18p-1,
  916. 0x1.921fb54442d18p-1},
  917. {0x0.0000000000000p+0,
  918. 0x1.199999999999ap+0,
  919. 0x0.0000000000000p+0,
  920. 0x0.0000000000000p+0},
  921. {-0x0.0000000000000p+0,
  922. 0x1.199999999999ap+0,
  923. -0x0.0000000000000p+0,
  924. -0x0.0000000000000p+0},
  925. {0x0.0000000000000p+0,
  926. -0x1.199999999999ap+0,
  927. -0x0.0000000000000p+0,
  928. 0x1.921fb54442d18p+1},
  929. {-0x0.0000000000000p+0,
  930. -0x1.199999999999ap+0,
  931. 0x0.0000000000000p+0,
  932. -0x1.921fb54442d18p+1},
  933. {0x1.e666666666666p-1,
  934. 0x0.0000000000000p+0,
  935. 0x1.921fb54442d18p+0,
  936. 0x1.921fb54442d18p+0},
  937. {-0x1.e666666666666p-1,
  938. -0x0.0000000000000p+0,
  939. 0x1.921fb54442d18p+0,
  940. -0x1.921fb54442d18p+0},
  941. {INFINITY,
  942. INFINITY,
  943. -INFINITY,
  944. 0x1.921fb54442d18p-1},
  945. {-INFINITY,
  946. INFINITY,
  947. -INFINITY,
  948. -0x1.921fb54442d18p-1},
  949. {INFINITY,
  950. -INFINITY,
  951. -INFINITY,
  952. 0x1.2d97c7f3321d2p+1},
  953. {-INFINITY,
  954. -INFINITY,
  955. -INFINITY,
  956. -0x1.2d97c7f3321d2p+1},
  957. {0x1.0000000000000p-1,
  958. INFINITY,
  959. 0x0.0000000000000p+0,
  960. 0x0.0000000000000p+0},
  961. {-0x1.0000000000000p-1,
  962. INFINITY,
  963. -0x0.0000000000000p+0,
  964. -0x0.0000000000000p+0},
  965. {0x1.0000000000000p-1,
  966. -INFINITY,
  967. -0x0.0000000000000p+0,
  968. 0x1.921fb54442d18p+1},
  969. {-0x1.199999999999ap-1,
  970. -INFINITY,
  971. 0x0.0000000000000p+0,
  972. -0x1.921fb54442d18p+1},
  973. {INFINITY,
  974. 0x1.70a3d70a3d70ap-4,
  975. 0x1.921fb54442d18p+0,
  976. 0x1.921fb54442d18p+0},
  977. {-INFINITY,
  978. -0x1.70a3d70a3d70ap-4,
  979. 0x1.921fb54442d18p+0,
  980. -0x1.921fb54442d18p+0},
  981. {0x1.8e45e1df3b015p+201,
  982. 0x1.0000000000000p-1,
  983. 0x1.921fb54442d18p+0,
  984. 0x1.921fb54442d18p+0},
  985. {0x1.011c2eaabe7d8p-197,
  986. 0x1.0000000000000p-1,
  987. 0x1.011c2eaabe7d8p-196,
  988. 0x1.011c2eaabe7d8p-196},
  989. {0x1.999999999999ap-2,
  990. 0x1.0000000000000p+0,
  991. 0x1.85a376b677dc0p-2,
  992. 0x1.85a376b677dc0p-2},
  993. {-0x1.3333333333333p-1,
  994. 0x0.0000000000000p+0,
  995. -0x1.921fb54442d18p+0,
  996. -0x1.921fb54442d18p+0},
  997. {-0x1.999999999999ap-3,
  998. 0x1.999999999999ap-3,
  999. -0x1.921fb54442d18p-1,
  1000. -0x1.921fb54442d18p-1},
  1001. {-0x1.999999999999ap-1,
  1002. -0x1.999999999999ap-1,
  1003. 0x1.921fb54442d18p-1,
  1004. -0x1.2d97c7f3321d2p+1},
  1005. };
  1006. MATH_EXP_DOUBLE TestExpDoubles[] = {
  1007. {INFINITY, INFINITY, INFINITY},
  1008. {-INFINITY, 0x0.0000000000000p+0, -0x1.0000000000000p+0},
  1009. {NAN, NAN, NAN},
  1010. {0x1.6300000000000p+9, INFINITY, INFINITY},
  1011. {0x1.9000000000000p+9, INFINITY, INFINITY},
  1012. {-0x1.6300000000000p+9, 0x0.33802fd28b3c3p-1022, -0x1.0000000000000p+0},
  1013. {-0x1.9000000000000p+9, 0x0.0000000000000p+0, -0x1.0000000000000p+0},
  1014. {0x1.6353f7ced9168p-2, 0x1.6a316dcd4cc00p+0, 0x1.a8c5b73532fffp-2},
  1015. {0x1.0a3d70a3d70a4p+0, 0x1.6a23c87af69e8p+1, 0x1.d44790f5ed3cfp+0},
  1016. {0x1.4000000000000p+3, 0x1.5829dcf950560p+14, 0x1.5825dcf950560p+14},
  1017. {0x1.9000000000000p+6, 0x1.3494a9b171bf5p+144, 0x1.3494a9b171bf5p+144},
  1018. {-0x1.7333333333334p+1, 0x1.c2c00e553650ap-5, -0x1.e3d3ff1aac9afp-1},
  1019. {0x1.921fb54442d18p+1, 0x1.724046eb09339p+4, 0x1.624046eb09339p+4},
  1020. {0x1.921fb54442d18p+0, 0x1.33dedc855935fp+2, 0x1.e7bdb90ab26bep+1},
  1021. {-0x1.921fb54442d18p+1, 0x1.620227b598efap-5, -0x1.e9dfdd84a6710p-1},
  1022. {-0x1.921fb54442d18p+0, 0x1.a9bcc46f767e0p-3, -0x1.9590cee422608p-1},
  1023. };
  1024. MATH_POWER_DOUBLE TestPowerDoubles[] = {
  1025. {0x1.f400000000000p+9,
  1026. 0x0.0000000000000p+0,
  1027. 0x1.0000000000000p+0,
  1028. 0x1.f400000000000p+9},
  1029. {INFINITY,
  1030. 0x0.0000000000000p+0,
  1031. 0x1.0000000000000p+0,
  1032. INFINITY},
  1033. {0x1.cb63b5c484765p+333,
  1034. 0x1.0000000000000p+0,
  1035. 0x1.cb63b5c484765p+333,
  1036. 0x1.cb63b5c484765p+333},
  1037. {0x1.0000000000000p+2,
  1038. NAN,
  1039. NAN,
  1040. NAN},
  1041. {NAN,
  1042. 0x1.8000000000000p+1,
  1043. NAN,
  1044. NAN},
  1045. {NAN,
  1046. 0x0.0000000000000p+0,
  1047. 0x1.0000000000000p+0,
  1048. NAN},
  1049. {0x1.0000000000000p+1,
  1050. INFINITY,
  1051. INFINITY,
  1052. INFINITY},
  1053. {0x1.0000000000000p+1,
  1054. -INFINITY,
  1055. 0x0.0000000000000p+0,
  1056. INFINITY},
  1057. {0x1.0000000000000p-1,
  1058. INFINITY,
  1059. 0x0.0000000000000p+0,
  1060. INFINITY},
  1061. {0x1.0000000000000p-1,
  1062. -INFINITY,
  1063. INFINITY,
  1064. INFINITY},
  1065. {0x0.0000000000000p+0,
  1066. 0x1.4000000000000p+5,
  1067. 0x0.0000000000000p+0,
  1068. 0x1.4000000000000p+5},
  1069. {-0x0.0000000000000p+0,
  1070. 0x1.4000000000000p+5,
  1071. 0x0.0000000000000p+0,
  1072. 0x1.4000000000000p+5},
  1073. {0x0.0000000000000p+0,
  1074. -0x1.4000000000000p+5,
  1075. INFINITY,
  1076. 0x1.4000000000000p+5},
  1077. {-0x0.0000000000000p+0,
  1078. -0x1.4000000000000p+5,
  1079. INFINITY,
  1080. 0x1.4000000000000p+5},
  1081. {-0x0.0000000000000p+0,
  1082. -0x1.8000000000000p+1,
  1083. -INFINITY,
  1084. 0x1.8000000000000p+1},
  1085. {INFINITY,
  1086. 0x1.3880000000000p+12,
  1087. INFINITY,
  1088. INFINITY},
  1089. {INFINITY,
  1090. 0x1.8000000000000p+1,
  1091. INFINITY,
  1092. INFINITY},
  1093. {-INFINITY,
  1094. 0x1.0000000000000p+2,
  1095. INFINITY,
  1096. INFINITY},
  1097. {-INFINITY,
  1098. -0x1.4000000000000p+2,
  1099. -0x0.0000000000000p+0,
  1100. INFINITY},
  1101. {-0x1.90ccccccccccdp+6,
  1102. 0x1.8000000000000p+2,
  1103. 0x1.d746f901e0627p+39,
  1104. 0x1.91849666040c0p+6},
  1105. {-0x1.8f03126e978d5p+5,
  1106. 0x1.8333333333333p+3,
  1107. -INFINITY,
  1108. 0x1.9a9600532dcc8p+5},
  1109. {-0x1.6b851eb851eb8p+5,
  1110. -0x1.999999999999ap-4,
  1111. -INFINITY,
  1112. 0x1.6b855868fa69ap+5},
  1113. {0x1.5957ae147ae14p+8,
  1114. -0x1.3333333333333p-2,
  1115. 0x1.62b1e4f3a7a67p-3,
  1116. 0x1.5957b69ea44c4p+8},
  1117. {0x1.e000000000000p+4,
  1118. 0x1.8000000000000p+2,
  1119. 0x1.5b9d420000000p+29,
  1120. 0x1.e98180e9b47f2p+4},
  1121. {0x1.000053e2d6239p+1,
  1122. 0x1.638e368f08462p+2,
  1123. 0x1.7843287f61601p+5,
  1124. 0x1.79e4de9b4f1a1p+2},
  1125. {0x1.a87c262151e1ap+250,
  1126. 0x1.3333333333333p-1,
  1127. 0x1.5abf5dbab253dp+150,
  1128. 0x1.a87c262151e1ap+250},
  1129. {0x1.59fe000000000p+16,
  1130. 0x1.0000000000000p-1,
  1131. 0x1.299d24dd6b5bfp+8,
  1132. 0x1.59fe000017ad4p+16},
  1133. {0x1.3400000000000p+6,
  1134. 0x1.0000000000000p+1,
  1135. 0x1.7290000000000p+12,
  1136. 0x1.341a97c97b75ep+6},
  1137. {-0x1.d400000000000p+7,
  1138. 0x1.8000000000000p+1,
  1139. -0x1.8704d00000000p+23,
  1140. 0x1.d409d88306798p+7},
  1141. {-0x1.2000000000000p+3,
  1142. 0x1.0000000000000p+2,
  1143. 0x1.9a10000000000p+12,
  1144. 0x1.3b29d7d635662p+3},
  1145. {0x1.13d73cbe1ff08p-99,
  1146. 0x1.999999999999ap-4,
  1147. 0x1.146e057a2535ep-10,
  1148. 0x1.999999999999ap-4},
  1149. {0x1.c8571c4687a3dp-20,
  1150. 0x1.c000000000000p+2,
  1151. 0x1.c98afc1f5b24fp-135,
  1152. 0x1.c0000000000e9p+2},
  1153. };
  1154. MATH_LOGARITHM_DOUBLE TestLogarithmDoubles[] = {
  1155. {0x1.921fb54442d18p-1,
  1156. -0x1.eeb95b094c193p-3,
  1157. -0x1.64de32d9c8824p-2,
  1158. -0x1.adb63b88d410dp-4},
  1159. {0x1.921fb54442d18p+1,
  1160. 0x1.250d048e7a1bdp+0,
  1161. 0x1.a6c873498ddf7p+0,
  1162. 0x1.fd14db31ba3bbp-2},
  1163. {0x1.f6a7a2955385ep+1,
  1164. 0x1.5e2cf41daf501p+0,
  1165. 0x1.f9325478c24dap+0,
  1166. 0x1.30289e09e9adfp-1},
  1167. {0x1.921fb54442d18p+2,
  1168. 0x1.d67f1c864beb4p+0,
  1169. 0x1.536439a4c6efcp+1,
  1170. 0x1.98ab081dd8eddp-1},
  1171. {0x1.f6a7a2955385ep+1,
  1172. 0x1.5e2cf41daf501p+0,
  1173. 0x1.f9325478c24dap+0,
  1174. 0x1.30289e09e9adfp-1},
  1175. {0x1.5fdbbe9bba775p+2,
  1176. 0x1.b44fff81fc225p+0,
  1177. 0x1.3abba19a07328p+1,
  1178. 0x1.7af9e9467241ep-1},
  1179. {0x1.0000000000000p-3,
  1180. -0x1.0a2b23f3bab73p+1,
  1181. -0x1.8000000000000p+1,
  1182. -0x1.ce61cf8ef36fep-1},
  1183. {0x1.945b6c3760bf6p-7,
  1184. -0x1.1946317db0637p+2,
  1185. -0x1.95cafa5fa6281p+2,
  1186. -0x1.e89f91d778ae6p+0},
  1187. {0x1.c560c7c0f4517p-9,
  1188. -0x1.6aac7430f596bp+2,
  1189. -0x1.059d1dd8afe53p+3,
  1190. -0x1.3b03ab00fe665p+1},
  1191. {0x1.ba35f15394d29p-11,
  1192. -0x1.c4fe1d616c20fp+2,
  1193. -0x1.46c3de8d48d75p+3,
  1194. -0x1.8976e330c38bcp+1},
  1195. {0x1.4000000000000p+3,
  1196. 0x1.26bb1bbb55516p+1,
  1197. 0x1.a934f0979a371p+1,
  1198. 0x1.0000000000000p+0},
  1199. {0x1.9000000000000p+6,
  1200. 0x1.26bb1bbb55516p+2,
  1201. 0x1.a934f0979a371p+2,
  1202. 0x1.0000000000000p+1},
  1203. {0x1.f400000000000p+9,
  1204. 0x1.ba18a998fffa0p+2,
  1205. 0x1.3ee7b471b3a95p+3,
  1206. 0x1.8000000000000p+1},
  1207. {0x1.86a0000000000p+16,
  1208. 0x1.7069e2aa2aa5bp+3,
  1209. 0x1.09c1165ec0627p+4,
  1210. 0x1.4000000000000p+2},
  1211. {0x1.24f8000000000p+18,
  1212. 0x1.9391b79f84abcp+3,
  1213. 0x1.231d1802601fdp+4,
  1214. 0x1.5e8927964fd60p+2},
  1215. {0x1.2a05f20000000p+33,
  1216. 0x1.7069e2aa2aa5bp+4,
  1217. 0x1.09c1165ec0627p+5,
  1218. 0x1.4000000000000p+3},
  1219. {0x1.c6bf526340000p+49,
  1220. 0x1.144f69ff9ffc4p+5,
  1221. 0x1.8ea1a18e2093ap+5,
  1222. 0x1.e000000000000p+3},
  1223. {0x1.5af1d78b58c40p+66,
  1224. 0x1.7069e2aa2aa5bp+5,
  1225. 0x1.09c1165ec0627p+6,
  1226. 0x1.4000000000000p+4},
  1227. {0x1.08b2a2c280291p+83,
  1228. 0x1.cc845b54b54f2p+5,
  1229. 0x1.4c315bf6707b1p+6,
  1230. 0x1.9000000000000p+4},
  1231. {0x1.93e5939a08ceap+99,
  1232. 0x1.144f69ff9ffc4p+6,
  1233. 0x1.8ea1a18e2093ap+6,
  1234. 0x1.e000000000000p+4},
  1235. {0x1.3426172c74d82p+116,
  1236. 0x1.425ca654e5510p+6,
  1237. 0x1.d111e725d0ac4p+6,
  1238. 0x1.1800000000000p+5},
  1239. {0x1.d6329f1c35ca5p+132,
  1240. 0x1.7069e2aa2aa5bp+6,
  1241. 0x1.09c1165ec0627p+7,
  1242. 0x1.4000000000000p+5},
  1243. {0x1.11b0ec57e649ap+166,
  1244. 0x1.cc845b54b54f2p+6,
  1245. 0x1.4c315bf6707b1p+7,
  1246. 0x1.9000000000000p+5},
  1247. {0x1.1afd6ec0e1411p+249,
  1248. 0x1.5963447f87fb5p+7,
  1249. 0x1.f24a09f1a8b89p+7,
  1250. 0x1.2c00000000000p+6},
  1251. {0x1.249ad2594c37dp+332,
  1252. 0x1.cc845b54b54f2p+7,
  1253. 0x1.4c315bf6707b1p+8,
  1254. 0x1.9000000000000p+6},
  1255. {0x1.38d352e5096afp+498,
  1256. 0x1.5963447f87fb5p+8,
  1257. 0x1.f24a09f1a8b89p+8,
  1258. 0x1.2c00000000000p+7},
  1259. {0x1.4f8b588e368f1p-17,
  1260. -0x1.7069e2aa2aa5bp+3,
  1261. -0x1.09c1165ec0627p+4,
  1262. -0x1.4000000000000p+2},
  1263. {0x1.b7cdfd9d7bdbbp-34,
  1264. -0x1.7069e2aa2aa5bp+4,
  1265. -0x1.09c1165ec0627p+5,
  1266. -0x1.4000000000000p+3},
  1267. {0x1.203af9ee75616p-50,
  1268. -0x1.144f69ff9ffc4p+5,
  1269. -0x1.8ea1a18e2093ap+5,
  1270. -0x1.e000000000000p+3},
  1271. {0x1.79ca10c924223p-67,
  1272. -0x1.7069e2aa2aa5bp+5,
  1273. -0x1.09c1165ec0627p+6,
  1274. -0x1.4000000000000p+4},
  1275. {0x1.cdef9d8000000p+34,
  1276. 0x1.82841bc3e2523p+4,
  1277. 0x1.16cff9021f59ap+5,
  1278. 0x1.4fb93c28b0cfdp+3},
  1279. {0x1.6bcc41e900000p+51,
  1280. 0x1.1d9d8c02a36fap+5,
  1281. 0x1.9c0e5284a6f03p+5,
  1282. 0x1.f02a30498eb10p+3},
  1283. {0x1.1e3ab8395c6e8p+68,
  1284. 0x1.79f709e34b097p+5,
  1285. 0x1.10a4e480eeaebp+6,
  1286. 0x1.484bd545e4bafp+4},
  1287. {0x1.c1fc7b177378fp+84,
  1288. 0x1.d64ea61ab9080p+5,
  1289. 0x1.5341444d9ecdap+6,
  1290. 0x1.9880f009735c1p+4},
  1291. {0x1.6168e126c7b4dp+101,
  1292. 0x1.19523e4b4d4bap+6,
  1293. 0x1.95dc5ccdca95cp+6,
  1294. 0x1.e8b480b19487ap+4},
  1295. {0x1.15557b419c5c2p+118,
  1296. 0x1.477c53741fb67p+6,
  1297. 0x1.d8764072e3b94p+6,
  1298. 0x1.1c734eb9bbd40p+5},
  1299. {0x1.b2eed32d4b5b2p+134,
  1300. 0x1.75a59e436d5f0p+6,
  1301. 0x1.0d87801518cd4p+7,
  1302. 0x1.448bad5873304p+5},
  1303. {0x1.0401ad53812c5p+168,
  1304. 0x1.d1db65d9bc456p+6,
  1305. 0x1.500b788ef61bdp+7,
  1306. 0x1.94a3659511cfdp+5},
  1307. {0x1.13ea4bfc0ed2bp+251,
  1308. 0x1.5c1c166abca98p+7,
  1309. 0x1.f637566ca2bffp+7,
  1310. 0x1.2e5d400a5401fp+6},
  1311. {0x1.0000000000000p+0,
  1312. 0x0.0000000000000p+0,
  1313. 0x0.0000000000000p+0,
  1314. 0x0.0000000000000p+0},
  1315. {0x1.0000000000000p+1,
  1316. 0x1.62e42fefa39efp-1,
  1317. 0x1.0000000000000p+0,
  1318. 0x1.34413509f79ffp-2},
  1319. {0x1.8000000000000p+1,
  1320. 0x1.193ea7aad030bp+0,
  1321. 0x1.95c01a39fbd68p+0,
  1322. 0x1.e8927964fd5fdp-2},
  1323. {0x1.22ad962000000p+27,
  1324. 0x1.2d78e26ae18e8p+4,
  1325. 0x1.b2eeb55d7c2d7p+4,
  1326. 0x1.05dafd7670640p+3},
  1327. {0x1.9000000000000p+4,
  1328. 0x1.9c041f7ed8d33p+1,
  1329. 0x1.2934f0979a371p+2,
  1330. 0x1.65df657b04301p+0},
  1331. {0x1.fae147ae147aep-1,
  1332. -0x1.495453e6fd4bcp-7,
  1333. -0x1.db1f34d2c386dp-7,
  1334. -0x1.1e0d4874f92f2p-8},
  1335. {-0x1.0000000000000p+0,
  1336. -INFINITY,
  1337. -INFINITY,
  1338. -INFINITY},
  1339. {INFINITY,
  1340. INFINITY,
  1341. INFINITY,
  1342. INFINITY},
  1343. {-INFINITY,
  1344. -INFINITY,
  1345. -INFINITY,
  1346. -INFINITY},
  1347. {NAN,
  1348. NAN,
  1349. NAN,
  1350. NAN},
  1351. };
  1352. MATH_DECOMPOSITION_DOUBLE TestDecompositionDoubles[] = {
  1353. {0x1.921fb54442d18p-1, 0x0.0000000000000p+0, 0x1.921fb54442d18p-1},
  1354. {0x1.921fb54442d18p+1, 0x1.8000000000000p+1, 0x1.21fb54442d180p-3},
  1355. {0x1.f6a7a2955385ep+1, 0x1.8000000000000p+1, 0x1.da9e8a554e178p-1},
  1356. {0x1.921fb54442d18p+2, 0x1.8000000000000p+2, 0x1.21fb54442d180p-2},
  1357. {0x1.f6a7a2955385ep+1, 0x1.8000000000000p+1, 0x1.da9e8a554e178p-1},
  1358. {0x1.5fdbbe9bba775p+2, 0x1.4000000000000p+2, 0x1.fdbbe9bba7750p-2},
  1359. {0x1.0000000000000p-3, 0x0.0000000000000p+0, 0x1.0000000000000p-3},
  1360. {0x1.945b6c3760bf6p-7, 0x0.0000000000000p+0, 0x1.945b6c3760bf6p-7},
  1361. {0x1.c560c7c0f4517p-9, 0x0.0000000000000p+0, 0x1.c560c7c0f4517p-9},
  1362. {0x1.ba35f15394d29p-11, 0x0.0000000000000p+0, 0x1.ba35f15394d29p-11},
  1363. {0x1.4000000000000p+3, 0x1.4000000000000p+3, 0x0.0000000000000p+0},
  1364. {0x1.24f8000000000p+18, 0x1.24f8000000000p+18, 0x0.0000000000000p+0},
  1365. {0x1.4f8b588e368f1p-17, 0x0.0000000000000p+0, 0x1.4f8b588e368f1p-17},
  1366. {0x1.b7cdfd9d7bdbbp-34, 0x0.0000000000000p+0, 0x1.b7cdfd9d7bdbbp-34},
  1367. {0x1.203af9ee75616p-50, 0x0.0000000000000p+0, 0x1.203af9ee75616p-50},
  1368. {0x1.79ca10c924223p-67, 0x0.0000000000000p+0, 0x1.79ca10c924223p-67},
  1369. {0x1.cdef9d8000000p+34, 0x1.cdef9d8000000p+34, 0x0.0000000000000p+0},
  1370. {0x1.6bcc41e900000p+51, 0x1.6bcc41e900000p+51, 0x0.0000000000000p+0},
  1371. {0x1.1e3ab8395c6e8p+68, 0x1.1e3ab8395c6e8p+68, 0x0.0000000000000p+0},
  1372. {0x1.c1fc7b177378fp+84, 0x1.c1fc7b177378fp+84, 0x0.0000000000000p+0},
  1373. {0x1.6168e126c7b4dp+101, 0x1.6168e126c7b4dp+101, 0x0.0000000000000p+0},
  1374. {0x1.15557b419c5c2p+118, 0x1.15557b419c5c2p+118, 0x0.0000000000000p+0},
  1375. {0x1.b2eed32d4b5b2p+134, 0x1.b2eed32d4b5b2p+134, 0x0.0000000000000p+0},
  1376. {0x1.0401ad53812c5p+168, 0x1.0401ad53812c5p+168, 0x0.0000000000000p+0},
  1377. {0x1.13ea4bfc0ed2bp+251, 0x1.13ea4bfc0ed2bp+251, 0x0.0000000000000p+0},
  1378. {0x1.249ad2594c37dp+332, 0x1.249ad2594c37dp+332, 0x0.0000000000000p+0},
  1379. {0x1.38d352e5096afp+498, 0x1.38d352e5096afp+498, 0x0.0000000000000p+0},
  1380. {0x1.0000000000000p+0, 0x1.0000000000000p+0, 0x0.0000000000000p+0},
  1381. {0x1.0000000000000p+1, 0x1.0000000000000p+1, 0x0.0000000000000p+0},
  1382. {0x1.8000000000000p+1, 0x1.8000000000000p+1, 0x0.0000000000000p+0},
  1383. {0x1.22ad962000000p+27, 0x1.22ad962000000p+27, 0x0.0000000000000p+0},
  1384. {0x1.9000000000000p+4, 0x1.9000000000000p+4, 0x0.0000000000000p+0},
  1385. {0x1.fae147ae147aep-1, 0x0.0000000000000p+0, 0x1.fae147ae147aep-1},
  1386. {-0x1.0000000000000p+0, -0x1.0000000000000p+0, -0x0.0000000000000p+0},
  1387. {-0x1.999999999999ap-4, -0x0.0000000000000p+0, -0x1.999999999999ap-4},
  1388. {-0x1.0bb448ec2f608p+70, -0x1.0bb448ec2f608p+70, -0x0.0000000000000p+0},
  1389. {0x1.fe9af5b6bcbd4p+89, 0x1.fe9af5b6bcbd4p+89, 0x0.0000000000000p+0},
  1390. {0x1.12210f47de981p+60, 0x1.12210f47de981p+60, 0x0.0000000000000p+0},
  1391. {0x1.7c6e3bfd70fdep+116, 0x1.7c6e3bfd70fdep+116, 0x0.0000000000000p+0},
  1392. {0x1.b1ae4d6e2ef50p+69, 0x1.b1ae4d6e2ef50p+69, 0x0.0000000000000p+0},
  1393. {0x1.9d971e4fe8402p+89, 0x1.9d971e4fe8402p+89, 0x0.0000000000000p+0},
  1394. {0x1.3426172c74d82p+116, 0x1.3426172c74d82p+116, 0x0.0000000000000p+0},
  1395. {INFINITY, INFINITY, 0x0.0000000000000p+0},
  1396. {-INFINITY, -INFINITY, -0x0.0000000000000p+0},
  1397. {NAN, NAN, NAN},
  1398. };
  1399. MATH_CEILING_FLOOR_DOUBLE_VALUE TestCeilingFloorDoubles[] = {
  1400. {-0x1.1000000000000p+5,
  1401. -0x1.1000000000000p+5,
  1402. -0x1.1000000000000p+5},
  1403. {-0x1.059999999999ap+5,
  1404. -0x1.0000000000000p+5,
  1405. -0x1.0800000000000p+5},
  1406. {-0x1.f666666666666p+4,
  1407. -0x1.f000000000000p+4,
  1408. -0x1.0000000000000p+5},
  1409. {-0x1.e19999999999ap+4,
  1410. -0x1.e000000000000p+4,
  1411. -0x1.f000000000000p+4},
  1412. {-0x1.ccccccccccccdp+4,
  1413. -0x1.c000000000000p+4,
  1414. -0x1.d000000000000p+4},
  1415. {-0x1.b800000000000p+4,
  1416. -0x1.b000000000000p+4,
  1417. -0x1.c000000000000p+4},
  1418. {-0x1.a333333333333p+4,
  1419. -0x1.a000000000000p+4,
  1420. -0x1.b000000000000p+4},
  1421. {-0x1.8e66666666666p+4,
  1422. -0x1.8000000000000p+4,
  1423. -0x1.9000000000000p+4},
  1424. {-0x1.799999999999ap+4,
  1425. -0x1.7000000000000p+4,
  1426. -0x1.8000000000000p+4},
  1427. {-0x1.64ccccccccccdp+4,
  1428. -0x1.6000000000000p+4,
  1429. -0x1.7000000000000p+4},
  1430. {-0x1.5000000000000p+4,
  1431. -0x1.5000000000000p+4,
  1432. -0x1.5000000000000p+4},
  1433. {-0x1.3b33333333333p+4,
  1434. -0x1.3000000000000p+4,
  1435. -0x1.4000000000000p+4},
  1436. {-0x1.2666666666666p+4,
  1437. -0x1.2000000000000p+4,
  1438. -0x1.3000000000000p+4},
  1439. {-0x1.1199999999999p+4,
  1440. -0x1.1000000000000p+4,
  1441. -0x1.2000000000000p+4},
  1442. {-0x1.f999999999999p+3,
  1443. -0x1.e000000000000p+3,
  1444. -0x1.0000000000000p+4},
  1445. {-0x1.d000000000000p+3,
  1446. -0x1.c000000000000p+3,
  1447. -0x1.e000000000000p+3},
  1448. {-0x1.a666666666666p+3,
  1449. -0x1.a000000000000p+3,
  1450. -0x1.c000000000000p+3},
  1451. {-0x1.7ccccccccccccp+3,
  1452. -0x1.6000000000000p+3,
  1453. -0x1.8000000000000p+3},
  1454. {-0x1.5333333333333p+3,
  1455. -0x1.4000000000000p+3,
  1456. -0x1.6000000000000p+3},
  1457. {-0x1.2999999999999p+3,
  1458. -0x1.2000000000000p+3,
  1459. -0x1.4000000000000p+3},
  1460. {-0x1.fffffffffffffp+2,
  1461. -0x1.c000000000000p+2,
  1462. -0x1.0000000000000p+3},
  1463. {-0x1.accccccccccccp+2,
  1464. -0x1.8000000000000p+2,
  1465. -0x1.c000000000000p+2},
  1466. {-0x1.5999999999998p+2,
  1467. -0x1.4000000000000p+2,
  1468. -0x1.8000000000000p+2},
  1469. {-0x1.0666666666665p+2,
  1470. -0x1.0000000000000p+2,
  1471. -0x1.4000000000000p+2},
  1472. {-0x1.6666666666664p+1,
  1473. -0x1.0000000000000p+1,
  1474. -0x1.8000000000000p+1},
  1475. {-0x1.7fffffffffffbp+0,
  1476. -0x1.0000000000000p+0,
  1477. -0x1.0000000000000p+1},
  1478. {-0x1.9999999999970p-3,
  1479. -0x0.0000000000000p+0,
  1480. -0x1.0000000000000p+0},
  1481. {0x1.199999999999fp+0,
  1482. 0x1.0000000000000p+1,
  1483. 0x1.0000000000000p+0},
  1484. {0x1.3333333333336p+1,
  1485. 0x1.8000000000000p+1,
  1486. 0x1.0000000000000p+1},
  1487. {0x1.d99999999999cp+1,
  1488. 0x1.0000000000000p+2,
  1489. 0x1.8000000000000p+1},
  1490. {0x1.4000000000002p+2,
  1491. 0x1.8000000000000p+2,
  1492. 0x1.4000000000000p+2},
  1493. {0x1.9333333333335p+2,
  1494. 0x1.c000000000000p+2,
  1495. 0x1.8000000000000p+2},
  1496. {0x1.e666666666668p+2,
  1497. 0x1.0000000000000p+3,
  1498. 0x1.c000000000000p+2},
  1499. {0x1.1cccccccccccep+3,
  1500. 0x1.2000000000000p+3,
  1501. 0x1.0000000000000p+3},
  1502. {0x1.4666666666667p+3,
  1503. 0x1.6000000000000p+3,
  1504. 0x1.4000000000000p+3},
  1505. {0x1.7000000000001p+3,
  1506. 0x1.8000000000000p+3,
  1507. 0x1.6000000000000p+3},
  1508. {0x1.999999999999ap+3,
  1509. 0x1.a000000000000p+3,
  1510. 0x1.8000000000000p+3},
  1511. {0x1.c333333333334p+3,
  1512. 0x1.e000000000000p+3,
  1513. 0x1.c000000000000p+3},
  1514. {0x1.ecccccccccccep+3,
  1515. 0x1.0000000000000p+4,
  1516. 0x1.e000000000000p+3},
  1517. {0x1.0b33333333334p+4,
  1518. 0x1.1000000000000p+4,
  1519. 0x1.0000000000000p+4},
  1520. {0x1.2000000000000p+4,
  1521. 0x1.2000000000000p+4,
  1522. 0x1.2000000000000p+4},
  1523. {0x1.34ccccccccccdp+4,
  1524. 0x1.4000000000000p+4,
  1525. 0x1.3000000000000p+4},
  1526. {0x1.499999999999ap+4,
  1527. 0x1.5000000000000p+4,
  1528. 0x1.4000000000000p+4},
  1529. {0x1.5e66666666667p+4,
  1530. 0x1.6000000000000p+4,
  1531. 0x1.5000000000000p+4},
  1532. {0x1.7333333333334p+4,
  1533. 0x1.8000000000000p+4,
  1534. 0x1.7000000000000p+4},
  1535. {0x1.8800000000001p+4,
  1536. 0x1.9000000000000p+4,
  1537. 0x1.8000000000000p+4},
  1538. {0x1.9cccccccccccdp+4,
  1539. 0x1.a000000000000p+4,
  1540. 0x1.9000000000000p+4},
  1541. {0x1.b19999999999ap+4,
  1542. 0x1.c000000000000p+4,
  1543. 0x1.b000000000000p+4},
  1544. {0x1.c666666666667p+4,
  1545. 0x1.d000000000000p+4,
  1546. 0x1.c000000000000p+4},
  1547. {0x1.db33333333334p+4,
  1548. 0x1.e000000000000p+4,
  1549. 0x1.d000000000000p+4},
  1550. {0x1.f000000000001p+4,
  1551. 0x1.0000000000000p+5,
  1552. 0x1.f000000000000p+4},
  1553. {0x1.0266666666667p+5,
  1554. 0x1.0800000000000p+5,
  1555. 0x1.0000000000000p+5},
  1556. {0x1.0cccccccccccdp+5,
  1557. 0x1.1000000000000p+5,
  1558. 0x1.0800000000000p+5},
  1559. };
  1560. MATH_MODULO_DOUBLE_VALUE TestModuloDoubles[] = {
  1561. {0x0.0000000000000p+0,
  1562. -0x0.0000000000000p+0,
  1563. -INFINITY},
  1564. {0x0.0000000000000p+0,
  1565. -0x1.0000000000000p+0,
  1566. 0x0.0000000000000p+0},
  1567. {-0x0.0000000000000p+0,
  1568. -0x1.0000000000000p+0,
  1569. -0x0.0000000000000p+0},
  1570. {0x1.199999999999ap+0,
  1571. 0x1.8422737df88fap-114,
  1572. 0x1.33f2269b346c2p-114},
  1573. {-0x1.8800000000000p+6,
  1574. 0x1.8c00000000000p+6,
  1575. -0x1.8800000000000p+6},
  1576. {0x1.9000000000000p+6,
  1577. 0x1.4000000000000p+3,
  1578. 0x0.0000000000000p+0},
  1579. {0x1.4000000000000p+3,
  1580. 0x1.999999999999ap-4,
  1581. 0x1.9999999999972p-4},
  1582. {0x1.9d3f427d3f994p+216,
  1583. -0x1.151b071b1392ap+832,
  1584. 0x1.9d3f427d3f994p+216},
  1585. {0x1.eba390bc6d0c6p+832,
  1586. 0x1.0000000000000p+2,
  1587. 0x0.0000000000000p+0},
  1588. {0x1.0624dd2f1a9fcp-10,
  1589. 0x1.0624dd2f1a9fcp-10,
  1590. 0x0.0000000000000p+0},
  1591. {0x1.8000000000000p+2,
  1592. 0x1.0000000000000p+1,
  1593. 0x0.0000000000000p+0},
  1594. {-0x1.921fb54442d18p+1,
  1595. -0x1.0000000000000p+1,
  1596. -0x1.243f6a8885a30p+0},
  1597. {INFINITY,
  1598. -INFINITY,
  1599. -INFINITY},
  1600. {NAN,
  1601. INFINITY,
  1602. NAN},
  1603. {NAN,
  1604. NAN,
  1605. NAN},
  1606. {INFINITY,
  1607. NAN,
  1608. NAN},
  1609. };
  1610. //
  1611. // ------------------------------------------------------------------ Functions
  1612. //
  1613. ULONG
  1614. TestMath (
  1615. VOID
  1616. )
  1617. /*++
  1618. Routine Description:
  1619. This routine implements the entry point for the C library math test.
  1620. Arguments:
  1621. None.
  1622. Return Value:
  1623. Returns the count of test failures.
  1624. --*/
  1625. {
  1626. ULONG Failures;
  1627. Failures = 0;
  1628. Failures += TestBasicTrigonometry();
  1629. Failures += TestSquareRoot();
  1630. Failures += TestArcTrigonometry();
  1631. Failures += TestExponentiation();
  1632. Failures += TestPower();
  1633. Failures += TestLogarithm();
  1634. Failures += TestDecomposition();
  1635. Failures += TestCeilingAndFloor();
  1636. Failures += TestModulo();
  1637. return Failures;
  1638. }
  1639. //
  1640. // --------------------------------------------------------- Internal Functions
  1641. //
  1642. ULONG
  1643. TestBasicTrigonometry (
  1644. VOID
  1645. )
  1646. /*++
  1647. Routine Description:
  1648. This routine test the basic trig routines: sine, cosine, and tangent.
  1649. Arguments:
  1650. None.
  1651. Return Value:
  1652. Returns the count of test failures.
  1653. --*/
  1654. {
  1655. volatile double Cosine;
  1656. ULONG Failures;
  1657. volatile double HyperbolicCosine;
  1658. volatile double HyperbolicSine;
  1659. volatile double HyperbolicTangent;
  1660. volatile double Sine;
  1661. volatile double Tangent;
  1662. PMATH_TRIG_DOUBLE_VALUE Test;
  1663. ULONG TestIndex;
  1664. ULONG ValueCount;
  1665. Failures = 0;
  1666. ValueCount = sizeof(TestBasicTrigonometryDoubles) /
  1667. sizeof(TestBasicTrigonometryDoubles[0]);
  1668. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1669. Test = &(TestBasicTrigonometryDoubles[TestIndex]);
  1670. Sine = sin(Test->Argument);
  1671. Cosine = cos(Test->Argument);
  1672. if (TestCompareResults(Sine, Test->Sine) == FALSE) {
  1673. printf("sin(%.13a) was %.13a, should have been %.13a. Diff %.13a\n",
  1674. Test->Argument,
  1675. Sine,
  1676. Test->Sine,
  1677. Sine - Test->Sine);
  1678. Failures += 1;
  1679. }
  1680. if (TestCompareResults(Cosine, Test->Cosine) == FALSE) {
  1681. printf("cos(%.13a) was %.13a, should have been %.13a.\n",
  1682. Test->Argument,
  1683. Cosine,
  1684. Test->Cosine);
  1685. Failures += 1;
  1686. }
  1687. Tangent = tan(Test->Argument);
  1688. if (TestCompareResults(Tangent, Test->Tangent) == FALSE) {
  1689. printf("tan(%.13a) was %.13a, should have been %.13a.\n",
  1690. Test->Argument,
  1691. Tangent,
  1692. Test->Tangent);
  1693. Failures += 1;
  1694. }
  1695. HyperbolicSine = sinh(Test->Argument);
  1696. HyperbolicCosine = cosh(Test->Argument);
  1697. HyperbolicTangent = tanh(Test->Argument);
  1698. if (TestCompareResults(HyperbolicSine, Test->HyperbolicSine) == FALSE) {
  1699. printf("sinh(%.13a) was %.13a, should have been %.13a. "
  1700. "Diff %.13a\n",
  1701. Test->Argument,
  1702. HyperbolicSine,
  1703. Test->HyperbolicSine,
  1704. HyperbolicSine - Test->HyperbolicSine);
  1705. Failures += 1;
  1706. }
  1707. if (TestCompareResults(HyperbolicCosine,
  1708. Test->HyperbolicCosine) == FALSE) {
  1709. printf("cosh(%.13a) was %.13a, should have been %.13a.\n",
  1710. Test->Argument,
  1711. HyperbolicCosine,
  1712. Test->HyperbolicCosine);
  1713. Failures += 1;
  1714. }
  1715. if (TestCompareResults(HyperbolicTangent,
  1716. Test->HyperbolicTangent) == FALSE) {
  1717. printf("tanh(%.13a) was %.13a, should have been %.13a.\n",
  1718. Test->Argument,
  1719. HyperbolicTangent,
  1720. Test->HyperbolicTangent);
  1721. Failures += 1;
  1722. }
  1723. }
  1724. return Failures;
  1725. }
  1726. ULONG
  1727. TestSquareRoot (
  1728. VOID
  1729. )
  1730. /*++
  1731. Routine Description:
  1732. This routine test the square root function.
  1733. Arguments:
  1734. None.
  1735. Return Value:
  1736. Returns the count of test failures.
  1737. --*/
  1738. {
  1739. ULONG Failures;
  1740. volatile double SquareRoot;
  1741. PMATH_TEST_SQUARE_ROOT_DOUBLE_VALUE Test;
  1742. ULONG TestIndex;
  1743. ULONG ValueCount;
  1744. Failures = 0;
  1745. ValueCount = sizeof(TestSquareRootDoubles) /
  1746. sizeof(TestSquareRootDoubles[0]);
  1747. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1748. Test = &(TestSquareRootDoubles[TestIndex]);
  1749. SquareRoot = sqrt(Test->Argument);
  1750. if (TestCompareResults(SquareRoot, Test->SquareRoot) == FALSE) {
  1751. printf("sqrt(%.13a) was %.13a, should have been %.13a.\n",
  1752. Test->Argument,
  1753. SquareRoot,
  1754. Test->SquareRoot);
  1755. Failures += 1;
  1756. }
  1757. }
  1758. return Failures;
  1759. }
  1760. ULONG
  1761. TestArcTrigonometry (
  1762. VOID
  1763. )
  1764. /*++
  1765. Routine Description:
  1766. This routine test the inverse trig routines: arc sine, arc cosine, and
  1767. arc tangent.
  1768. Arguments:
  1769. None.
  1770. Return Value:
  1771. Returns the count of test failures.
  1772. --*/
  1773. {
  1774. volatile double ArcCosine;
  1775. volatile double ArcSine;
  1776. volatile double ArcTangent;
  1777. PMATH_ARC_TANGENT_DOUBLE ArcTangentTest;
  1778. ULONG Failures;
  1779. double Quotient;
  1780. PMATH_ARC_DOUBLE_VALUE Test;
  1781. ULONG TestIndex;
  1782. ULONG ValueCount;
  1783. Failures = 0;
  1784. ValueCount = sizeof(TestArcDoubles) /
  1785. sizeof(TestArcDoubles[0]);
  1786. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1787. Test = &(TestArcDoubles[TestIndex]);
  1788. ArcSine = asin(Test->Argument);
  1789. if (TestCompareResults(ArcSine, Test->ArcSine) == FALSE) {
  1790. printf("asin(%.13a) was %.13a, should have been %.13a.\n",
  1791. Test->Argument,
  1792. ArcSine,
  1793. Test->ArcSine);
  1794. Failures += 1;
  1795. }
  1796. ArcCosine = acos(Test->Argument);
  1797. if (TestCompareResults(ArcCosine, Test->ArcCosine) == FALSE) {
  1798. printf("acos(%.13a) was %.13a, should have been %.13a.\n",
  1799. Test->Argument,
  1800. ArcCosine,
  1801. Test->ArcCosine);
  1802. Failures += 1;
  1803. }
  1804. ArcTangent = atan(Test->Argument);
  1805. if (TestCompareResults(ArcTangent, Test->ArcTangent) == FALSE) {
  1806. printf("atan(%.13a) was %.13a, should have been %.13a.\n",
  1807. Test->Argument,
  1808. ArcTangent,
  1809. Test->ArcTangent);
  1810. Failures += 1;
  1811. }
  1812. }
  1813. //
  1814. // Test arc tangent 2.
  1815. //
  1816. ValueCount = sizeof(TestArcTangentDoubles) /
  1817. sizeof(TestArcTangentDoubles[0]);
  1818. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1819. ArcTangentTest = &(TestArcTangentDoubles[TestIndex]);
  1820. Quotient = ArcTangentTest->Numerator /
  1821. ArcTangentTest->Denominator;
  1822. ArcTangent = atan(Quotient);
  1823. if (TestCompareResults(ArcTangent,
  1824. ArcTangentTest->ArcTangent) == FALSE) {
  1825. printf("atan(%.13a) was %.13a, should have been %.13a.\n",
  1826. Quotient,
  1827. ArcTangent,
  1828. ArcTangentTest->ArcTangent);
  1829. Failures += 1;
  1830. }
  1831. ArcTangent = atan2(ArcTangentTest->Numerator,
  1832. ArcTangentTest->Denominator);
  1833. if (TestCompareResults(ArcTangent,
  1834. ArcTangentTest->ArcTangent2) == FALSE) {
  1835. printf("atan2(%.13a, %.13a) was %.13a, should have been %.13a.\n",
  1836. ArcTangentTest->Numerator,
  1837. ArcTangentTest->Denominator,
  1838. ArcTangent,
  1839. ArcTangentTest->ArcTangent2);
  1840. Failures += 1;
  1841. }
  1842. }
  1843. return Failures;
  1844. }
  1845. ULONG
  1846. TestExponentiation (
  1847. VOID
  1848. )
  1849. /*++
  1850. Routine Description:
  1851. This routine test the exponentiation (exp) function.
  1852. Arguments:
  1853. None.
  1854. Return Value:
  1855. Returns the count of test failures.
  1856. --*/
  1857. {
  1858. BOOL Equal;
  1859. volatile double Exponentiation;
  1860. volatile double ExponentiationMinusOne;
  1861. ULONG Failures;
  1862. PMATH_EXP_DOUBLE Test;
  1863. ULONG TestIndex;
  1864. ULONG ValueCount;
  1865. Failures = 0;
  1866. ValueCount = sizeof(TestExpDoubles) /
  1867. sizeof(TestExpDoubles[0]);
  1868. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1869. Test = &(TestExpDoubles[TestIndex]);
  1870. Exponentiation = exp(Test->Argument);
  1871. if (TestCompareResults(Exponentiation, Test->Exponentiation) == FALSE) {
  1872. printf("exp(%.13a) was %.13a, should have been %.13a.\n",
  1873. Test->Argument,
  1874. Exponentiation,
  1875. Test->Exponentiation);
  1876. Failures += 1;
  1877. }
  1878. ExponentiationMinusOne = expm1(Test->Argument);
  1879. Equal = TestCompareResults(ExponentiationMinusOne,
  1880. Test->ExponentiationMinusOne);
  1881. if (Equal == FALSE) {
  1882. printf("expm1(%.13a) was %.13a, should have been %.13a.\n",
  1883. Test->Argument,
  1884. ExponentiationMinusOne,
  1885. Test->ExponentiationMinusOne);
  1886. Failures += 1;
  1887. }
  1888. }
  1889. return Failures;
  1890. }
  1891. ULONG
  1892. TestPower (
  1893. VOID
  1894. )
  1895. /*++
  1896. Routine Description:
  1897. This routine test the power (pow) function.
  1898. Arguments:
  1899. None.
  1900. Return Value:
  1901. Returns the count of test failures.
  1902. --*/
  1903. {
  1904. ULONG Failures;
  1905. volatile double Hypotenuse;
  1906. volatile double RaisedValue;
  1907. PMATH_POWER_DOUBLE Test;
  1908. ULONG TestIndex;
  1909. ULONG ValueCount;
  1910. Failures = 0;
  1911. ValueCount = sizeof(TestPowerDoubles) /
  1912. sizeof(TestPowerDoubles[0]);
  1913. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1914. Test = &(TestPowerDoubles[TestIndex]);
  1915. RaisedValue = pow(Test->Value, Test->Exponent);
  1916. Hypotenuse = hypot(Test->Value, Test->Exponent);
  1917. if (TestCompareResults(RaisedValue, Test->Result) == FALSE) {
  1918. printf("pow(%.13a, %.13a) was %.13a, should have been %.13a.\n",
  1919. Test->Value,
  1920. Test->Exponent,
  1921. RaisedValue,
  1922. Test->Result);
  1923. Failures += 1;
  1924. }
  1925. if (TestCompareResults(Hypotenuse, Test->Hypotenuse) == FALSE) {
  1926. printf("hypot(%.13a, %.13a) was %.13a, should have been %.13a.\n",
  1927. Test->Value,
  1928. Test->Exponent,
  1929. Hypotenuse,
  1930. Test->Hypotenuse);
  1931. Failures += 1;
  1932. }
  1933. }
  1934. return Failures;
  1935. }
  1936. ULONG
  1937. TestLogarithm (
  1938. VOID
  1939. )
  1940. /*++
  1941. Routine Description:
  1942. This routine test the logarithm (log) function.
  1943. Arguments:
  1944. None.
  1945. Return Value:
  1946. Returns the count of test failures.
  1947. --*/
  1948. {
  1949. ULONG Failures;
  1950. volatile double Logarithm;
  1951. PMATH_LOGARITHM_DOUBLE Test;
  1952. ULONG TestIndex;
  1953. ULONG ValueCount;
  1954. Failures = 0;
  1955. ValueCount = sizeof(TestLogarithmDoubles) /
  1956. sizeof(TestLogarithmDoubles[0]);
  1957. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  1958. Test = &(TestLogarithmDoubles[TestIndex]);
  1959. Logarithm = log(Test->Argument);
  1960. if (TestCompareResults(Logarithm, Test->Logarithm) == FALSE) {
  1961. printf("log(%.13a) was %.13a, should have been %.13a.\n",
  1962. Test->Argument,
  1963. Logarithm,
  1964. Test->Logarithm);
  1965. Failures += 1;
  1966. }
  1967. Logarithm = log2(Test->Argument);
  1968. if (TestCompareResults(Logarithm, Test->Log2) == FALSE) {
  1969. printf("log2(%.13a) was %.13a, should have been %.13a.\n",
  1970. Test->Argument,
  1971. Logarithm,
  1972. Test->Log2);
  1973. Failures += 1;
  1974. }
  1975. Logarithm = log10(Test->Argument);
  1976. if (TestCompareResults(Logarithm, Test->Log10) == FALSE) {
  1977. printf("log10(%.13a) was %.13a, should have been %.13a.\n",
  1978. Test->Argument,
  1979. Logarithm,
  1980. Test->Log10);
  1981. Failures += 1;
  1982. }
  1983. }
  1984. return Failures;
  1985. }
  1986. ULONG
  1987. TestDecomposition (
  1988. VOID
  1989. )
  1990. /*++
  1991. Routine Description:
  1992. This routine test the logarithm (log) function.
  1993. Arguments:
  1994. None.
  1995. Return Value:
  1996. Returns the count of test failures.
  1997. --*/
  1998. {
  1999. ULONG Failures;
  2000. double FractionalPart;
  2001. double IntegerPart;
  2002. PMATH_DECOMPOSITION_DOUBLE Test;
  2003. ULONG TestIndex;
  2004. ULONG ValueCount;
  2005. Failures = 0;
  2006. ValueCount = sizeof(TestDecompositionDoubles) /
  2007. sizeof(TestDecompositionDoubles[0]);
  2008. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  2009. Test = &(TestDecompositionDoubles[TestIndex]);
  2010. FractionalPart = modf(Test->Argument, &IntegerPart);
  2011. if ((TestCompareResults(IntegerPart, Test->IntegerPart) == FALSE) ||
  2012. (TestCompareResults(FractionalPart, Test->FractionalPart) ==
  2013. FALSE)) {
  2014. printf("modf(%.13a) was {%.13a, %.13a} should have been "
  2015. "{%.13a, %.13a}.\n",
  2016. Test->Argument,
  2017. IntegerPart,
  2018. FractionalPart,
  2019. Test->IntegerPart,
  2020. Test->FractionalPart);
  2021. Failures += 1;
  2022. }
  2023. }
  2024. return Failures;
  2025. }
  2026. ULONG
  2027. TestCeilingAndFloor (
  2028. VOID
  2029. )
  2030. /*++
  2031. Routine Description:
  2032. This routine tests the ceiling (ceil) and floor functions.
  2033. Arguments:
  2034. None.
  2035. Return Value:
  2036. Returns the count of test failures.
  2037. --*/
  2038. {
  2039. volatile double Ceiling;
  2040. ULONG Failures;
  2041. volatile double Floor;
  2042. PMATH_CEILING_FLOOR_DOUBLE_VALUE Test;
  2043. ULONG TestIndex;
  2044. ULONG ValueCount;
  2045. Failures = 0;
  2046. ValueCount = sizeof(TestCeilingFloorDoubles) /
  2047. sizeof(TestCeilingFloorDoubles[0]);
  2048. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  2049. Test = &(TestCeilingFloorDoubles[TestIndex]);
  2050. Ceiling = ceil(Test->Argument);
  2051. Floor = floor(Test->Argument);
  2052. if (TestCompareResults(Ceiling, Test->Ceiling) == FALSE) {
  2053. printf("ceil(%.13a) was %.13a, should have been %.13a.\n",
  2054. Test->Argument,
  2055. Ceiling,
  2056. Test->Ceiling);
  2057. Failures += 1;
  2058. }
  2059. if (TestCompareResults(Floor, Test->Floor) == FALSE) {
  2060. printf("floor(%.13a) was %.13a, should have been %.13a.\n",
  2061. Test->Argument,
  2062. Floor,
  2063. Test->Floor);
  2064. Failures += 1;
  2065. }
  2066. }
  2067. return Failures;
  2068. }
  2069. ULONG
  2070. TestModulo (
  2071. VOID
  2072. )
  2073. /*++
  2074. Routine Description:
  2075. This routine tests the module (fmod) function.
  2076. Arguments:
  2077. None.
  2078. Return Value:
  2079. Returns the count of test failures.
  2080. --*/
  2081. {
  2082. ULONG Failures;
  2083. volatile double Remainder;
  2084. PMATH_MODULO_DOUBLE_VALUE Test;
  2085. ULONG TestIndex;
  2086. ULONG ValueCount;
  2087. Failures = 0;
  2088. ValueCount = sizeof(TestModuloDoubles) /
  2089. sizeof(TestModuloDoubles[0]);
  2090. for (TestIndex = 0; TestIndex < ValueCount; TestIndex += 1) {
  2091. Test = &(TestModuloDoubles[TestIndex]);
  2092. Remainder = fmod(Test->Numerator, Test->Denominator);
  2093. if (TestCompareResults(Remainder, Test->Remainder) == FALSE) {
  2094. printf("fmod(%.13a, %.13a) was %.13a, should have been %.13a.\n",
  2095. Test->Numerator,
  2096. Test->Denominator,
  2097. Remainder,
  2098. Test->Remainder);
  2099. Failures += 1;
  2100. }
  2101. }
  2102. return Failures;
  2103. }
  2104. BOOL
  2105. TestCompareResults (
  2106. double Value1,
  2107. double Value2
  2108. )
  2109. /*++
  2110. Routine Description:
  2111. This routine compares two double values, and returns whether or not they
  2112. are almost equal.
  2113. Arguments:
  2114. Value1 - Supplies the first value.
  2115. Value2 - Supplies the second value.
  2116. Return Value:
  2117. TRUE if the values are nearly equal.
  2118. FALSE if they are not equal.
  2119. --*/
  2120. {
  2121. LONG High1;
  2122. LONG High2;
  2123. LONG LowDifference;
  2124. DOUBLE_PARTS Parts1;
  2125. DOUBLE_PARTS Parts2;
  2126. ULONG SignMask;
  2127. SignMask = DOUBLE_SIGN_BIT >> DOUBLE_HIGH_WORD_SHIFT;
  2128. Parts1.Double = Value1;
  2129. Parts2.Double = Value2;
  2130. High1 = Parts1.Ulong.High;
  2131. High2 = Parts2.Ulong.High;
  2132. if (((High1 ^ High2) & SignMask) != 0) {
  2133. return FALSE;
  2134. }
  2135. if ((High1 & ~SignMask) >= NAN_HIGH_WORD) {
  2136. if ((High2 & ~SignMask) >= NAN_HIGH_WORD) {
  2137. return TRUE;
  2138. }
  2139. return FALSE;
  2140. }
  2141. if (High1 != High2) {
  2142. return FALSE;
  2143. }
  2144. LowDifference = Parts1.Ulong.Low - Parts2.Ulong.Low;
  2145. if (LowDifference < 0) {
  2146. LowDifference = -LowDifference;
  2147. }
  2148. if (LowDifference < MATH_RESULT_SLOP) {
  2149. return TRUE;
  2150. }
  2151. return FALSE;
  2152. }