Skip to content

Commit 311bf8a

Browse files
committed
_compute_step_acc: compute Pth root in step computation using Rationals instead of floats
This makes working with units more exact, since the powers of Unitful units are always rational. Without this, we get powers such as 74981274124 / 1249141204412 for units.
1 parent 15eeec1 commit 311bf8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/methods.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ function _compute_step_acc(
399399
# Set the step size by minimising an upper bound on the error of the estimate.
400400
C₁ = f_error * m.f_error_mult * m.factor
401401
C₂ = ∇f_magnitude * m.∇f_magnitude_mult
402-
step = (Q / (P - Q) * (C₁ / C₂))^(1 / P)
402+
step = (Q / (P - Q) * (C₁ / C₂))^(1 // P)
403403
# Estimate the accuracy of the method.
404404
acc = C₁ * step^(-Q) + C₂ * step^(P - Q)
405405
return step, acc

0 commit comments

Comments
 (0)