Files
calculation/readme.hints.md

36 lines
1.3 KiB
Markdown
Raw Normal View History

# Project Hints
## Architecture
This project follows the @push.rocks/smartstate pattern with the following structure:
- TypeScript source files in `ts/` directory
- Test files in `test/` directory
- Built files output to `dist_ts/` directory
- ES modules configuration (`"type": "module"`)
## Key Design Decisions
1. **Decimal Precision**: Uses decimal.js library to avoid JavaScript floating-point errors
2. **Class Hierarchy**: Calculator is the base class, other classes extend it for specific domains
3. **Naming Convention**: Files follow pattern `calculation.classes.*.ts`
4. **Plugin Pattern**: Dependencies are imported through `calculation.plugins.ts`
## Development Workflow
1. Run tests: `pnpm test`
2. Build project: `pnpm build`
3. Type checking: `tsbuild check test/**/* --skiplibcheck`
4. Testing uses @git.zone/tstest with expect from @push.rocks/tapbundle
## Financial Calculations
- All monetary calculations use decimal arithmetic for accuracy
- Interest calculations support multiple compounding frequencies
- Financial functions follow standard financial formulas
- Currency class handles formatting based on locale conventions
## Testing Strategy
- Cross-platform tests in `test.both.ts`
- Tests cover accuracy, edge cases, and error handling
- Precision tests ensure decimal accuracy is maintained