technoblogy / ulisp-esp

A version of the Lisp programming language for ESP32-based boards.
MIT License
110 stars 37 forks source link

bug in `fromradix40` #60

Closed dragoncoder047 closed 1 year ago

dragoncoder047 commented 1 year ago

The existing definition of fromradix40 returns \0 when it is passed 10 instead of the expected 9 (toradix40 correctly returns 10 when passed 9).

Here's the fix:

 char fromradix40 (char n) {
-    if (n >= 1 && n <= 9) return '0'+n-1;
+    if (n >= 1 && n <= 10) return '0'+n-1;
     if (n >= 11 && n <= 36) return 'a'+n-11;
     if (n == 37) return '-'; if (n == 38) return '*'; if (n == 39) return '$';
     return 0;
 }
technoblogy commented 1 year ago

You're right!

> (defvar abc9 2)
abc

How has that gone unnoticed for so long? Thanks for spotting it - I'll release a fix.

technoblogy commented 1 year ago

Fixed in 4.4b - thanks!