MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / chudBS

Function chudBS

src/big-decimal/utils.ts:541–562  ·  view source on GitHub ↗
(a: number, b: number)

Source from the content-addressed store, hash-verified

539 '4201995611212902196086403441815981362977477130996051870721134999999837297804995105973173281609631859' +
540 '5024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303' +
541 '5982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989' +
542 '3809525720106548586327886593615338182796823030195203530185296899577362259941389124972177528347913151' +
543 '557485724245415069595082953311686172785588907509838175463746493931925506040092770167113900984882401285836160356370766010471018194295559619894676783744944825537977472684710404753464620804668425906949129331367702898915210475216205696602405803815019351125338243003558764024749647326391419927260426992279678235478163600934172164121992458631503028618297455570674983850549458858692699569092721079750930295532116534498720275596023648066549911988183479775356636980742654252786255181841757467289097777279380008164706001614524919217321721477235014144197356854816136115735255213347574184946843852332390739414333454776241686251898356948556209921922218427255025425688767179049460165346680498862723279178608578438382796797668145410095388378636095068006422512520511739298489608412848862694560424196528502221066118630674427862203919494504712371378696095636437191728746776465757396241389086583264599581339047802759009946576407895126946839835259570982582262052248940772671947826848260147699090264013639443745530506820349625245174939965143142980919065925093722169646151570985838741059788595977297549893016175392846813826868386894277415599185592524595395943104997252468084598727364469584865383673622262609912460805124388439045124413654976278079771569143599770012961608944169486855584840635';
544
545const LOG10_2 = Math.log10(2); // ≈ 0.30103
546
547/**
548 * Fractional digits of ln(2) (2400 digits, no leading "0."). Lets the AGM
549 * logarithm obtain ln 2 instantly instead of bootstrapping it with a full
550 * Newton evaluation (which would make a one-shot high-precision ln regress).
551 * Beyond this table `lnTwoFixed` falls back to Newton.
552 */
553const LN2_DIGITS =
554 '693147180559945309417232121458176568075500134360255254120680009493393621969694715605863326996418687542001481020570685733685520235758130557032670751635075961930727570828371435190307038623891673471123350115364497955239120475172681574932065155524734139525882950453007095326366642654104239157814952043740430385500801944170641671518644712839968171784546957026271631064546150257207402481637773389638550695260668341137273873722928956493547025762652098859693201965058554764703306793654432547632744951250406069438147104689946506220167720424524529612687946546193165174681392672504103802546259656869144192871608' +
555 '293803172714367782654877566485085674077648451464439940461422603193096735402574446070308096085047486638523138181676751438667476647890881437141985494231519973548803751658612753529166100071053558249879414729509293113897155998205654392871700072180857610252368892132449713893203784393530887748259701715591070882368362758984258918535302436342143670611892367891923723146723217205340164925687274778234453534764811494186423867767744060695626573796008670762571991847340226514628379048830620330611446300737194890027436439650025809365194430411911506080948793067865158870900605203468429736193841289652556539686022' +
556 '194122924207574321757489097706752687115817051137009158942665478595964890653058460258668382940022833005382074005677053046787001841624044188332327983863490015631218895606505531512721993983320307514084260914790012651682434438935724727882054862715527418772430024897945401961872339808608316648114909306675193393128904316413706813977764981769748689038877899912965036192707108892641052309247839173735012298424204995689359922066022046549415106139187885744245577510206837030866619480896412186807790208181588580001688115973056186676199187395200766719214592236720602539595436541655311295175989940056000366513567' +
557 '569051245926825743946483168332624901803824240824231452306140963805700702551387702681785163069025513703234053802145019015374029509942262995779647427138157363801729873940704242179972266962979939312706935747240493386530879758721699645129446491883771156701678598804981838896784134938314014073166472765327635919233511233389338709513209059272185471328975470797891384445466676192702885533423429899321803769154973340267546758873236778342916191810430116091695265547859732891763545556742863877463987101912431754255888301206779210280341206879759143081283307230300883494705792496591005860012341561757413272465943';
558
559// ================================================================
560// PI via Chudnovsky binary splitting (for precision beyond the table)
561// ================================================================
562
563// 1/π = 12 Σ (−1)^k (6k)!(A + Bk) / ((3k)!(k!)³ C^(3k+3/2)), C = 640320.
564// Computed by binary splitting: bs(a,b) returns (P, Q, T) with the partial
565// sum over [a,b) equal to T/Q (the per-term constants folded in), so the whole

Callers 2

piChudnovskyBitsFunction · 0.85
piChudnovskyDecimalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected