Replace double with deterministic money representation

Open
#44 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
dart, flutter

Research direction

Start by reading the listed money fields and calculation entry points: Split.amount, Expense.amount, Settlement.amount, calculation_utils.dart, settlement.dart, and validation_utils.dart. Check PR #40 for related context, then trace how values are validated and used in settlement calculations. Done means money uses integer cents consistently, validation and calculations are updated, and the unit tests cover the changed behavior.

Written by the indexing model from the issue text.

Description

Summary

CodeRabbit identified potential precision issues caused by using double for monetary values in financial calculations.

Problem

Financial values should use a deterministic representation to avoid floating-point rounding errors.

Affected areas:

  • Split.amount
  • Expense.amount
  • Settlement.amount
  • calculation_utils.dart
  • settlement.dart
  • validation_utils.dart

Proposed Solution

  • Replace money values with integer cents representation
  • Update validation logic
  • Update settlement calculations
  • Update unit tests

Reference

Related to PR #40

Dominant language
Dart
Stars
20
Forks
39
Avg merge
3d 12h
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from StabilityNexus/Zplit

All issues in StabilityNexus/Zplit

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.