Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Num.div by 0 on Dec should crash, but doesn't #6027

Closed
rtfeldman opened this issue Nov 20, 2023 · 2 comments · Fixed by #6062
Closed

Num.div by 0 on Dec should crash, but doesn't #6027

rtfeldman opened this issue Nov 20, 2023 · 2 comments · Fixed by #6062
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@rtfeldman
Copy link
Contributor

rtfeldman commented Nov 20, 2023

To reproduce, in the repl:

» 1/0

  1000000000000000000 : Frac *

Expected behavior: a crash report on division by zero, like you get for integer divide by zero.

(This can't return something like infinity or NaN because it's a Dec, not a float, and Dec's fixed-point representation is based on integers; it doesn't have an equivalent concept.)

@rtfeldman rtfeldman added bug Something isn't working good first issue Good for newcomers labels Nov 20, 2023
@JRMurr
Copy link
Contributor

JRMurr commented Nov 21, 2023

Ill give this a shot

@JRMurr
Copy link
Contributor

JRMurr commented Nov 21, 2023

Looks like there is a difference for this on the local vs web repl

If you run the dev repl locally i see

  The rockin' roc repl
────────────────────────

Enter an expression, or :help, or :q to quit.

» 1/0
thread 'main' panicked at 'not yet implemented: NumDiv: layout, Builtin(Decimal)', crates/compiler/gen_dev/src/generic64/mod.rs:1603:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

building the site of off main and using the repl there was the original issue mentioned.

I will work on a fix for both cases EDIT: looks like dec division in the dev generator is not supported entirely at the moment.

Will make sure the wasm generator at least will panic in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants