swift-lispkit icon indicating copy to clipboard operation
swift-lispkit copied to clipboard

`(lispkit math)` truncation procedures do not guard against zero divisor

Open csutter opened this issue 2 years ago • 1 comments

Unlike division, implementations of the truncation procedures in (lispkit math) (such as truncate-remainder) do not guard against the divisor (n2) being zero, and this causes LispPad to crash when the procedure is evaluated.

How to reproduce:

➤ (/ 2 0) ; ⚠️ 〚eval error〛 division by zero
➤ (truncate-remainder 2 0) ; app crashes

Happy to attempt a PR but I reckon my Swift is good enough to find the problem, but not good enough to come up with an elegant solution!

PS: Thank you so much for building software that has brought me so much joy ❤️ Never thought I'd be writing Lisp on the couch on my iPad!

csutter avatar Apr 13 '22 18:04 csutter

Thanks a lot for the bug report! This is indeed pretty bad. Have just fixed the "division by zero" issues. It will take a few more weeks before this change is available via LispPad.

Great to hear you like LispPad!

objecthub avatar Apr 29 '22 22:04 objecthub

The new releases of LispPad and LispPad Go fix this problem finally. Thanks for reporting the bug!

objecthub avatar Aug 18 '22 21:08 objecthub