helix-calc

Crates.iohelix-calc
lib.rshelix-calc
version1.3.0
created_at2025-03-05 12:32:53.070714+00
updated_at2025-05-25 02:40:12.791891+00
descriptionReverse Polish Notation calculator in a terminal app.
homepage
repositoryhttps://github.com/chbug/hc
max_upload_size
id1578956
size93,785
Fred (chbug)

documentation

README

Helix Calc is a simple Reverse Polish Notation calculator.

It's written in Rust, using Ratatui for the cross-platform interface and bigdecimal-rs for the internal operations.

The name is inspired by Helix Editor, and the functionality by the venerable GNU dc.

This is a toy app that fulfills my personal needs, but I'm open to PR :)

Operations

  • +, -, *, / : perform the arithmetic operation on the top two values.
  • % : compute the modulo of the second value divided by the first.
  • ^ : raise the second value to the power of the first.
  • P : pop the top value off the stack.
  • d : duplicate the top value.
  • v : compute the square root of the top value.
  • k : pop the top value and use it to set the precision.
  • r : swap the first two values.
  • [Up]: edit the value at the top of the stack.

Negative numbers

Two options to enter them:

  • Type them as _123.
  • Type them as 123- (careful, no space).

Limitations

By default, BigDecimal is compiled with a max precision of 100 digits: beyond that size, decimal places will be dropped, even if the integer part can handle much larger numbers.

Commit count: 38

cargo fmt