本地编译需先装好 rustup、npm、wasm-pack 和 serve 四个工具;启动后要访问 /notecalc 路径而非根路径;默认监听 5000 端口,被占用时需改映射

notecalc3
bbodiAGPL-3.0更新放缓把笔记和计算结合起来的网页计算器,输入带变量的表达式就能像 Soulver 一样边记边算,支持矩阵和线性代数,用 Rust 编译成 WASM 在浏览器里跑。
NoteCalc is a handy calculator trying to bring the advantages of Soulver to the web.
git clone https://github.com/bbodi/notecalc3.git
cd notecalc3
docker build . --tag notecalc3
docker run --rm -d -p 5000:5000 notecalc3README 未说明,纯浏览器端 WebAssembly 应用,无需 GPU 或显存
浏览器里的智能记事本计算器,免费替代 Soulver,边写笔记边算数
把笔记和计算结合起来的网页计算器,输入带变量的表达式就能像 Soulver 一样边记边算,支持矩阵和线性代数,用 Rust 编译成 WASM 在浏览器里跑。
核心能力
- 在记事本中直接写表达式并即时显示结果
- 基于 mathjs 与 rust-decimal 做精确十进制运算
- 用 Rust 编译成 WebAssembly 在浏览器端运行
- 支持 Docker 一键构建并部署到本地 5000 端口
容易踩的坑
- v0.4.0最新正式版2024-03-07 · 2024-03-07 08:14 UTC
0.4.0 - 2024-03-07
Breaking Changes
- Empty matrices or matrices with invalid content are now considered as a valid matrix instead of plain text, so the matrix editor can be used on them
- Syntax of Line References has been changed to
{3}instead of {&[3]} (the previous syntax caused ambiguity during matrix parsing) This change should not affect users, since they use ALT+up/down to select and insert Line References - Matrix resizing now requires
alt+ctrlkeys instead of justalt - Autocompletion (ctrl space instead of tabs).
- Regions (paragraphs under different #Headers) are now have the same alignments across all the document
sumvariable is not set to zero anymore at headers. You can do that explicitly by writingsum = 0$is now a prefix operator, so the expression12$is now invalid and should be written as$12
Features
- #Headers appears in the Result area as well
- Name of the navigation tabs are now can be set: It gets the value of the first line if it is a
#Header - Word selection by double click
- When it comes to binary operations, single row matrices now work as arrays, meaning that the operation is applied
to all of their elements.
[2 3 4] + 1 ---> [3 4 5]Usecase
Let's say you want to compare job offers, so you make an array of offers (daily rate).
You calculate what those offers mean as a monthly income, including taxes etc.
In theComparisonpart you can see the summary of your calculations, what offer would end up in what monthly salary, and how they compare to your current salary.
Now if you got a new offer, it is enough just to add that offer to thedaily ratearray, and all the information (monthly profit after taxes and comparison to your current salary) will appear to this new offer.
All operators now work on Matrices when it makes sense.daily rate = [$90 $100 $120] █ [ 90 $ 100 $ 120 $] annual gross = (daily rate * 20) * 12 █ [21 600 $ 24 000 $ 28 800 $] tax free = $10k █ 10 000 $ tax base = annual gross - tax free █ [11 600 $ 14 000 $ 18 800 $] tax = tax base * 40% █ [ 4 640 $ 5 600 $ 7 520 $] net = annual gross - tax █ [16 960 $ 18 400 $ 21 280 $] monthly net = net / 12 █ [ 1 413 $ 1 533 $ 1 773 $] current monthly salary = $1000 █ 1 000 $ █ # Comparison █ daily rate █ [ 90 $ 100 $ 120 $] monthly net █ [1 413 $ 1 533 $ 1 773 $] monthly net is what % on current monthly salary █ [ 41 % 53 % 77 %] - Percentage operators work on quantities now:
5m is 25% of what ==> 20 m - Pasting back Exported text to the editor chops down the Result part
- User defined functions
- Pressing
ctrl-bon a funtion invocation jumps to its definition (same as for Line References and variables)
- Pressing
- Indent and Unindent lines (tab/shift+tab)
- Better editor handling, which paves the road for multiple cursors
- Better handling of period of times in calculations
So far every quantity was stored in the base unit (e.g. 10 years was stored as 315 576 000 seconds).
It caused precision problems in expressions like(10k/year cost + 3k/month tax) * 10 years,
resulting in a wrong output (459 999.9instead of460 000) &,|and~can be used as bitwise operators- Smart output units e.g.: By default the result was in seconds for
500$ / 20$/hour, now it is hours. - Only the changed digits are pulsed when a result ha
- v0.3.02020-12-21 · 2020-12-21 14:42 UTC
查看更新说明
[0.3.0] - 2020-12-21
Breaking Changes
- Spaces are not allowed in hex numbers anymore but undorscores are. It caused problems since 0xAA B could not be unambiguously parsed (e.g. it can be 0xAAB or 0xAA B, where 'B' is a unit for 'bytes', so make it explicit by writing 0xAA_B).
Features
- Dark Theme

- Render command optimizations, reducing render command count by around 40% (gutters, line number- and result backround are now rendered only once as a big rectangle and not line by line).
- Active references (variables and line refs in the cursor's row) are now just underlined and the referenced lines are not highlighted fully only their left and right gutter. (Look at the image below)
- Results where a denominator is a unit (e.g. 5 / year) are now rendered in a more user-friendly way (e.g. instead of
5 year^-1it is5 / year)
- Automatic closing parenthesis/braces insertion when the opening one is typed
- Automatic closing parenthesis/braces deletion when the opening one is deleted

- Automatic parenthesis/braces wrapping around selected text if opening one is typed while
a text is selected

- Matching parenthesis are highlighted if the cursor is inside them

- The note can be saved with
ctrl-s(Though it is still saved automatically when there is no user interaction) - It is possible to apply units directly on Line References or Variables, e.g.
The result of the second line will bevar = 12 var km12 km - Parsing improvement: Now the parser are smarter in deciding what is an operator (e.g. 'in' in
12 m in cm), a unit (12 inwhich is 12 inch), or a simple string (I downloaded 12 GB in 3 seconds). Now it is even possible to evaluate this string12 in in in, which is equivalent of12 inch in inch
- Percentage calculations

- Max row count was increased from 128 to 256
- e (Euler's Number) was added, currently as a function (
e()) - Invalid argument types for functions are highlighted as errors (See image below)
- new functions:
- abs(num)
- ln(num)
- lg(num)
- log(num, num)
- sin(angle) -> num
- cos(angle) -> num
- tan(angle) -> num
- asin(num) -> angle
- acos(num) -> angle
- atan(num) -> angle
Changed
- When opening a not empty note, the result panel now tries to be as close to the editor as possible to have a better overview about calculations and their results.
- GitHub and website links were added to the NoteCalc page
- Strings at the frontend are now rendered char by char. It is necessary to be able to place the cursor at the right place, since the text rendering does not guarantee that a single char takes exactly 'char-width' pixels.
- Overlay canvas
- v0.2.02020-12-03 · 2020-12-03 17:18 UTC
查看更新说明
[0.2.0] - 2020-12-03
Breaking Changes
--does not set thesumvariable to zero, but every header does
Features
- Mobile support for index.html and notecalc itself
- typing using the native virtual keyboard
- scrolling
- High DPI rendering
- Headers (
# Header) and region-specific alignments (different regions under different headers can have different alignments, making the result output more ergonomic). - Comments are supported (e.g.
12 + 3 // it should be 15) - Hovering effect for the scrollbar
- Cursor changes to 'w-resize' when above the right gutter to highlight that it is draggable
- Line count limitation was increased from 64 to 128
- Default precision limitation both from the result panel and from the inserted line references was removed. It caused problems since very small numbers could appear as "0" due to roundings. It might be inconvenient in some situations but will be fixed when rounding specifiers will be implemented. Though, NoteCalc tries its best to render a compact form (e.g. removes repetends etc)
Changed
- Tutorial is updated with the new features and now stored in GIT
- Leangains demo is updated
Fixes
- In case a line reference was rendered outside of the editor area, '...' did not appear at the edge of the editor
- Firefox tracking protection issue for webfont.js
- Variable-reference pulsing pulsed continously when the right gutter was dragged
- The result panel is automatically resizing now with respect to browser width, required space for results and required space for the editor panel's content
- The binary and hex representation gives Err for quantities and percentages
- Lines that are too long and are covered by the result panel renders dots ('...') on the panel.
- The dots for matrices are now rendered for all the matrix's rows
- '…' was not rendered correctly for Matrices
- Ctrl-t is not absorbed by the frontend anymore
- Undoing (Ctrl-z) a selection removal with DEL button was buggy and only the first line of the selection was reparsed
- Pulses (which highlights the usage places of variable/lineref under the cursor) appeared too slowly when navigating with cursor or mouse, making it more difficult for the user to notice it immediately.
- Space is automatically inserted in front of a just-inserted line reference
- Right gutter alignment was a render pass late to the input which caused it
- Cursor was not visible at the right edge of the editor
- Global static RESULT_BUFFER is now part of the lib and not of the frontend (introduces some unsafe code but less trouble with the borrow checker)
- Fixed error when variable name is empty
Removed
- local.html was removed, you can access now the debug functionality and local wasm file
via
host/notecalc?debug
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。

What is NoteCalc?
NoteCalc is a handy notepad with a smart builtin calculator.
Honestly, it just tries to be a free Soulver alternative in your browser.
Roadmap
- User-defined functions (0.4.0)
- Conditionals & comparisons (0.4.0)
- Configurations (decimal point, font size etc) (0.4.0)
- Embeddable expressions
- Error messages
- Autocompletion
- Currencies
- Arbitrary large calculation
- Laptimes
- Timestamps
- Financial functions
- Line wrapping
- Time zone math
- Embeddable NoteCalc
- Better result outputs (scientific notation, SI suffixes etc)
- Search
- Specifiers (e.g. xy as number)
Run locally
First, you will need to make sure that the following tools are installed:
rustup. Instructions herenpm. Instructions herewasm-pack. Instructions hereserve. Simply run:npm install -g serve
Once the above tools are installed, you can run:
git clone https://github.com/bbodi/notecalc3.git
./compile_and_run.bat
Then, open your browser and go to http://localhost:5000/notecalc.
Run using docker
You can also run using a container with this command:
git clone https://github.com/bbodi/notecalc3.git
cd notecalc3
docker build . --tag notecalc3
docker run --rm -d -p 5000:5000 notecalc3
Then, open your browser and go to http://localhost:5000/notecalc.
Libraries used
Huge thanks for the following libraries