Skip to content

Commit

Permalink
chore: clarify least power of two comment in sqrt function
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg committed Dec 25, 2021
1 parent f025669 commit a9f6526
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/PRBMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ library PRBMath {
return 0;
}

// Set the initial guess to the closest power of two that is at least sqrt(x).
// Set the initial guess to the least power of two that is greater than or equal to x.
uint256 xAux = uint256(x);
result = 1;
if (xAux >= 0x100000000000000000000000000000000) {
Expand Down

1 comment on commit a9f6526

@transmissions11
Copy link
Contributor

@transmissions11 transmissions11 commented on a9f6526 Dec 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean greater than or equal to sqrt(x)? didn't we discuss that the next comment proves that the initial guess is lower than x? 😅

Screen Shot 2021-12-25 at 12 22 23 PM

Please sign in to comment.