VisActor / VisActor/VTable

[Bug] 透视表数据聚合时,计算精度有问题,出现0.1+0.2=0.30000000000000004

Open
#4,296 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
486
Avg merge
1d 19h
Merged PRs (30d)
16

Description

Version

1.19.5

Link to Minimal Reproduction

https://visactor.io/vtable/demo/data-analysis/pivot-analysis-updateTotalData

Steps to Reproduce

总计小计时,表内数据聚合时
SUM 和 AVG 这两个聚合方法内,计算都有问题

Current Behavior
Image
Expected Behavior

修复js计算时,精度问题

Environment
- OS:
- Browser:
- Framework:
Any additional comments?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked pivot-analysis-updateTotalData demo and reproduce the precision issue in the total and subtotal calculations. Trace the SUM and AVG aggregation entry points, then verify that decimal results no longer expose artifacts such as 0.30000000000000004 while preserving the expected aggregation values.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data, data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.