[libc] Fix Off By One Errors In Printf Long Double (#66957)

Two major off-by-one errors are fixed in this patch. The first is in
float_to_string.h with length_for_num, which wasn't accounting for the
implicit leading bit when calculating the length of a number, causing
a missing digit on 80 bit float max. The other off-by-one is the
ryu_long_double_constants.h (a.k.a the Mega Table) not having any
entries for the last POW10_OFFSET in POW10_SPLIT. This was also found on
80 bit float max. Finally, the integer calculation mode was using a
slightly too short integer, again on 80 bit float max, not accounting
for the mantissa width. All of these are fixed in this patch.
This commit is contained in:
michaelrj-google 2023-09-21 11:43:29 -07:00 committed by GitHub
parent 9a99944df0
commit 5bd34e0a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 638 additions and 5 deletions

View File

@ -157,7 +157,7 @@ LIBC_INLINE constexpr uint32_t ceil_log10_pow2(const uint32_t e) {
LIBC_INLINE constexpr uint32_t length_for_num(const uint32_t idx,
const uint32_t mantissa_width) {
//+8 to round up when dividing by 9
return (ceil_log10_pow2(idx) + ceil_log10_pow2(mantissa_width) +
return (ceil_log10_pow2(idx) + ceil_log10_pow2(mantissa_width + 1) +
(BLOCK_SIZE - 1)) /
BLOCK_SIZE;
// return (ceil_log10_pow2(16 * idx + mantissa_width) + 8) / 9;
@ -666,7 +666,7 @@ FloatToString<long double>::get_positive_block(int block_index) {
// ----------------------------- INT CALC MODE -----------------------------
const int32_t SHIFT_CONST = CALC_SHIFT_CONST;
const uint64_t MAX_POW_2_SIZE =
exponent + CALC_SHIFT_CONST - (BLOCK_SIZE * block_index);
pos_exp + CALC_SHIFT_CONST - (BLOCK_SIZE * block_index);
const uint64_t MAX_POW_5_SIZE =
internal::log2_pow5(BLOCK_SIZE * block_index);
const uint64_t MAX_INT_SIZE =
@ -680,8 +680,10 @@ FloatToString<long double>::get_positive_block(int block_index) {
val = internal::get_table_positive<4096>(pos_exp, block_index);
} else if (MAX_INT_SIZE < 8192) {
val = internal::get_table_positive<8192>(pos_exp, block_index);
} else {
} else if (MAX_INT_SIZE < 16384) {
val = internal::get_table_positive<16384>(pos_exp, block_index);
} else {
val = internal::get_table_positive<16384 + 128>(pos_exp, block_index);
}
#endif
const uint32_t shift_amount = SHIFT_CONST + pos_exp - exponent;

View File

@ -35403,6 +35403,558 @@ constexpr uint64_t POW10_SPLIT[][5] = {
{8185529170695989288u, 251935u, 0u, 0u, 0u},
{4647388653739187u, 0u, 0u, 0u, 0u},
{4647389u, 0u, 0u, 0u, 0u},
{1u, 0u, 0u, 0u, 1666406u},
{9167511163728910775u, 3312060066959522888u, 1295184565790726114u, 14514316166628409175u, 467615u},
{18446650963712978694u, 11459123952047835623u, 11203169122561999106u, 12474589757305876786u, 2263011u},
{1727375103581005166u, 6279996614298463960u, 7709863957368393064u, 16687049419988932499u, 1149488u},
{5260295235157421525u, 18426378431810315116u, 1049713953025921878u, 12343052908124526721u, 3504815u},
{3705581585852188490u, 3335423218796647794u, 5009356519446298754u, 17358475006776455890u, 3071434u},
{14296650234967904607u, 13533728612605645886u, 13550853390885990417u, 17206365355322613797u, 2749915u},
{18409334644427041092u, 1794178469698007910u, 17611594257294438978u, 1708051658308162884u, 3019512u},
{4754135742177139480u, 6231107125027989758u, 17105560207999383557u, 17277465141864323237u, 2595660u},
{18358242171314739190u, 5662514190210093154u, 11287743438560124974u, 5452201045844425276u, 2058811u},
{17761256625928321051u, 17212837789613283598u, 9527998849657635872u, 11639251005171736777u, 1601676u},
{5821492835406745926u, 2889087753330502654u, 17816699099621606956u, 1830985569848452224u, 878190u},
{12963632653576508465u, 16198926776608324708u, 18116681369755801167u, 3835252232019257168u, 913381u},
{9574571567457348478u, 3277569375660351599u, 18148476178141229221u, 8447587411821609647u, 210151u},
{13880179963005905487u, 5477919832920232767u, 14817599233219952607u, 8578730300674845931u, 1381841u},
{4139500131013550121u, 3663479087884115807u, 3494753886518274538u, 15734045976124579229u, 3587513u},
{3951002731038455889u, 6648345471811276523u, 14225211067814220084u, 8568974046381648398u, 2873430u},
{1688486474885901699u, 3743680607006362896u, 5194811187761484099u, 15977733718774767139u, 2499029u},
{11994796996225841889u, 17880557183921429048u, 15497995200573975779u, 12079717168707477337u, 3113160u},
{14145368163067234658u, 9261433793631684194u, 7680189330107885166u, 13243967386801039084u, 526971u},
{15445030309197543459u, 14728335854035343397u, 17075675439650901028u, 7287537910245955718u, 2849008u},
{1142171144987344907u, 7490797843865302792u, 8787155366672039387u, 2718685908130822644u, 484791u},
{5408153414594581696u, 2427550704946339717u, 6793841772739607308u, 14348404031772582899u, 624735u},
{12520228542564573657u, 14812481887778795293u, 9249283428732450365u, 8081974873255221800u, 806845u},
{790425527012045027u, 17212573622941371702u, 7910578513568475163u, 12408789845827732048u, 1161789u},
{18054897266975082573u, 8506153697810646314u, 1662661719671814836u, 4056656502883405208u, 3185768u},
{9270379265643408620u, 1195149283137702515u, 13207984899139388752u, 9930657434226997265u, 2202773u},
{16614137443348276141u, 14781126627478736439u, 6803683723866315318u, 14668325589413505852u, 859112u},
{7447673545517676182u, 1083916344985410534u, 13308050152951963757u, 4195188288062798637u, 2406710u},
{640276865045725606u, 9429623404773127942u, 600293903614474160u, 1125259878193744843u, 2131145u},
{16798302994488502999u, 1110264672744614054u, 10559380483812768002u, 11568527733592695380u, 931863u},
{2248359540383920274u, 5894188707032120406u, 9043257816917527345u, 6934718877482368793u, 164401u},
{2862341250731230715u, 4246895923326563304u, 8809995434622158204u, 1876530115093307137u, 2901191u},
{8405103544676021516u, 11567689276855949105u, 15784543052813908722u, 4809318736265723378u, 999334u},
{15579631011428052726u, 16785760031102532158u, 5909361390067953776u, 9241806500206251005u, 2150196u},
{370319694131435420u, 3083801843464632004u, 4662741834226062242u, 6164559617785995043u, 3620301u},
{1033559633838940172u, 15810150688083630215u, 3891367580811375289u, 13037149699008382861u, 120482u},
{11308568505275257325u, 613731621304509155u, 3803382403086045620u, 18304851399290334117u, 421341u},
{8677144826867200054u, 17827139855619338965u, 8813322557930393339u, 8078222920147541087u, 3545930u},
{7375575360705793469u, 12651035560908367098u, 9394262074024389219u, 18440097350963135510u, 1843942u},
{16669835522062886782u, 17348663479059537611u, 18244674427130191192u, 1619281813435276080u, 747200u},
{17464778948620520076u, 12917510971872457916u, 7429449805763610688u, 15722338909059447638u, 491710u},
{7702674345127274593u, 11601590047702440914u, 12627737072937908926u, 15717625964519112680u, 1868229u},
{9788000944531531893u, 15462636986002358161u, 7842093577620732495u, 11851908180171889790u, 2452442u},
{12109297881698999285u, 17131651483582465886u, 6569550798974851021u, 1774621838691795044u, 753597u},
{13133653791234500424u, 4324827303956416464u, 12192519312904677579u, 6931430440409418991u, 1146093u},
{5045375477987867200u, 6678799442071584796u, 10139350272668939471u, 17603194636441516825u, 1872575u},
{12798246487239652604u, 16714555538748891233u, 1085554466557611808u, 14950464895238104052u, 720150u},
{2664578200625687471u, 16793883355150161601u, 15391344404818619526u, 17235049412759923532u, 1840075u},
{18374901552925357261u, 12553865988854528153u, 17519513554508473654u, 12139619208208373763u, 3447533u},
{17671381561613929399u, 2262727631311519342u, 15121480342923670975u, 3017957126631332695u, 837291u},
{8460112156141233331u, 7983046005719909202u, 15005410844269686945u, 7365319887678826942u, 2794384u},
{2379370595853479811u, 13860668065444366236u, 6673137095531534673u, 9779322488977260039u, 1224093u},
{1415933634462666168u, 13318864766636345134u, 2647925470075013075u, 13065005060937698251u, 2142779u},
{7782049967851326679u, 14165493027220141411u, 4424988645680867478u, 12505491077446057268u, 3817586u},
{14298756137794571746u, 5871188803067413627u, 14048602070109968112u, 7708527012447228845u, 3011900u},
{4050782139123098694u, 16341196407815195137u, 17698899155718192812u, 8414240664583773386u, 2285155u},
{5890934981019196614u, 7047030131107131070u, 126062594834924354u, 13661038951036378319u, 3048693u},
{6564357374484156534u, 13967226511753616903u, 1498174585292480796u, 17854464200559548937u, 2283376u},
{13259932982941242686u, 6889276820041754061u, 12733502488724171474u, 8256686590874299525u, 3495034u},
{9313261355332184729u, 13168455044449058327u, 16546258483028024409u, 11593687052052069739u, 2491259u},
{13207118334093637735u, 3391170805209232789u, 16627789664552178912u, 4729699241253328475u, 71313u},
{7085701162826158826u, 15325670087512086235u, 9365786138160176070u, 5693865426386134634u, 267597u},
{14198705572034952613u, 14562521029100056325u, 4979170736928754471u, 2887240060584875321u, 826036u},
{12613313478282210826u, 7767769415626507749u, 14085002163747829797u, 18173751375132750675u, 554120u},
{3568965762911820816u, 943907302893284828u, 16126302233087205720u, 14709970911737174255u, 3795586u},
{16009388400392220742u, 11870203406362803303u, 16918269583830235138u, 8933100284926861981u, 1843037u},
{12360163387826619807u, 7286063737319541239u, 14915295217745959906u, 610458793093901203u, 243975u},
{4678693883975533460u, 8650260372010974321u, 17513611905647666644u, 2670631524399175712u, 3709456u},
{16140389596301619804u, 14018514106585446252u, 16573599126622797627u, 2374270397369011814u, 3456412u},
{17824937920199406379u, 15949883623231815687u, 1644962704585409640u, 3234293687620398160u, 1623083u},
{7450515525907448647u, 9803984207968383106u, 14498223819039278025u, 14729689783682981351u, 1011383u},
{16773139797707794461u, 6386168526813270247u, 2306327785699430784u, 18393343217762814051u, 1794415u},
{2118816782039041761u, 8371232817323324030u, 15234034981350631406u, 10049106703932351846u, 3740848u},
{12707956644941545515u, 11976903329115696638u, 12469301980390122684u, 13327603778702495156u, 1254629u},
{9039950576108104416u, 17209421422031733581u, 13593878325969039004u, 12921453166187158463u, 1521546u},
{11248333658881489667u, 16727437224260833846u, 11257619938869563541u, 1036873899110820743u, 2318833u},
{17879843874279495826u, 4181601617475580607u, 15000982146088610352u, 3861827403947726647u, 824110u},
{13578648902386511104u, 13590197159220965458u, 9776560520962997987u, 15795815244426630166u, 3725688u},
{7017447564488921474u, 16338797213553232755u, 6783642089315312534u, 16641973457553731316u, 3755983u},
{17446940937448854982u, 10737119951556083111u, 6660194076904400201u, 8860312146415385472u, 3473657u},
{16519166898418538210u, 17091600978035266948u, 6514747771652737435u, 5252224441269973238u, 1919721u},
{4417044329409092931u, 11380051351719377962u, 7522441564903196811u, 4214753061431970503u, 1841622u},
{5491857990967617848u, 9024171026985363161u, 5499558347578912177u, 3997139606015302673u, 348159u},
{6994480456139902559u, 12313040250767907698u, 14690574092329243413u, 13120904518869982601u, 2135085u},
{1749605835261128324u, 9540847690459802115u, 16270580970601591029u, 471730943919088292u, 3546644u},
{3749285147232329917u, 18225836298634055362u, 16614336693631217981u, 10369659982083983330u, 906236u},
{2743226272316612352u, 494720978589131697u, 5575725903735101804u, 5348979072738709495u, 902588u},
{3368311441953910552u, 2002280659113327640u, 9457492639531033449u, 737225755568259789u, 3541191u},
{12026781733668095552u, 11397995406927758609u, 6730745515409304376u, 3524087958650890284u, 2961094u},
{951703565280633457u, 10944382877554487105u, 12612374439307178584u, 2432523149971906757u, 3258871u},
{3678049391738471619u, 6893069984109299175u, 2883083942276601277u, 10148178727048668110u, 1798332u},
{8881561970967635567u, 11415923064514023299u, 7846739896879877179u, 9977121357545796140u, 3435576u},
{15140395773232853756u, 15949019427562859500u, 894426476091955682u, 17429255364335532700u, 3067248u},
{17343315567527744615u, 11986546187690574179u, 2040310762243297928u, 12450486930819457831u, 1902443u},
{17947624836606589070u, 18081310986542907202u, 5985151613684732328u, 14302497511096038479u, 3638956u},
{1795629144512604728u, 6353876384338179960u, 3807248879631167322u, 3670006606226384126u, 2669315u},
{8677459242106997072u, 8003813114481567210u, 18414409997315103887u, 15253392516329915113u, 2568061u},
{4549848593366540956u, 14148344854827193065u, 2996704749739267152u, 4875231179827238853u, 215866u},
{1258411078263355085u, 8071640287602051658u, 16535261262344243984u, 9515584442737934117u, 3168614u},
{4530894777772685112u, 2537700881417552542u, 17010007271659599876u, 15622890933234391735u, 283124u},
{14658436266069083432u, 1958346567304787567u, 6015854389490711016u, 16362296578201657348u, 593706u},
{2401778765968598525u, 7251070512154274413u, 4674151200882376820u, 155067147075178253u, 275922u},
{14207166018946484512u, 4204863376551275335u, 18007125055201591893u, 13551917541803825201u, 10119u},
{4936749078018473750u, 1556720238523122447u, 13957313961871519189u, 11817632098375380912u, 1612084u},
{1893466179509874520u, 18326974623317736743u, 3370379831240751071u, 7811957868887171175u, 1770409u},
{14926971438317492437u, 11182884361940575192u, 8376705575892579410u, 8031051227750750818u, 844059u},
{11508141943287493176u, 14962914172118026658u, 3287212790684287614u, 5491947295269685574u, 2068611u},
{12203518853080004698u, 3617089502073706471u, 10101639049898170375u, 18124615246716919620u, 483134u},
{10458294034992519390u, 16322774878186535045u, 4194128554942565631u, 15357179797454573205u, 606813u},
{7272475181693406686u, 15474321324440527285u, 11055742709930368211u, 16007979615888781503u, 948952u},
{11027272155779304107u, 8347542244846677935u, 5790210415825921656u, 2971866446245259818u, 1432432u},
{14971231974885946753u, 12913247256233115751u, 12648377723538553512u, 17968764624922914430u, 2925732u},
{9096847586665120971u, 11332908202750209530u, 14600548915543739907u, 15041949807290037706u, 2634952u},
{12751314985995067672u, 15668349264919302017u, 13645428086455660608u, 1561815775028945593u, 566942u},
{11563193684702396635u, 1552781408958269503u, 11828492545255311661u, 11467615687570994639u, 1110816u},
{1400683406726104317u, 12208172938207697009u, 15843415876437138014u, 17746659083262869692u, 2383573u},
{5406308906466419666u, 5127688944296462729u, 6214222207037262306u, 5088000761513618700u, 1080264u},
{2389978042491125839u, 14948981118903029532u, 10708802086349539540u, 7513917138572547880u, 2639383u},
{11832158916618231760u, 1813043199960936153u, 838234966387375669u, 17126337817216337708u, 312398u},
{5700684272435441046u, 7801926537902043096u, 13319893546977646890u, 5193909513812287925u, 1753546u},
{1570101120788386704u, 17423072751416593387u, 3879687148014542261u, 11489504671507928427u, 3568293u},
{14464154804035843377u, 14124577894714444578u, 10559652613460736609u, 3452530319023126940u, 481637u},
{2189077236620091698u, 3171089786171651284u, 6176012944244790385u, 17590937583182375950u, 2553494u},
{18288199254312507011u, 11629802359215142600u, 18013656107996006429u, 17124753454891611312u, 1462544u},
{4889116951016786383u, 5998709352979101940u, 6461570099486319930u, 4926895586568392565u, 3554236u},
{2199975600337289595u, 5847296645763337637u, 8593193283912379856u, 16278522745330246328u, 639489u},
{1528656688250066267u, 7353460423402946370u, 14455063314795463713u, 3470561020020016120u, 3101567u},
{3309997611820274407u, 7165917856594695028u, 16546699786208060589u, 3804208706119276804u, 1191102u},
{7247262146298419974u, 8102554607163688212u, 8636721983754521603u, 886663086019027532u, 36260u},
{6985121815884159426u, 3339005953553563912u, 6652332961876980623u, 18159182577384615666u, 836459u},
{3775045753865620181u, 11298099168662134230u, 4054288322569509565u, 2825676130739523099u, 2424698u},
{15009540523965777788u, 5814927245346129690u, 2282509117946592630u, 17410607949428344109u, 2734920u},
{5714078105996605758u, 10456837455245123602u, 6160748199906420014u, 13741393253918985516u, 460852u},
{10698833280884522061u, 12003930615174384973u, 3695295091961330649u, 801134767058457744u, 2831945u},
{17314883983826999139u, 5091428160819785466u, 3867006901853908082u, 2213967986584794243u, 328921u},
{3874904667587726835u, 16276922674913825336u, 219158004127495052u, 14417586331307023806u, 2044083u},
{6462729573893065578u, 14810529203087500665u, 12966436553073377484u, 8612560380897431156u, 2220044u},
{10992882775436657320u, 5451928658754496942u, 13009054558269493127u, 5517329738995457964u, 3652553u},
{11276480754406500102u, 6345866629411296281u, 16217152760168926909u, 499723280151557398u, 1244174u},
{2050366996710390896u, 10268184946870732763u, 15197213283395228081u, 7228710363653680387u, 2510223u},
{6532193867484341533u, 7457984715706605113u, 8113814323310135212u, 15610745760670083951u, 934917u},
{16469990856175821417u, 10102528740535617311u, 9929141208155016529u, 4196586644439726361u, 3420949u},
{1415383548198264335u, 7610345376856824064u, 6104580011670919070u, 783681315268078621u, 896010u},
{15520506072182345160u, 10389412246267891887u, 11280751816407303678u, 14139816899375041266u, 480051u},
{2946249913431227664u, 8152608466925387942u, 6232300417495203228u, 11970416002375182619u, 2747316u},
{8125325724997209183u, 13396350733685016202u, 16281931502026287873u, 4590307471501483400u, 1267659u},
{16794466152993196567u, 1098757763778858028u, 18326293196870121102u, 1392478472456672831u, 1979936u},
{10368277562512346599u, 11193720681604274198u, 4520363714669583110u, 2198251195204640747u, 1673978u},
{7184967683087223506u, 8846546202861894722u, 18441010737938086033u, 5219026216680082754u, 2887387u},
{4835751726793421944u, 15196833033289030149u, 14608901680839924901u, 10861901999938972617u, 368653u},
{11890210545962808297u, 1289662455915373824u, 4996593304567863138u, 15643298364635269359u, 1316082u},
{3336554993796378285u, 2048191322387287071u, 13745736545843869859u, 16669581666238667394u, 1034001u},
{2727752792486717226u, 6581687957571454482u, 5887518377010538905u, 5567508709408992488u, 1316243u},
{12956757253818591693u, 13913997601160102501u, 13958488472393829671u, 9896170786523447622u, 3339119u},
{2767695869091116105u, 17414355213661054864u, 14866487952318986598u, 8132046415768760582u, 3062439u},
{7501146529116990161u, 5852935974416269097u, 5720556823733168865u, 7550481816550898765u, 3414693u},
{12756619068956600691u, 17942153926652316844u, 8987118190203140826u, 8205498101697626074u, 1816737u},
{17015936328127409039u, 10136771478937301710u, 6858924948191133665u, 16390586737303378443u, 2140237u},
{57068893624212306u, 4857076147447689907u, 17069721106543804309u, 3786475310558923318u, 23879u},
{13521054681577729046u, 3175496704063358748u, 17376127936839109697u, 4972414482205239004u, 1866179u},
{16667616643150715876u, 16238425037539080919u, 9784785207097591992u, 2412325534632767587u, 2535422u},
{4538245396420150238u, 4280696400899147636u, 7565185717904791440u, 46770283165178353u, 1370631u},
{14703604926721831111u, 11811609319397813971u, 11181826873128016813u, 9753058874443534239u, 2860867u},
{4988305735952570894u, 17806446327762073362u, 4547958265771955199u, 3655653393027376898u, 3539102u},
{456147882709526703u, 12714877307156564599u, 10526924677494593346u, 10297463265886173926u, 3147099u},
{9885549183067932984u, 4610282344598720356u, 1242128309267264411u, 11803441568307344090u, 2877109u},
{10305296386839065299u, 1637601500952734988u, 11947997347810065558u, 6970602332839689838u, 727840u},
{11108361518556214403u, 6048296423113065275u, 16378481821564012818u, 10822065390866401492u, 855476u},
{3205859866592529305u, 14406112921496106744u, 4513009014306327810u, 7437712943561843551u, 389110u},
{14355819235995762550u, 11385337577142860630u, 3526008637419628181u, 7933513164196307027u, 1555999u},
{2894580858817241479u, 16914896149213534922u, 14780479720941674873u, 6585944180716903328u, 3617545u},
{8591858418603984772u, 6483079463146107151u, 11392820720611656594u, 4750475545841387640u, 3336960u},
{18337964647069668863u, 2883163275593567325u, 3724674341035884835u, 13176038166757565723u, 1513837u},
{4393559283285561059u, 17389005465563199988u, 4561442902019660644u, 17393805540024982989u, 3627707u},
{5798404692688952971u, 5783649376460767767u, 7179611167076497286u, 15631359712189644372u, 3108577u},
{9089016418124169921u, 2908323822153937824u, 432664773866630253u, 10505694275483330249u, 2471565u},
{15191105079688940591u, 12055155279010435025u, 7805357704706350941u, 12007152947818269599u, 3067315u},
{11658823084159822941u, 9640887629940601014u, 2458962780300304035u, 1641849055640017953u, 1474422u},
{7002148939839005376u, 18296301938758462103u, 2818365596575915911u, 9827031076090695336u, 317512u},
{8637286647492811081u, 2844420789867142421u, 4489840259124513863u, 14921779038282445495u, 220789u},
{10986524627650864480u, 3188382601336416903u, 8747271150662346795u, 5840737970171232112u, 542271u},
{9171527676536324552u, 4381034629886205028u, 8035255038746277696u, 8656914424747684842u, 3672879u},
{15876361850929538774u, 6832382403152735347u, 18031827111998544265u, 10588161397121095344u, 2098673u},
{15551812775433834817u, 12263728559892231290u, 17334422247527287988u, 13225253403254377930u, 1407506u},
{17760218145217518103u, 1237990595627870798u, 7585441855314095981u, 1106827826758383079u, 2973597u},
{5421240400008745643u, 15615701546261742549u, 5811938758413066987u, 17276618159008955032u, 909932u},
{17774788314340309290u, 490308773050982651u, 13466218069671426600u, 6574026357456539014u, 272617u},
{10593623265798265749u, 5989170364458396481u, 5339190311092553609u, 5841694019675331650u, 2272893u},
{9962886392971184567u, 2340194855611575496u, 10634118855672104186u, 17263692456384396647u, 798171u},
{17973424980443228212u, 15531839641985579172u, 16736564574419482397u, 5202870444158560674u, 762420u},
{4068104539373440417u, 12331926993088931985u, 9253465961192725702u, 806697706236755376u, 2268014u},
{4277106670778827334u, 3087647431747845196u, 4345425723720930197u, 14525413876243803137u, 906067u},
{16614448395119854068u, 11334659840401616943u, 10106185417054045690u, 13275311303566787892u, 2152585u},
{14345643564204691047u, 3853394282278031456u, 13505142696209560373u, 399996168056857058u, 2858814u},
{15680950257255532448u, 4793188794544071471u, 2774399213521702787u, 3367385136357019122u, 3145589u},
{905783830657699762u, 18176896307095593930u, 2125820240448581670u, 4309423926849209315u, 3527188u},
{13827711418999663830u, 8451383895220831664u, 14656770541120896995u, 8351688453006996012u, 1785788u},
{12412096596469377695u, 9973042467139654873u, 14171331515291096627u, 6229895069819392581u, 336104u},
{15636552797706077995u, 4081617859764950498u, 17630229306352131081u, 5194346801430856536u, 3551005u},
{11921471977244163840u, 8419214585688667056u, 14149217487682016087u, 17575499836850298235u, 3029176u},
{2533614267372270913u, 2096548159387239557u, 10629874508478443753u, 5099910034656678561u, 2779462u},
{4542163433833915624u, 3292098201657867362u, 7570343686647306964u, 16696576252037864148u, 2968863u},
{6223155252914632599u, 11382833863242697608u, 10647400845677721765u, 16267724531181267412u, 1989532u},
{14862475150558323046u, 1197897426606251708u, 15254555756541853404u, 6089538303084126666u, 1347972u},
{798470652506926360u, 16299780880152255498u, 14666073155052283869u, 7374740292460714186u, 1342904u},
{460109796424866663u, 8851055311642588410u, 3026133962063107654u, 14508348615401816280u, 3875017u},
{1517801533939329414u, 5973256551174194527u, 18007596312524425712u, 11312466131305380396u, 2748315u},
{10155521710866903614u, 1266226725343120821u, 12080909881868913770u, 15326907410792125629u, 1283019u},
{9252739060661458315u, 16508837941488399587u, 18390192511226244557u, 18398354018133237845u, 1412973u},
{3890525823575801003u, 9296619739095457057u, 7540147481163606853u, 6727421015239713672u, 14252u},
{16570742099724319485u, 1073078785123878915u, 14191908556040791393u, 2594336295089365219u, 3368698u},
{8732656840431316686u, 18296210987742369870u, 3672399720671221584u, 7988476856634026474u, 926880u},
{7577557929656155997u, 13263962519895301487u, 15418979511595777207u, 1602364994969931357u, 3074962u},
{13334298007421575211u, 7366980104891466195u, 4172099181785921041u, 12666801995290135865u, 1861706u},
{13585076407559032299u, 9834564639861808997u, 14590503160733056544u, 15454667550905869813u, 2771950u},
{5342712587865078271u, 3288751066130453318u, 9368013211534908521u, 339363843841498486u, 338334u},
{12104460790469446883u, 3551297093178577920u, 5127202980430425198u, 14129529592482673747u, 504290u},
{8315190138806160780u, 17896968200467012721u, 4927243166569422999u, 10385596064160083366u, 340206u},
{14122210725620047262u, 13946520513549417843u, 16180677082692965935u, 5914998414510027247u, 712813u},
{15128117330470136254u, 2184699842180510203u, 2325821863797122533u, 16442280525545980949u, 1091638u},
{18243625569442759398u, 5214729361229210014u, 977086349212074224u, 164252371325272545u, 3549403u},
{2734408964504648493u, 3759773176167769524u, 17704406381196394931u, 17071067121870702170u, 530719u},
{4440864817607645026u, 7200105757195135904u, 7282665262599556556u, 7647895022659483397u, 172962u},
{7840684976056391780u, 1031703898214911053u, 2325949764622517815u, 17152897974423220742u, 205925u},
{6018789736918861827u, 18030100139261556510u, 15490571102638465136u, 15640296569156638725u, 723168u},
{16421741939244848131u, 601499347721508844u, 3314478026323043618u, 18388026590330216638u, 3665005u},
{2245059897107918497u, 5042009930786440743u, 10157048789478234003u, 11236534503530722545u, 2890354u},
{17611480946086544761u, 18175801013468294487u, 16274356055349262238u, 2070930264818939408u, 3077265u},
{3160639008164523074u, 17116612206340471917u, 3182979212939025240u, 18143221625492826024u, 477787u},
{2066622923555088660u, 2250648449600383514u, 567787391570849649u, 1449965513412525811u, 2341815u},
{4884759703164535414u, 9563582849746399567u, 556148139081189680u, 2925502624940057087u, 3062860u},
{1640905755812671497u, 8013568752081631267u, 3738026950556734691u, 10793081309130367126u, 597820u},
{17384656164790219526u, 12099887716157221932u, 5117943004423341921u, 4983001831952253937u, 1183634u},
{7101306651321453095u, 8532822187498810454u, 6819880842516705948u, 5570268939378394035u, 509619u},
{16521531299494551646u, 12722936551241535645u, 6703331695723288372u, 10457751952337919447u, 711892u},
{5041289693584114706u, 180768438551395533u, 8428998409325683112u, 2607205485355278888u, 899890u},
{11463302860732779339u, 4499270822353207386u, 14001099568301863230u, 5492977190014219109u, 1657799u},
{16289870967459870835u, 4693565917888026639u, 17961083614634039706u, 15306790935412351242u, 2838008u},
{14087244524374642014u, 231809649036775543u, 10606364487456504457u, 6753708268089229280u, 1055725u},
{8228895810843529388u, 5799776923372102516u, 8652092616633140346u, 4414987931954529380u, 1399459u},
{4034343446199160616u, 3092056713558145773u, 6447231583530214594u, 7087459682146575155u, 2764173u},
{7542511453954291815u, 18278527516617176127u, 10434008300367383136u, 15975718281375991490u, 1344445u},
{2289168322258448615u, 13836771702298162551u, 9193204426498080244u, 15156895396776763279u, 1262534u},
{10304342811701282170u, 8197338541231047940u, 15065792049209050440u, 527692815004747763u, 182139u},
{15308887468027926177u, 7092216603163445467u, 489473061207557817u, 10811998977735724599u, 3076030u},
{13752356945030265791u, 15568304561679955529u, 14629911268456489465u, 5244889519715863161u, 3466359u},
{10218002948207937679u, 16109843127170740770u, 6381638306442599421u, 8638796733098913671u, 2975195u},
{7282494216902101689u, 7894757799501426381u, 9575313618049207244u, 6612123726824619198u, 1263021u},
{4687018636243912377u, 14316514172790997182u, 7677740279101745682u, 18181812329316684310u, 2512958u},
{3886378898708590302u, 2732654380068222138u, 13402010378759402842u, 9702073512358136760u, 1664205u},
{3414954422869063328u, 16833382284342138430u, 13009419435302844927u, 7092343389140199044u, 2179070u},
{7927031638388833624u, 1330488976003297792u, 14389865368318499710u, 904887882156176893u, 50220u},
{9814635940269501376u, 13057142588996047884u, 15464503485696243635u, 4108209256554161927u, 2318755u},
{1671500737253207227u, 12533178127659818789u, 16814576302659442490u, 6527956947576357887u, 1237356u},
{7132969973748730123u, 15292133510099719971u, 9697917920719695814u, 13281422498966766127u, 3883657u},
{4356142892525633912u, 4153868061576843079u, 1237884247582475224u, 11312625509947251131u, 2036127u},
{4216106498148577025u, 7906714136950546530u, 2775909639105943750u, 1406654211703826302u, 827747u},
{2670858957912508184u, 14783541940178848380u, 17069057370162272856u, 735845178852714431u, 2603842u},
{1945239491690788355u, 16949925541930277817u, 2796952593771760306u, 13306629710696961429u, 3893221u},
{12850757373201363775u, 18102146847191958527u, 17505158894418475502u, 12177493063087914532u, 1725203u},
{5081455224631066336u, 6963365183376188870u, 12257724579644129018u, 12209557782803510186u, 499101u},
{6075975101956733528u, 12890412288614510668u, 13366647310867299278u, 3107683344254391541u, 3787535u},
{14430684464245312463u, 12130219093571911652u, 15390083563695530249u, 4825668898426144626u, 73045u},
{6037025585957576146u, 13454121457542675233u, 11509575661593502154u, 14989327007135543700u, 3346824u},
{13468440109347400260u, 9318134782396462455u, 9467077223197445289u, 17139387807765996735u, 2731315u},
{17600663491437196513u, 15501973909139581492u, 13614652216039142627u, 1995938924953126083u, 3363857u},
{14789187206961675069u, 17843324287441346991u, 2277600965417776475u, 16851471622012704404u, 2692265u},
{17723304383335736424u, 11471682971113083149u, 18338916289835430011u, 4661349558712465171u, 3530186u},
{14360948127895229050u, 10868953753729150764u, 16483009731399540649u, 15197215190300808545u, 580232u},
{12970882343217396053u, 8862501363335545470u, 15754690030469652198u, 6063541305590538454u, 3530597u},
{1527489555076685333u, 16185414800802163104u, 7329503978823206486u, 7487060211256525435u, 531325u},
{13502925167632275739u, 13363165381170612379u, 14183639452310970183u, 1378895510502654722u, 47431u},
{16235782182843069017u, 11689157018967155670u, 4525968034290707138u, 14124163380330931084u, 1735020u},
{17670263483869758420u, 17855120146360184042u, 10620222295358857997u, 10120068649336841966u, 3839441u},
{7687695847399324004u, 4272471608075930088u, 16656093217481454164u, 10230945954981015099u, 2347135u},
{2932778045487202542u, 5406421711178218601u, 7622845081662174870u, 2709427988285725855u, 1617123u},
{17443639814725218844u, 4146231099644615525u, 9659575247166114868u, 4065055922950101815u, 1984174u},
{16896161641990577740u, 10355914541985911403u, 15093624054411976463u, 14952523519891847250u, 2526108u},
{15058268663022009658u, 18065370765976557585u, 16702378980527868686u, 1415692769451704591u, 150386u},
{17598682939902807167u, 5064733606830999419u, 1494709565461991580u, 8649685418021313974u, 3428274u},
{12213595669821970643u, 9558743220125538507u, 6974801705372593741u, 17501178258920798469u, 1503543u},
{6268671365656090215u, 351562725141750503u, 5278977752314563760u, 11989296100722033115u, 1662509u},
{17328284173907325758u, 6047409096543592922u, 12351896653207016960u, 9181982332849382765u, 1987978u},
{9793752944107229539u, 3489961063149597259u, 15713955114418234445u, 6161567223796021859u, 1881079u},
{4802090867133009037u, 5173382240071848288u, 8122018845295052693u, 611160541360420201u, 1066379u},
{7465331218301586232u, 16931995832036050570u, 5591921380222993919u, 11909174237367848299u, 1805375u},
{12953359368297792819u, 18053295386308036013u, 2150600732257753784u, 7455235488397825027u, 19954u},
{3146775721932686557u, 17381268270632775733u, 14587144560018057796u, 11169295169665312368u, 3562447u},
{4517208974212067976u, 8744445067021450282u, 12748115403725779723u, 11306700229171207556u, 3152686u},
{9834565098180639710u, 4784366644081870663u, 11386218333727406449u, 4597785227482927268u, 1664263u},
{12670332544317347314u, 916221467173366928u, 18152080886563697916u, 14226046263701932698u, 3081050u},
{5714953918172529361u, 12162799536513265904u, 13067848727143139344u, 14612469350715792149u, 1335051u},
{15027131820669721297u, 12151725967292396129u, 5723739973645144886u, 9247999395589595169u, 2380500u},
{16321973747501456159u, 17817636141504046297u, 3901175900163805534u, 16617159112238890263u, 3260504u},
{1151109183663810982u, 15629084472752679564u, 2233250039223690643u, 7842365855552682488u, 1022554u},
{1650016322275865020u, 7676979190941779355u, 7301770134137171575u, 2612936185147319548u, 221200u},
{6848015112133726274u, 15920062979355603385u, 17797026659411691057u, 6201033509663843233u, 3794598u},
{5303707383506015897u, 14979130174614825205u, 14883084030632039426u, 5041971972986671210u, 849304u},
{8796214901402807493u, 3885648196574454057u, 227752260973793093u, 8158175024856606558u, 3687311u},
{5232113653242765251u, 570477314941091033u, 6186136543954029982u, 15632459202687783241u, 643260u},
{2363614545982595253u, 14102240660122762025u, 15869575309246173970u, 7794086224321530696u, 1230737u},
{14283964610640632320u, 8288154924730905256u, 13812030779163598503u, 12993070025082159776u, 3615377u},
{3426146109789656772u, 438210364305821092u, 12450796094632908618u, 66691947242045842u, 3222008u},
{9530121102808230681u, 7876998383887014558u, 4154405449283860970u, 7193137366801002376u, 629936u},
{5753838138906683610u, 11921160440870692618u, 16745566007198672967u, 5992400580515972354u, 1627484u},
{3120790247525132525u, 11878849756775541509u, 7714179320432417266u, 4857880587365629408u, 2414285u},
{9137793406806722714u, 2416330790846207048u, 3483925290155449718u, 18275106993969644260u, 397659u},
{11071816229982427661u, 18132326370045739256u, 10251062362564924964u, 13482105617169238292u, 1106581u},
{3577244420302931456u, 6341931084583800281u, 9334480254649676657u, 2830658997465124710u, 1222653u},
{7787087167076613111u, 5774214316988592793u, 16179306420228550109u, 3625433671709009001u, 2416877u},
{10447870328902356648u, 4534000088739112542u, 12728848020940624915u, 9988531492336123759u, 3385269u},
{17740922034155736222u, 13696912662397674034u, 7852197209939151565u, 17356269769954898792u, 652989u},
{16394735105986330401u, 10139094639193959353u, 6550051741948816267u, 7506035318266722640u, 1640668u},
{10284340098870522002u, 2540026556744099825u, 16554885262731340598u, 6155160483435834780u, 2258184u},
{5353000481308202369u, 145747395425012397u, 10002933745360891862u, 6382724423812164581u, 984400u},
{1564721551806719218u, 11523517916881004550u, 7802142299210619748u, 13132641096151768458u, 1792010u},
{18183566701864412283u, 8367709420555618600u, 13708819946731675392u, 7166758572735035013u, 398337u},
{11950076644850004344u, 1275685922950666769u, 7325157905426826359u, 8293971342222560454u, 1255154u},
{2681048338330241054u, 16640148303728205098u, 14233310686479252566u, 10471504648404614900u, 2323456u},
{908220466529238211u, 2741977588207637961u, 6716824703216641584u, 14310263828179760876u, 2021028u},
{749126870980839712u, 2555131721071972062u, 15922161867382899644u, 6018061705740083583u, 3155664u},
{3681353221846240379u, 16818017511410277169u, 4258183828094632665u, 18216725429766520156u, 2727905u},
{14445346911717910841u, 6509568987539075429u, 3091021960354482014u, 5670813318567497092u, 3895867u},
{7183103809696341168u, 13260165983710849324u, 5406153420550960921u, 18230379764722863800u, 2917723u},
{16922974177155363379u, 4111713025032056347u, 14620043907053957775u, 9349252138582059562u, 2928699u},
{17816148102771100580u, 42163929955175757u, 12733550334253423925u, 14393486183818840492u, 2418869u},
{4377403771877942279u, 8755235380394541975u, 4181559536458461586u, 3143096815415217181u, 2988528u},
{10017459640250997032u, 12435925099267139674u, 5295662313027157816u, 16916605619191348898u, 475387u},
{288443814998104204u, 10372797084238840680u, 14857455753674885589u, 1810209210189772581u, 2034921u},
{5619462195270770587u, 15129677515440988818u, 12428584537159876584u, 14376998882255085588u, 2106704u},
{7321503025487400461u, 9053437251376531371u, 8904598513525092158u, 10343097791327753937u, 932915u},
{7106291080634224793u, 3030405115573298460u, 12425626780262240755u, 10105272419900533577u, 1235304u},
{6403732536145127450u, 14190966052036090985u, 15679452840885332290u, 3121263890477403371u, 756298u},
{16085723336047006853u, 921963007226164360u, 17441044923983044916u, 7147653048525587940u, 2251177u},
{4716239376017797775u, 2232787779284734663u, 14828230257142896831u, 257699675245058103u, 1759290u},
{17433932365013843112u, 16101563735479597224u, 5673678795509923813u, 15452778296755714456u, 1976698u},
{3083085077425076280u, 884281531422746290u, 294380969021423073u, 8467202160007360332u, 1082877u},
{1350807884829494994u, 58263986700860929u, 2446768091450799758u, 11477133015380050362u, 2484142u},
{6677945686888345952u, 5755670112482274736u, 6466023459980218726u, 3648704045090282808u, 1495621u},
{2702684426948443661u, 8848361357040697173u, 7152842047191305712u, 7737751903525258750u, 3159520u},
{8111728537463192017u, 9802725837773128669u, 867791479884445643u, 6975811892214600562u, 2934407u},
{1918252962016233062u, 9592683739772886343u, 8180250608250315759u, 8845156734540121908u, 2726954u},
{9658341080496015285u, 3901562215747140926u, 2906830044108938204u, 6247256518645737787u, 2755386u},
{6187486559902909162u, 8816695342268266133u, 4330217539030397398u, 6896299340216692705u, 1977780u},
{8659651737447531193u, 5386566562738705059u, 3906747110628448564u, 8395164516790041193u, 3012243u},
{5564962460421080283u, 7545128956056853948u, 12515670940898364081u, 10359802031527682445u, 2155849u},
{8451882498101210188u, 7049448066184013245u, 12349807935612244016u, 5876433522196527510u, 3208025u},
{17662537223351282153u, 8805268768054109633u, 9582085774254973050u, 7625224996015928886u, 3611008u},
{14169601158362517133u, 14216176540406962754u, 10657012671263022804u, 17144261135038263608u, 1197463u},
{17699468588382003242u, 17490270446462088101u, 15587753613157706157u, 14793896088418224475u, 339250u},
{7178392071792179656u, 18099129163316029360u, 14830305569338130065u, 7932593416892975013u, 2162469u},
{6106122285851940569u, 5883514091287619169u, 4915594610792300218u, 4363346162418600197u, 707881u},
{3122326621851083719u, 5999864500793453438u, 9704571833875541895u, 15649556010235349865u, 1683779u},
{15070495206560461550u, 4221462843975493527u, 6378639303652732583u, 6444186125314828909u, 2080139u},
{4680892738579451457u, 7509151366034334879u, 5603817093436939309u, 1551581273011414894u, 1200205u},
{13270173875497738645u, 2797568520996475464u, 7539113731286084826u, 2400040479274189733u, 1832651u},
{12901704912027898432u, 16969034622810724564u, 13886778103071196524u, 13580634125503920330u, 1428658u},
{198881665671020777u, 4719653333781359u, 1780694804023635331u, 7232113505868285466u, 1189547u},
{7580188887995893647u, 3801852167991507190u, 15946166499829423542u, 8524739372780258929u, 3031349u},
{1898509208388417268u, 15287498424878481160u, 6675303242288633820u, 4739662140191150588u, 3702558u},
{15009347827400647272u, 6926539834686729627u, 3751778432533773980u, 13687185417752107934u, 3095646u},
{9780906942810011114u, 4257801842369476329u, 6898563380408357287u, 17350927172294692736u, 1017920u},
{7894875483399680464u, 4905177096652074201u, 1395523054534062281u, 9890667710274564831u, 3117616u},
{13391416985704072936u, 7258573783593318523u, 13750798623964530689u, 4957426268941869435u, 3467663u},
{14214901524489480242u, 1326966117925756683u, 15260305960261163850u, 4675653115279686057u, 1284081u},
{2931480046867661647u, 13149095549916270925u, 522244919734125611u, 8382368026652206726u, 3290968u},
{18042477869541303621u, 8345754088937923051u, 5807238207365239605u, 10076713224105118906u, 1437022u},
{9501873230842865457u, 13883309820844074307u, 7147125658798494901u, 1395602673859634255u, 243010u},
{15795330156037769654u, 12333927356367755227u, 18406869875568107813u, 7354357336541604303u, 3839518u},
{3930084946571438526u, 13049774066525987058u, 13708981790622161622u, 18445513092938382166u, 1939861u},
{1429795368060593266u, 6941316006493439947u, 8222590842468081245u, 11420883995843697265u, 3696744u},
{231697212867875735u, 6535879716308658448u, 9644613942197902202u, 15632633214087339514u, 2750535u},
{12772315746707608232u, 18343180111412394135u, 11832739147760962118u, 5887403547915576731u, 1285421u},
{2888693265267964333u, 17561159996792272320u, 8547613708967165889u, 12273502824549124473u, 3105310u},
{8152342863203495692u, 16341889740381176704u, 5124605733384679611u, 15477607995229612136u, 3479995u},
{476361643562094020u, 10376553786022160345u, 5636108541959048004u, 4747938205085712706u, 3605136u},
{8111560965013703657u, 14549295999922175435u, 2959088007318648663u, 11163372507731757307u, 741927u},
{18235794993353889623u, 15517815941287756325u, 4308446249005005579u, 11975246758949784990u, 2685289u},
{2048591615233075033u, 5248471384058704530u, 1829216298400049838u, 17775702984252466463u, 3266456u},
{1489748760158181874u, 2346868241240702052u, 7117848845747832637u, 8707166780187088311u, 2897030u},
{195224476565987265u, 14517013765488384480u, 9319088343601592111u, 15617881091883459738u, 2993814u},
{15843350065267759025u, 10742680997436480513u, 8211810929776393410u, 7693331104300530995u, 975258u},
{6894230086296317883u, 5624172065315395439u, 3513144103162353940u, 3116466886056070182u, 546827u},
{10000873953810222204u, 3241428006034295144u, 693461333032894825u, 11827532603058242763u, 260902u},
{9599085442694142401u, 10056116082593564790u, 9111960989806940564u, 18235384095845619380u, 3139677u},
{5037954976501744005u, 4545247423370892422u, 13552590672451968706u, 2435817439580118167u, 2109699u},
{11804454750466084298u, 4764578577707131825u, 16875851662193909938u, 327147456113090150u, 1526380u},
{2922822286487148179u, 8896894518346606584u, 9384231904804511713u, 18402843221217999921u, 3501629u},
{8734300007405250699u, 10153011817353839528u, 13532206522460700576u, 2226321493544760804u, 2550314u},
{12565743359688660471u, 12978336373141740592u, 17796832605894472021u, 11576260037960389754u, 3371703u},
{10918263322131530461u, 13020524614619217030u, 5030644835170985251u, 15050176513798829442u, 3681138u},
{4535608815987085684u, 612071300867784780u, 3974322423258053481u, 860538560053390841u, 3394751u},
{13201291906753559960u, 6966781705802749143u, 2054200960696512357u, 8853648576378716326u, 1490401u},
{9928222270239718198u, 17296202741010573015u, 15066458320019245289u, 17825718782036049557u, 2593204u},
{10551423526977989902u, 8581875922109886508u, 2303393684048789191u, 13594663867475090654u, 2899385u},
{11834884025388198209u, 2090765326643721833u, 14522140503004619355u, 18211997924218656107u, 3597370u},
{7882198292630393984u, 16974859679607285151u, 16888105392529767254u, 13829360243184674229u, 766573u},
{14515013295415897026u, 5731986428469611030u, 5452971879549673628u, 17163848170801024763u, 3829607u},
{14646542848492142159u, 10361876088534431890u, 11741715548058751718u, 17508581554574295297u, 3414700u},
{8345340422199517414u, 14113693736800692995u, 8807407137766145600u, 8926074181162213688u, 3102268u},
{1225610004084180275u, 757194881301599107u, 8022097492767470724u, 14036399996128152548u, 1458283u},
{14890148120916673550u, 38338606835348390u, 3456696199110117811u, 15807513681630659366u, 3135069u},
{12654977166011325253u, 5941765090982324192u, 16710552573616048944u, 6543015294717448451u, 151025u},
{3512089488800082128u, 10236802220197048039u, 13839759243166645238u, 5767393449100982159u, 1411848u},
{8803855430326055652u, 1475644904336468219u, 2415205043356530262u, 13644929277662752036u, 774556u},
{11154196492542856970u, 5536494607679041552u, 2291722619336284692u, 3256879781654442573u, 251016u},
{8956308351451150435u, 17606899903401458514u, 8538710599759902330u, 9948578408401341226u, 1522827u},
{7439310724880774939u, 7056426719336541474u, 14020994935297393383u, 6873562643489267223u, 2440440u},
{4385147649323015950u, 18420114195000474563u, 11714019393713578368u, 15753573679249096429u, 1048346u},
{377750418831467813u, 15816411934186929210u, 15634050311706961353u, 13854396641398434504u, 2458182u},
{1398605462054478039u, 8552884722495948591u, 7543918048236363107u, 8908429534760132262u, 1451756u},
{1439184555348447133u, 12962808105294549608u, 10624770416915157396u, 387068150487541498u, 2765438u},
{15380730665141071204u, 15505888367216928203u, 9027639290817100727u, 17416893490565411921u, 1698019u},
{2192820469290848775u, 13219319164390568833u, 12744129149005666188u, 751898879721469069u, 3648995u},
{10753024480342785785u, 10524207148722503501u, 378065829620621598u, 11668584717749542361u, 2102021u},
{15081251861148676848u, 13679728179670903266u, 2710902094645264007u, 12072393659427113055u, 1548561u},
{14153989620931419156u, 6193046135886951213u, 7141428803070107289u, 12854817659273094004u, 2595230u},
{7951951263463322687u, 6367311228392518144u, 16850836634886944978u, 768449496856510258u, 3875399u},
{8398133779558773701u, 8850615918713027070u, 8847151483085557233u, 575891652570454971u, 529827u},
{6772950207497811148u, 14479559281463943399u, 3219056517467698492u, 11178700659527063043u, 844023u},
{11218344747880371533u, 9222513687439097236u, 7575233136327178279u, 664087833793376640u, 798486u},
{15840392472920053296u, 7904137187212327152u, 15219117565855729685u, 12480693236114060806u, 348852u},
{14865069657836039367u, 3286115780788399792u, 11333783576849353653u, 5266639560813034288u, 3360378u},
{6804838915977527991u, 11792144406290375401u, 8362003842423885896u, 14401449251771222780u, 290750u},
{2683319053593500676u, 13830084382150178254u, 16668012726480415727u, 7283180403071601839u, 1767435u},
{16337403717152282557u, 15978070026627085273u, 7969487810804970366u, 13867661483677260956u, 3371528u},
{17532408216943681492u, 411362962224115238u, 15090362760603377547u, 16347209980592720836u, 3197584u},
{1203127472082348269u, 5245715868109497113u, 8987559574818398412u, 2941288791566515903u, 1976878u},
{6484664391685151600u, 11224143314332011127u, 10072858463941459590u, 5584901706392686654u, 530404u},
{15023153356804822610u, 5495297577674700715u, 7526631635697186186u, 8008177170638574443u, 1844113u},
{16703112589022465345u, 7321413152826108729u, 18406365099242780802u, 8392698796961818488u, 1347840u},
{2857915872835956769u, 15323939971315655364u, 220031453551999323u, 3267454999631764599u, 843314u},
{11743839595810062999u, 3317582207355648182u, 8176704202607640998u, 16588803029522656576u, 141888u},
{11752849621690884973u, 13070195949811555763u, 7053068037425869180u, 14918539354063016282u, 2941805u},
{11844553201090508418u, 8404317649799359892u, 10232836208225991579u, 16411340585477939953u, 249676u},
{1802704756033885866u, 3534283334193568858u, 8987555677697872307u, 5480982872567211227u, 1796602u},
{16201090467921323400u, 12310206862281786365u, 7740623845555458075u, 5725691391773604544u, 911983u},
{5666367503656145539u, 12615330332710267076u, 14481045921905595652u, 14212169148198068641u, 2214589u},
{18443640377792029341u, 15609654991632881400u, 7411799680569095778u, 18127308074243533446u, 2045655u},
{3434468399431674751u, 6169849191123491601u, 1006489892502478781u, 109793286413340323u, 2214203u},
{1862270261915245113u, 13938365675882657758u, 13468749456214980674u, 4220185290377853484u, 2262347u},
{14262405623639182577u, 5188295280958970429u, 6413125624589918728u, 11354775204289795825u, 2373335u},
{922968779124734799u, 12260585804907050346u, 17973680741000049425u, 7033366936379962454u, 3274958u},
{14632004218025844196u, 9381902205539944855u, 2235645455247887038u, 7266171722904308222u, 2279571u},
{7942007915483285624u, 1605589228973024104u, 3526002123441606603u, 6599291727552464055u, 347097u},
{3132654568312213779u, 6281350909054588771u, 14567814513426524128u, 4401916052440648187u, 1464466u},
{11469510815394245984u, 2913973433172118086u, 12129199894192497351u, 18185528331466405056u, 3195876u},
{13676890776229765226u, 17395709528899230260u, 8240910855830222515u, 6472079394224425222u, 3421441u},
{8304924674875523990u, 17408365116620175531u, 3966490455443456489u, 711632799303727700u, 758096u},
{13811980651795299601u, 15391363107693176844u, 10064743459501204533u, 10894681103334054051u, 208229u},
{9538472175597162422u, 2266595233851742627u, 10284098846021534381u, 4327296800242081729u, 2976875u},
{14263386795185921028u, 9511850431747153810u, 13078035583201726003u, 18069312165073704921u, 2335202u},
{7831835012835599010u, 17209012768845215796u, 7867376851519153980u, 4942993286302826505u, 3517003u},
{10833024676168801313u, 9314174823601050537u, 8576875516871512023u, 10657343582765868592u, 2681378u},
{3120642069909174953u, 4910948718994229427u, 15843455441451559093u, 11506620156418760576u, 2632989u},
{585841201486707971u, 3371546338949375000u, 343493147891186260u, 17126219872727433427u, 1333261u},
{12660825544341635357u, 17072319751234321385u, 4141906532134766863u, 8022987279786678839u, 1041705u},
{4208242032265338789u, 6179533235162763885u, 4663781822995994981u, 15151310821523157448u, 1739068u},
{10653887473848443412u, 11200751534061535549u, 606738062098171451u, 13578907836604540712u, 3000918u},
{13120902791532787541u, 15157295797028660471u, 15143378621921492754u, 6972886207552178012u, 3720865u},
{2917010345935268847u, 14296034567889414688u, 6010795054467218268u, 5472957404205304698u, 2111479u},
{3742646036080397844u, 1151328827019557461u, 9996378462949280080u, 12216683310612790758u, 1689927u},
{9619773773509228999u, 15481406353179655672u, 858931880484260835u, 1400267949809565856u, 215249u},
{948392722800532033u, 11348006699322003232u, 1574581608721209477u, 17441908401793950369u, 954248u},
{462598889539630657u, 5800041313224363972u, 81444903863947377u, 594063538384181082u, 2527082u},
{51652138247582647u, 14320710675845841103u, 9242659841859226976u, 2280401850677107635u, 2752120u},
{17724376936085623124u, 10914972719891653171u, 16058509705904217847u, 4446280891894143477u, 3375059u},
{15603682070138069368u, 17227461949292265365u, 8516655538738209687u, 15842871948359168961u, 1876052u},
{2164787505947305985u, 1314374343496442562u, 1613518136772747793u, 3277198798662600020u, 3493366u},
{1241523173912533272u, 9344770226938929374u, 2825662592730452629u, 3090860181427970552u, 1325337u},
{6500955467731547228u, 10494820024245753425u, 8080875601806383935u, 13427160646595874273u, 2037366u},
{12849740150501879112u, 878507731814419636u, 17221100512977373214u, 11927085798871747420u, 864123u},
{7616793236080815838u, 14207627352045752879u, 13702613918041915501u, 13850998323038455629u, 135940u},
{17419639683032134222u, 7535321661157406685u, 8949155094029408843u, 14558141659901821471u, 3317420u},
{5407977910102188888u, 3123393472277042012u, 11506565976623227603u, 14184484043717022656u, 3851934u},
{1287332972838146586u, 13340604206896449100u, 13123899189259079054u, 14770804838608603315u, 2005098u},
{15038169683813021494u, 3215060569813160179u, 2485545355485800227u, 253160326533295521u, 3699297u},
{968448526437954958u, 10172615572427506342u, 12870468088719309768u, 1077046301795792953u, 2661703u},
{16491073505286710206u, 4776625450912764881u, 8499429596999256617u, 4228440209318091524u, 3844291u},
{13144847925556245583u, 5086820599644725425u, 3864883981563063797u, 15419182186528955543u, 1566144u},
{13456254344894082659u, 12053415236713946928u, 9869824296384523522u, 14296293892479489286u, 824636u},
{4612142625692954708u, 17390478244333552846u, 5273943730985591382u, 11760599691724515010u, 2066342u},
{5899769588486058447u, 13719977949088340476u, 550149834463641958u, 830750828220564130u, 3488855u},
{10534787308359918187u, 13209693485526300107u, 17041172457937954450u, 11377400280080718717u, 3195784u},
{2435776775255582925u, 16721099619973654109u, 14430992332922355956u, 11371994084894942037u, 806232u},
{14042081236324420284u, 2963128925266938408u, 2092099659278665951u, 14066103204135976604u, 937954u},
{10566210754735983697u, 7250659501254350448u, 16830998706112843403u, 11474459663487557196u, 2746711u},
{10726083074336755492u, 5231374047940318539u, 13213258395716541530u, 3725605182270227235u, 62066u},
{3883746425241127871u, 14946131023260350215u, 5549258235235903935u, 11674475153487609671u, 3862930u},
{14393910121425636773u, 6473116559170572233u, 13126787039533254617u, 4394714135034806151u, 2338757u},
{11380892778805865294u, 2623953889057718829u, 15561442046877712686u, 16184043520720168528u, 3629338u},
{4019896420561230106u, 13682873562996146370u, 6697620537159396878u, 11019703779192078669u, 2738454u},
{5968187012136698778u, 16270120631095531078u, 12047943638884579433u, 11291500241032088011u, 3654240u},
{5839830805684327272u, 17982414620093159251u, 17143294400944311354u, 1076215157886403736u, 3579894u},
{8793931010555164936u, 15377471400260893822u, 8470974373286997449u, 1507189270263782259u, 1508104u},
{5102179307437569337u, 3730252954023074536u, 16492834014703398671u, 2189547431169565019u, 2120840u},
{3438236539395638478u, 9892295529584675112u, 11415628479610930188u, 11568337640959303356u, 1384007u},
{12753332279374869354u, 2352654878819984441u, 6690793983327713765u, 6006310739641578864u, 3453079u},
{6822555037746972750u, 16908857709188787844u, 7862085857762970638u, 13682583343753991548u, 2931330u},
{17163670097373676040u, 7084078904513823961u, 12774754487691517574u, 6755429753515468411u, 929172u},
{10899112525774686375u, 5322147284073737894u, 177279919491202035u, 593600957143310093u, 154996u},
{6536239966731470442u, 5004537090468546580u, 14860395034310464002u, 8217424892461834346u, 2057531u},
{9635866402238077889u, 13361756555251337323u, 16746958562614786886u, 5009928744615176163u, 1091279u},
{14418019652747213660u, 4161742605756651257u, 7252024352738705708u, 12197863941845763614u, 2390186u},
{3690751242878133745u, 1357251444293563710u, 3405346255116476424u, 18058489671110411480u, 2452663u},
{8884354494438447791u, 18257396216143614355u, 1947328475511158815u, 2351086673932240313u, 1572516u},
{11663903200490507524u, 16723779807808058321u, 3711967642423355165u, 17827233529923100315u, 1455863u},
{6350713148693756534u, 5472793569975335610u, 16001165561450181777u, 13285453252973356762u, 1361019u},
{7196143823434156761u, 4785875547581960460u, 3767073559708352574u, 17246871357522686057u, 1448695u},
{12915667836839069498u, 3848370932170070873u, 7397645704488294962u, 6800137562717960000u, 2293158u},
{279561028095290524u, 17665948925617459094u, 12591808902876062942u, 18200815003104557082u, 534033u},
{1014466257507712139u, 11840771384660824305u, 1525627097628953880u, 16222809846812515936u, 493424u},
{5778499859244332170u, 239287486616116946u, 11235711116246593027u, 5485479229353159044u, 1475334u},
{15827562941444384151u, 1882203109389839939u, 18022446613796125709u, 10403508655668344220u, 1287938u},
{10617363928325999389u, 16004449707254836050u, 2906321956832367953u, 4058983539196278404u, 3039506u},
{1572837626401424878u, 16717353587109129911u, 10891328483580322792u, 14035242236709507747u, 2090925u},
{4013646543180537715u, 10465368162944436926u, 17011449912082695626u, 17476508529566123892u, 2341155u},
{7334613124894770187u, 11045481991511767987u, 16227238705961063697u, 14598820700259837086u, 1049074u},
{9920066073374336886u, 16492983325224438894u, 7597119454862309828u, 16448483454838772882u, 2927851u},
{13394616778403033259u, 7785415074875790612u, 4560590352721251124u, 2215737155669276119u, 698675u},
{10928571732483674251u, 11933756357247984107u, 11890493039126391710u, 8659799565682788496u, 148914u},
{7989148123538360129u, 5352507825763642065u, 15719088971959752715u, 146862175182647821u, 1796094u},
{10391882985101183219u, 9150218065935334770u, 10751421471809048927u, 7743294648555476610u, 3282887u},
{14589635302984404535u, 8981796418648001305u, 6114579199245562112u, 3086977533648176089u, 3371711u},
{11660831417479146071u, 12259579797065747659u, 11748935419883368219u, 13753139960200796679u, 485274u},
{13390264473793791645u, 24910993518807165u, 2798361181829106818u, 6133847232260639849u, 470990u},
{3470242773902998213u, 14659890233930989434u, 18008812635260641118u, 14420207045710710893u, 311547u},
{12907859068092350164u, 16086974568506940195u, 7157721240988335137u, 14056977879592086555u, 2947763u},
{8251179107570303596u, 3811668176210728874u, 10926404289158350062u, 4449889880021532264u, 642976u},
{8093766228884096833u, 7467643073958945263u, 12569269789051847659u, 5848525935239590168u, 3129901u},
{17311902433977298412u, 13619323446148005800u, 10183712940102274416u, 8632590179084997918u, 1758807u},
{3008400851376462910u, 15902991501335165357u, 8007363231101877316u, 6733800516763937102u, 591631u},
{15785282909023622483u, 1111580227218342821u, 9150743487201641645u, 8657824956928225692u, 1281970u},
{2328049455322581378u, 243648968715481454u, 15004382635231025593u, 10039653752429981494u, 2083587u},
{13765383930480561096u, 10178776302361367814u, 17578051603214794385u, 16467566846831531423u, 3688325u},
{5452213069609480124u, 12500900122681739971u, 14676499349359960723u, 10876676709492422028u, 1031683u},
{15630942213536175708u, 14405402230239782635u, 15352704097385341306u, 7008617824821883392u, 2833202u},
{15866872391068835275u, 10626521610085046973u, 16222764483420727778u, 5024237347828767457u, 408003u},
{987459778602510876u, 7415049863893150574u, 308988605714341954u, 17445464089125103578u, 1684477u},
{13210694762062102892u, 3327654545986117185u, 9270750839110120763u, 18189586831120354005u, 2983214u},
{1824921960622170989u, 377096222442144674u, 8023002361367862100u, 14322434222874425525u, 1152031u},
{11293178811761037468u, 2123730037480286650u, 6127226634742215671u, 453596799571981527u, 2458865u},
{8718988959940011264u, 14922876261363392774u, 3804776868493412673u, 8259923774144183340u, 13657u},
{13657712062600689024u, 15763567487601503302u, 9050028945829595852u, 251935443738425u, 0u},
{10466626043363181657u, 6818666522446702205u, 8185529170695989287u, 251935u, 0u},
{2018209524826601272u, 10742761122394389465u, 4647388653739186u, 0u, 0u},
{4855442052952102466u, 12059359465839967396u, 4647388u, 0u, 0u},
{9325685136827616813u, 85729189106588351u, 0u, 0u, 0u},
{1966208041461408697u, 85729189u, 0u, 0u, 0u},
{1581424411095884124u, 0u, 0u, 0u, 0u},
{1581424412u, 0u, 0u, 0u, 0u}
};
constexpr uint64_t POW10_SPLIT_2[][5] = {

View File

@ -1101,6 +1101,79 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) {
"231934194956788626761834746430104077432547436359522462253411168467463134"
"24896.000000");
written = __llvm_libc::sprintf(big_buff, "%Lf", 0xf.fffffffffffffffp+16380L);
ASSERT_STREQ_LEN(
written, big_buff,
"118973149535723176502126385303097020516906332229462420044032373389173700"
"552297072261641029033652888285354569780749557731442744315367028843419812"
"557385374367867359320070697326320191591828296152436552951064679108661431"
"179063216977883889613478656060039914875343321145491116008867984515486651"
"285234014977303760000912547939396622315138362241783854274391783813871780"
"588948754057516822634765923557697480511372564902088485522249479139937758"
"502601177354918009979622602685950855888360815984690023564513234659447638"
"493985927645628457966177293040780660922910271504608538808795932778162298"
"682754783076808004015069494230341172895777710033571401055977524212405734"
"700738625166011082837911962300846927720096515350020847447079244384854591"
"288672300061908512647211195136146752763351956292759795725027800298079590"
"419313960302147099703527646744553092202267965628099149823208332964124103"
"850923918473478612192169721054348428704835340811304257300221642134891734"
"717423480071488075100206439051723424765600472176809648610799494341570347"
"632064355862420744350442438056613601760883747816538902780957697597728686"
"007148702828795556714140463261583262360276289631617397848425448686060994"
"827086796804807870251185893083854658422304090880599629459458620190376604"
"844679092600222541053077590106576067134720012584640695703025713896098375"
"799892695455305236856075868317922311363951946885088077187210470520395758"
"748001314313144425494391994017575316933939236688185618912993172910425292"
"123683515992232205099800167710278403536014082929639811512287776813570604"
"578934353545169653956125404884644716978689321167108722908808277835051822"
"885764606221873970285165508372099234948333443522898475123275372663606621"
"390228126470623407535207172405866507951821730346378263135339370677490195"
"019784169044182473806316282858685774143258116536404021840272491339332094"
"921949842244273042701987304453662035026238695780468200360144729199712309"
"553005720614186697485284685618651483271597448120312194675168637934309618"
"961510733006555242148519520176285859509105183947250286387163249416761380"
"499631979144187025430270675849519200883791516940158174004671147787720145"
"964446117520405945350476472180797576111172084627363927960033967047003761"
"337450955318415007379641260504792325166135484129188421134082301547330475"
"406707281876350361733290800595189632520707167390454777712968226520622565"
"143991937680440029238090311243791261477625596469422198137514696707944687"
"035800439250765945161837981185939204954403611491531078225107269148697980"
"924094677214272701240437718740921675661363493890045123235166814608932240"
"069799317601780533819184998193300841098599393876029260139091141452600372"
"028487213241195542428210183120421610446740462163533690058366460659115629"
"876474552506814500393294140413149540067760295100596225302282300363147382"
"468105964844244132486457313743759509641616804802412935187620466813563687"
"753281467553879887177183651289394719533506188500326760735438867336800207"
"438784965701457609034985757124304510203873049485425670247933932280911052"
"604153852899484920399109194612991249163328991799809438033787952209313146"
"694614970593966415237594928589096048991612194498998638483702248667224914"
"892467841020618336462741696957630763248023558797524525373703543388296086"
"275342774001633343405508353704850737454481975472222897528108302089868263"
"302028525992308416805453968791141829762998896457648276528750456285492426"
"516521775079951625966922911497778896235667095662713848201819134832168799"
"586365263762097828507009933729439678463987902491451422274252700636394232"
"799848397673998715441855420156224415492665301451550468548925862027608576"
"183712976335876121538256512963353814166394951655600026415918655485005705"
"261143195291991880795452239464962763563017858089669222640623538289853586"
"759599064700838568712381032959192649484625076899225841930548076362021508"
"902214922052806984201835084058693849381549890944546197789302911357651677"
"540623227829831403347327660395223160342282471752818181884430488092132193"
"355086987339586127607367086665237555567580317149010847732009642431878007"
"000879734603290627894355374356444885190719161645514115576193939969076741"
"515640282654366402676009508752394550734155613586793306603174472092444651"
"353236664764973540085196704077110364053815007348689179836404957060618953"
"500508984091382686953509006678332447257871219660441528492484004185093281"
"190896363417573989716659600075948780061916409485433875852065711654107226"
"099628815012314437794400874930194474433078438899570184271000480830501217"
"712356062289507626904285680004771889315808935851559386317665294808903126"
"774702966254511086154895839508779675546413794489596052797520987481383976"
"257859210575628440175934932416214833956535018919681138909184379573470326"
"940634289008780584694035245347939808067427323629788710086717580253156130"
"235606487870925986528841635097252953709111431720488774740553905400942537"
"542411931794417513706468964386151771884986701034153254238591108962471088"
"538580868883777725864856414593426212108664758848926003176234596076950884"
"9149662444156604419552086811989770240.000000");
written = __llvm_libc::sprintf(big_buff, "%.10Lf", 1e-10L);
ASSERT_STREQ_LEN(written, big_buff, "0.0000000001");
@ -1749,6 +1822,9 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) {
written = __llvm_libc::sprintf(buff, "%.9Le", 1000000000500000000.0L);
ASSERT_STREQ_LEN(written, buff, "1.000000000e+18");
written = __llvm_libc::sprintf(buff, "%Le", 0xf.fffffffffffffffp+16380L);
ASSERT_STREQ_LEN(written, buff, "1.189731e+4932");
#endif
// TODO: Fix long doubles (needs bigger table or alternate algorithm.)
@ -2378,6 +2454,9 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) {
// Length Modifier Tests.
written = __llvm_libc::sprintf(buff, "%Lg", 0xf.fffffffffffffffp+16380L);
ASSERT_STREQ_LEN(written, buff, "1.18973e+4932");
// TODO: Uncomment the below tests after long double support is added
/*
written = __llvm_libc::sprintf(buff, "%Lf", 1e100L);

View File

@ -173,10 +173,10 @@ if MOD_SIZE > (2**MID_INT_SIZE):
)
else:
print("static const uint64_t POW10_SPLIT[][" + str(MID_INT_SIZE // 64) + "] = {")
for idx in range(0, POSITIVE_ARR_SIZE):
for idx in range(0, POSITIVE_ARR_SIZE + 1):
num_size = print_positive_table_for_idx(idx)
positive_size_arr[idx] = acc
acc += num_size
positive_size_arr[idx + 1] = acc
print("};")
print(