Closed ngollon closed 1 month ago
I just tried the same thing with unit example = sqrt(m)
and got an error about recursion in rust.
See example here
To make it happen you have to write to lines yourself, the first just being one of the units and the other on the next. The first line gives the reported error and the second gives the recursion error.
[USER]: recursive use of an object detected which would
lead to unsafe aliasing in rust
@https://numbat.dev/pkg/numbat_wasm.js:535:24
<?>.wasm-function[1715]@[wasm code]
<?>.wasm-function[1714]@[wasm code]
<?>.wasm-function[843]@[wasm code]
interpret@https://numbat.dev/pkg/numbat_wasm.js:257:42
interpret@https://numbat.dev/index.js:68:38
s@https://numbat.dev/jquery.terminal.min.js:46:123943
me@https://numbat.dev/jquery.terminal.min.js:46:124921
ENTER@https://numbat.dev/jquery.terminal.min.js:46:45312
it@https://numbat.dev/jquery.terminal.min.js:46:64967
dispatch@https://numbat.dev/jquery.min.js:2:40002
Update: same error happens if you use just the example definition and try to print it twice the same way as in the original example.
Thank you very much for reporting this. Running this in debug mode on the command line shows a failing debug-assertion:
>>> unit test = sqrt(kg)
unit test: Mass^(1/2) = sqrt(kilogram)
>>> test
thread 'main' panicked at numbat/src/unit.rs:140:21:
assertion failed: key[0].1.is_integer()
This is now fixed.
Using the unit definition
unit test = sqrt(kg)
the web interface breaks and always shows the error
Link: https://numbat.dev/?q=unit+test+%3D+sqrt%28kg%29⏎test