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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal division by 0 #101

Open
kaidesu opened this issue Jan 29, 2022 · 0 comments
Open

Decimal division by 0 #101

kaidesu opened this issue Jan 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@kaidesu
Copy link
Member

kaidesu commented Jan 29, 2022

Panic is thrown when attempting to divide by 0 馃檭

Ghost (1.0-beta.1)
Press Ctrl + C to exit

>> 1/0
panic: decimal division by 0

goroutine 1 [running]:
github.com/shopspring/decimal.Decimal.QuoRem({0xc0000c6640, 0x0}, {0xc0000c6660, 0x0}, 0x10)
	/Users/kai/Go/pkg/mod/github.com/shopspring/decimal@v1.3.1/decimal.go:565 +0x2c5
github.com/shopspring/decimal.Decimal.DivRound({0xc0000c6640, 0x3}, {0xc0000c6660, 0xc3888}, 0x10)
	/Users/kai/Go/pkg/mod/github.com/shopspring/decimal@v1.3.1/decimal.go:607 +0x56
github.com/shopspring/decimal.Decimal.Div(...)
	/Users/kai/Go/pkg/mod/github.com/shopspring/decimal@v1.3.1/decimal.go:552
ghostlang.org/x/ghost/evaluator.evaluateNumberInfix(0xc0000dc120, {0x43f2170, 0xc0000990c0}, {0x43f2170, 0xc0000990d0})
	/Users/kai/Code/Ghost/ghost/src/evaluator/number.go:25 +0x5d3
ghostlang.org/x/ghost/evaluator.evaluateInfix(0xc0000dc120, 0xa)
	/Users/kai/Code/Ghost/ghost/src/evaluator/infix.go:25 +0x1fd
ghostlang.org/x/ghost/evaluator.Evaluate({0x430cf60, 0xc0000dc120}, 0x414d297)
	/Users/kai/Code/Ghost/ghost/src/evaluator/evaluator.go:54 +0x617
ghostlang.org/x/ghost/evaluator.Evaluate({0x430cce0, 0xc0000c6620}, 0xc0000cc140)
	/Users/kai/Code/Ghost/ghost/src/evaluator/evaluator.go:36 +0x4c9
ghostlang.org/x/ghost/evaluator.evaluateProgram(0x3, 0x0)
	/Users/kai/Code/Ghost/ghost/src/evaluator/program.go:12 +0x77
ghostlang.org/x/ghost/evaluator.Evaluate({0x430d120, 0xc0000a65e8}, 0x40cfa25)
	/Users/kai/Code/Ghost/ghost/src/evaluator/evaluator.go:18 +0xc8
ghostlang.org/x/ghost/ghost.(*Ghost).Execute(0xc0000c3d90)
	/Users/kai/Code/Ghost/ghost/src/ghost/ghost.go:76 +0x18a
ghostlang.org/x/ghost/repl.evaluate(0xc0000c3d90, {0xc0000b2370, 0x3})
	/Users/kai/Code/Ghost/ghost/src/repl/repl.go:59 +0xb9
ghostlang.org/x/ghost/repl.Start({0x43ebc20, 0xc0000ae008}, {0x437e89d, 0x18})
	/Users/kai/Code/Ghost/ghost/src/repl/repl.go:45 +0x2e6
main.main()
	/Users/kai/Code/Ghost/ghost/src/cmd/ghost.go:64 +0x677
exit status 2
make: *** [run] Error 1
@kaidesu kaidesu added the bug Something isn't working label Jan 29, 2022
@kaidesu kaidesu added this to the v1.0 Beta 2 milestone Jan 29, 2022
@kaidesu kaidesu self-assigned this Jan 29, 2022
@kaidesu kaidesu changed the title decimal division by 0 Decimal division by 0 Jan 29, 2022
@kaidesu kaidesu removed their assignment Oct 27, 2023
@kaidesu kaidesu removed this from the v1.0 Beta 2 milestone Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant