bgkillas / kalc Goto Github PK
View Code? Open in Web Editor NEWa complex numbers, 2d/3d graphing, arbitrary precision, vector/matrix, cli calculator with real-time output and support for units
License: GNU General Public License v3.0
a complex numbers, 2d/3d graphing, arbitrary precision, vector/matrix, cli calculator with real-time output and support for units
License: GNU General Public License v3.0
error[E0658]: use of unstable library feature 'is_terminal'
--> src/main.rs:12:35
|
12 | use std::io::{BufRead, BufReader, IsTerminal, stdout, Write};
| ^^^^^^^^^^
|
= note: see issue #98070 <https://github.com/rust-lang/rust/issues/98070> for more information
error[E0658]: use of unstable library feature 'is_terminal'
--> src/main.rs:214:17
|
214 | if !stdin().is_terminal()
| ^^^^^^^^^^^
|
= note: see issue #98070 <https://github.com/rust-lang/rust/issues/98070> for more information
For more information about this error, try `rustc --explain E0658`.
error: could not compile `kalc` due to 2 previous errors
==> ERROR: A failure occurred in build().
Seems like the use of is_terminal is unstable and as such it does not build anymore when is_terminal()
started getting used
.01
1/100
1e-3
Also, if I type 1e-2 kalc gives me back 1e-3:
1e-2
1/100
1e-3
In both cases kalc should give me back 1e-2
Currently, when you launch kalc
, you get a blinking cursor waiting for input. I think that this is unintuitive since it is hard to know if the program has started and is working, rather than being hung.
I suggest then when waiting for input, there is a symbol like >
that suggests that the program is waiting for an input.
Upon startup, I think there should be some banner or something similar to Python so that it is clear that the program has started. This also makes the cli more in line with other clis with a repl and the cli will feel more "complete".
~ ❯ python3 18:24:47 took 6s
Python 3.11.3 (main, Apr 5 2023, 15:52:25) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Another example (albeit a lot longer):
~ ❯ gdb 18:28:31
GNU gdb (GDB) 13.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)
I would do a PR for it, but I don't know what message you would upon startup and what character(s) you'd want to use for the prompt.
When some text is in the input line and the cursor is at the end of the text, after pressing 'delete' the program crashes.
Steps to reproduce:
Result:
>>> kalc
> asdfthread 'main' panicked at kalc-1.1.0/src/main.rs:885:35:
removal index (is 4) should be < len (is 4)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
zsh: IOT instruction (core dumped) kalc
2e6 * 5
2e30
It should be 10e6 or 1e7
Great work on the kalc
terminal calculator application. I am thoroughly enjoying it.
However, one dampener on the user experience is that there is no support for readline motions on the command line. This makes it really tedious to edit and move around to edit the expression to be calculated. Nearly every reasonable CLI program has a readline-like feature (it is almost a given), and I hope that kalc
also implements this feature soon.
Once again, congrats on making this impressive and useful application.
Steps to reproduce:
$ kalc
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 1', src/parse.rs:23:12
note: run withRUST_BACKTRACE=1
environment variable to display a backtrace
10e6 / 60e3
500000000/3
1.66666666667e8
It should be:
10000000 / 60000
500/3
1.66666666667e2
I'm getting some weird results when adding 2 numbers together.
47 + 42
1.974e3
47 + 42 + 5.51
543837/50
1.087674e4
$ cat -p ~/.config/kalc.config
sci=true
deg or grad or rad
base=10
tau=false
polar=false
frac=true
rt=false
deci=12
color=true
prompt=true
comma=false
prec=512
frac_iter=50
xr=-10,10
yr=-10,10
zr=-10,10
2d=20000
3d=400
point=.
line=false
multi=false
tabbed=false
vars=true
debug=false
small_e=true
I tried to run this in MSYS and it panicked with
thread 'main' panicked at 'called 'Result::unwrap()' on an 'Err' value: Os { code: 1, kind: Uncategorized, message: "Função incorreta." }', src/main.rs:692:31
It would be awesome to have kalc on macOS! I can help with testing on Apple silicon versions (and older Intel versions if neccessary).
Whenever you set a variable a second time, it seems like the program is trying to execute a multiply operation on the previous set value.
~ ➜ kalc 08:23:45
> 2*8
16
> x=2
> 16*x
32
> x=4
8 <-- preview result, goes away when I press enter
> x=6
24 <-- preview result, goes away when I press enter
If you press enter after x=4
, the "8" preview disappears so I don't think this is what is expected. It seems like it is executing 2*4
or whatever I put for the line x=4
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.