@@ -3939,31 +3939,26 @@ public static function providerNthRoot(): Generator
39393939 // 2^100 is exact.
39403940 ['1267650600228229401496703205376 ' , 100 , RoundingMode::Unnecessary, '2 ' ],
39413941
3942- // ∛17 ≈ 2.5713
3943- ['17 ' , 3 , RoundingMode::Unnecessary, null ],
3944- ['17 ' , 3 , RoundingMode::Down, '2 ' ],
3945- ['17 ' , 3 , RoundingMode::Up, '3 ' ],
3946- ['17 ' , 3 , RoundingMode::HalfUp, '3 ' ],
3947- // ∛16 ≈ 2.5198
3948- ['16 ' , 3 , RoundingMode::Unnecessary, null ],
3949- ['16 ' , 3 , RoundingMode::Down, '2 ' ],
3950- ['16 ' , 3 , RoundingMode::Up, '3 ' ],
3951- ['16 ' , 3 , RoundingMode::HalfUp, '3 ' ],
3952- // ∛864 ≈ 9.5224
3953- ['864 ' , 3 , RoundingMode::Unnecessary, null ],
3954- ['864 ' , 3 , RoundingMode::Down, '9 ' ],
3955- ['864 ' , 3 , RoundingMode::Up, '10 ' ],
3956- ['864 ' , 3 , RoundingMode::HalfUp, '10 ' ],
3957- // 8^¼ ≈ 1.6818
3958- ['8 ' , 4 , RoundingMode::Unnecessary, null ],
3959- ['8 ' , 4 , RoundingMode::Down, '1 ' ],
3960- ['8 ' , 4 , RoundingMode::Up, '2 ' ],
3961- ['8 ' , 4 , RoundingMode::HalfUp, '2 ' ],
3962- // ∛-17 ≈ -2.5713
3963- ['-17 ' , 3 , RoundingMode::Unnecessary, null ],
3964- ['-17 ' , 3 , RoundingMode::Down, '-2 ' ],
3965- ['-17 ' , 3 , RoundingMode::Up, '-3 ' ],
3966- ['-17 ' , 3 , RoundingMode::HalfUp, '-3 ' ],
3942+ // Tightest possible Half* boundaries, where 2^n·|V| differs from (2·|t|+1)^n by ±1.
3943+ // V=43, n=3: 2^3·43 = 344 vs 7^3 = 343 (diff +1) → smallest "round up". ∛43 ≈ 3.5034.
3944+ ['43 ' , 3 , RoundingMode::Unnecessary, null ],
3945+ ['43 ' , 3 , RoundingMode::Down, '3 ' ],
3946+ ['43 ' , 3 , RoundingMode::Up, '4 ' ],
3947+ ['43 ' , 3 , RoundingMode::HalfUp, '4 ' ],
3948+ ['-43 ' , 3 , RoundingMode::Unnecessary, null ],
3949+ ['-43 ' , 3 , RoundingMode::Down, '-3 ' ],
3950+ ['-43 ' , 3 , RoundingMode::Up, '-4 ' ],
3951+ ['-43 ' , 3 , RoundingMode::HalfUp, '-4 ' ],
3952+
3953+ // V=91, n=3: 2^3·91 = 728 vs 9^3 = 729 (diff -1) → smallest "round down". ∛91 ≈ 4.4979.
3954+ ['91 ' , 3 , RoundingMode::Unnecessary, null ],
3955+ ['91 ' , 3 , RoundingMode::Down, '4 ' ],
3956+ ['91 ' , 3 , RoundingMode::Up, '5 ' ],
3957+ ['91 ' , 3 , RoundingMode::HalfUp, '4 ' ],
3958+ ['-91 ' , 3 , RoundingMode::Unnecessary, null ],
3959+ ['-91 ' , 3 , RoundingMode::Down, '-4 ' ],
3960+ ['-91 ' , 3 , RoundingMode::Up, '-5 ' ],
3961+ ['-91 ' , 3 , RoundingMode::HalfUp, '-4 ' ],
39673962 ];
39683963
39693964 foreach ($ tests as [$ number , $ n , $ roundingMode , $ expected ]) {
0 commit comments