@@ -391,14 +391,16 @@ for N in (0,3), M in (0,4), V in (Int, Float32)
391
391
392
392
# Exponentiation #
393
393
# ----------------#
394
-
395
- @test dual_isapprox (FDNUM^ FDNUM2, exp (FDNUM2 * log (FDNUM)))
396
- @test dual_isapprox (FDNUM^ PRIMAL, exp (PRIMAL * log (FDNUM)))
397
- @test dual_isapprox (PRIMAL^ FDNUM, exp (FDNUM * log (PRIMAL)))
398
-
399
- @test dual_isapprox (NESTED_FDNUM^ NESTED_FDNUM2, exp (NESTED_FDNUM2 * log (NESTED_FDNUM)))
400
- @test dual_isapprox (NESTED_FDNUM^ PRIMAL, exp (PRIMAL * log (NESTED_FDNUM)))
401
- @test dual_isapprox (PRIMAL^ NESTED_FDNUM, exp (NESTED_FDNUM * log (PRIMAL)))
394
+ # If V == Int, the LHS terms are Int's. Large inputs cause integer overflow
395
+ # within the generic fallback of `isapprox`, resulting in a DomainError.
396
+ # Promote to Float64 to avoid issues.
397
+ @test dual_isapprox (1.0 * FDNUM^ FDNUM2, exp (FDNUM2 * log (FDNUM)))
398
+ @test dual_isapprox (1.0 * FDNUM^ PRIMAL, exp (PRIMAL * log (FDNUM)))
399
+ @test dual_isapprox (1.0 * PRIMAL^ FDNUM, exp (FDNUM * log (PRIMAL)))
400
+
401
+ @test dual_isapprox (1.0 * NESTED_FDNUM^ NESTED_FDNUM2, exp (NESTED_FDNUM2 * log (NESTED_FDNUM)))
402
+ @test dual_isapprox (1.0 * NESTED_FDNUM^ PRIMAL, exp (PRIMAL * log (NESTED_FDNUM)))
403
+ @test dual_isapprox (1.0 * PRIMAL^ NESTED_FDNUM, exp (NESTED_FDNUM * log (PRIMAL)))
402
404
403
405
@test partials (NaNMath. pow (Dual {TestTag()} (- 2.0 , 1.0 ), Dual {TestTag()} (2.0 , 0.0 )), 1 ) == - 4.0
404
406
0 commit comments