9个版本
0.3.1 | 2022年11月8日 |
---|---|
0.3.0 | 2022年10月21日 |
0.3.0-alpha.1 | 2022年7月5日 |
0.2.7 | 2019年11月7日 |
0.2.3 | 2019年3月31日 |
#171 in 数学
每月 129 次下载
45KB
1K SLoC
eva
简单的计算器REPL,类似于 bc(1)
,具有语法高亮和持久历史记录
安装
- Homebrew
$ brew install eva
- crates.io
$ cargo install eva
- 手动
$ git clone https://github.com/nerdypepper/eva.git
$ cargo run
用法
eva 0.3.1
NerdyPepper <[email protected]>
Calculator REPL similar to bc(1)
USAGE:
eva [OPTIONS] [INPUT]
ARGS:
<INPUT> Optional expression string to run eva in command mode
OPTIONS:
-b, --base <RADIX> Radix of calculation output (1 - 36) [default: 10]
-f, --fix <FIX> Number of decimal places in output (1 - 64) [default: 10]
-h, --help Print help information
-r, --radian Use radian mode
-V, --version Print version information
输入表达式并按回车键,重复。
> 1 + sin(30)
1.5
> floor(sqrt(3^2 + 5^2))
5
> 5sin(45) + cos(0)
4.53553
更新
- crates.io
$ cargo install eva --force
- 手动
$ cargo install --force --path /path/to/eva
运算符
- 二元运算符:
+ - * / ^ **
- 一元运算符:
+ -
常量
一些常量可以在Rust标准库中找到。
e pi
示例
pi * 5^2 # πr²
函数
所有三角函数均以度为单位输入。
1 argument:
sin cos tan csc sec cot sinh cosh tanh
asin acos atan acsc asec acot ln log10 sqrt
ceil floor abs
2 arguments:
log nroot
deg(x) - convert x to degrees
rad(x) - convert x to radians
示例
sqrt(sin(30)) # parentheses are mandatory for functions
log10100 # no
log10(100) # yes
log(1, 10) # function with two arguments
生活品质功能
- 自动插入
*
运算符
>12sin(45(2)) # 12 * sin(45 * (2))
12
- 自动平衡括号
>ceil(sqrt(3^2 + 5^2 # ceil(sqrt(3^2 + 5^2))
6
- 使用
_
使用上一个答案
> sin(pi)
0.0548036650
> _^2
0.0030034417
>
- 出色的错误处理
> 1 + ln(-1)
Domain Error: Out of bounds!
- 语法高亮
待办事项
添加对变量的支持(pi,e,_(上一个答案))语法高亮多参数函数屏幕截图创建标志一元运算符(减号,加号)添加详细的错误处理器添加单元测试lineditor带语法高亮添加更多功能
贡献者
Rust社区帮助eva取得了长足的进步,但以下开发者因其贡献而应特别提及
依赖关系
~8–22MB
~273K SLoC