Skip to content

Proposal: Integrate Microsoft CalcManager as calculation engine backend #53

Description

@dongfengweixiao

Summary

I would like to propose integrating Microsoft Calculator's CalcManager as the backend calculation engine for the COSMIC calculator project. This change would leverage Microsoft's mature, extensively-tested calculation logic while maintaining the native COSMIC desktop experience.

Motivation

The current COSMIC calculator provides a solid user experience for the desktop environment. However, adopting Microsoft's CalcManager could offer several significant benefits:

  1. Proven Reliability: Microsoft CalcManager has been battle-tested across millions of Windows installations and handles edge cases in arithmetic operations with high reliability.
  2. Feature Completeness: CalcManager provides: - Infinite precision for basic arithmetic operations
    • Advanced scientific calculations
    • Programmer calculator functionality
    • Date calculations
    • Unit conversions
  3. Active Maintenance: Microsoft actively maintains and improves the CalcManager codebase, ensuring bug fixes and performance improvements.

Evidence of Feasibility

A concrete example demonstrates that this integration is viable:

  • Project: dongfengweixiao/calculator
  • Architecture: Flutter frontend + CalcManager backend via FFI
  • Platform: Successfully works on Linux (among other platforms)
  • Features: Implements standard, scientific, and programmer modes with full CalcManager functionality

This project serves as a reference implementation showing that CalcManager can be effectively integrated into cross-platform applications, including Linux environments.

Migration Strategy

Phase 1: Proof of concept with basic operations
Phase 2: Full feature parity with current implementation
Phase 3: Enhanced features leveraging CalcManager capabilities

Potential Challenges

  • Integration Complexity: Bridging Rust frontend with C#/C++ CalcManager may require FFI or wrapper development
  • Dependencies: Managing CalcManager build dependencies within the COSMIC build system
  • License Compatibility: CalcManager uses MIT license (compatible with GPL-3.0)

Community Impact

This integration would:

  • Improve calculation accuracy and reliability
  • Enable advanced calculator modes without reinventing the wheel
  • Benefit from ongoing Microsoft improvements
  • Potentially reduce maintenance burden on the COSMIC team

References

I would appreciate the community's feedback on this proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions