cockroachdb / cockroachdb/apd

Ln func discrepancies across arch

Đang mở
#141 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
805
Fork
48
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## Description

When using `Context#Ln()` func we can observe different results depending on the system's arch, for example with the sample code below:

```go
var decCtx = &apd.Context{
Precision: 34,
MaxExponent: apd.MaxExponent,
MinExponent: apd.MinExponent,
Traps: apd.DefaultTraps,
Rounding: apd.RoundDown,
}
i, _, _ := apd.NewFromString("1.6285091944505809264504560045920167")
var r apd.Decimal
decCtx.Ln(&r, i)
fmt.Println(r.String())
```

The output on arm64 is `0.4876649916811116824516548471782886` and `0.4876649916811116824516548471782887` on amd64.

By investigating it seems the root cause is linked to the usage of `math.Log()` [here](https://github.com/cockroachdb/apd/blob/9cfbeb8698620942481da9e7fb4d46b5ac4df03d/context.go#L755) which is dependent on the system arch.

Is this difference expected? Is there a mean to mitigate this and have consistent results across arch?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.