Open
Conversation
|
Welcome back! @c9s, This pull request may get 268 BBG. |
zenixls2
reviewed
Oct 31, 2024
| bigB := big.NewInt(int64(b)) | ||
| result := new(big.Int).Mul(bigA, bigB) | ||
|
|
||
| // 恢復精度 (除以 10^8) |
Collaborator
There was a problem hiding this comment.
Please comment in English if possible
zenixls2
reviewed
Oct 31, 2024
|
|
||
| func Mul(x, y Value) Value { | ||
| return NewFromFloat(x.Float64() * y.Float64()) | ||
| return mulOp(x, y) |
Collaborator
There was a problem hiding this comment.
This might make the mul func slower since there's additional function call. Can you do some bench on the changes to convince people that this works better? Also it's rare that we need to multiply an integer.
narumiruna
reviewed
Oct 31, 2024
| result /= scaleFactor | ||
|
|
||
| return result | ||
| } |
Contributor
There was a problem hiding this comment.
func multiplyWithInt64(a, b Value) Value {
highA := a / 10000
lowA := a % 10000
highB := b / 10000
lowB := b % 10000
highResult := highA * highB
midResult1 := highA * lowB
midResult2 := lowA * highB
lowResult := lowA * lowB
result := (midResult1 + midResult2) + lowResult/10000
result /= 10000
result += highResult
return result
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.