Search found 34 matches

by Zezombye
Thu Nov 29, 2018 3:06 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

Hi, Unfortunately I have 2 more problems with Micropython. The first one is that, for some reason, my app crashes when I call a recursive function with too much depth. For example, this simple recursive function: def r(n): if n == 0: return 0 else: return 1+r(n-1) Calling up to r(63) works fine, but...
by Zezombye
Sat Nov 24, 2018 9:44 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

I would like to allow the user to get out of an infinite loop. At the moment this is impossible: as MPy is not waiting for a key, all keys are ignored, and the only way to interrupt the loop is by pressing the hardware reset button. I could put a timer that listens separately for the [EXIT] key and ...
by Zezombye
Sun Nov 18, 2018 7:03 pm
Forum: General Discussion and Questions
Topic: How does Micropython avoid double precision issues?
Replies: 3
Views: 454

Re: How does Micropython avoid double precision issues?

Thanks, 0.5-0.3-0.2 indeed prints 5.551115123125783e-17 instead of 0. So there are double precision issues (as expected, but at least I have an example).
by Zezombye
Sun Nov 18, 2018 5:25 pm
Forum: General Discussion and Questions
Topic: How does Micropython avoid double precision issues?
Replies: 3
Views: 454

How does Micropython avoid double precision issues?

After implementing doubles, I wanted to test double equality. But to my surprise, 0.1+0.2==0.3 returns True instead of False, although on my PC, Python3 does return False. I also tried 0.1+0.2-0.3, which returns 5.551115123125783e-17 on my PC, but 0.0 on Micropython. I thought avoiding double precis...
by Zezombye
Thu Nov 15, 2018 7:23 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

Found the solution thanks to https://github.com/adafruit/circuitpython/issues/130

In the makefile, replace "none" with "mpz":

Code: Select all

	$(Q)$(TOP)/tools/mpy-tool.py -f -q $(BUILD)/genhdr/qstrdefs.preprocessed.h -mlongint-impl=none $< > $@
by Zezombye
Wed Nov 14, 2018 6:02 am
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

It comes from build/_frozen_mpy.c:

Code: Select all

#if MICROPY_LONGINT_IMPL != 0
#error "incompatible MICROPY_LONGINT_IMPL"
#endif
Apparently MPy believes that any implementation of long int is incompatible. Why is that? I looked inside mpz.c and 32-bit seems to be supported.
by Zezombye
Tue Nov 13, 2018 6:31 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

On PC, I can do things like printing fact(500), even though this number is hundreds of digits long. Obviously there is some kind of trick, as I assume python doesn't have a type for what is probably a 1 kb digit. I looked around in MPy, but I've only found these long-int implementations: - MICROPY_L...
by Zezombye
Tue Nov 13, 2018 5:45 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

As 2064 is very close to a power of 2, I think there is a hardcoded limit somewhere. I don't think there is a coincidence because 2 kb is quite low I knew it, there is indeed a hardcoded limit (in main.c, hiding in plain sight): static char heap[2048]; Changing the size of the heap works, but in my...
by Zezombye
Sat Sep 08, 2018 9:31 am
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

Thanks. This is very misleading, I expected reader->pos to be the position in the file, and reader->len to be the length of the file. Also the name mp_reader_posix_readbyte() implies that it reads only one byte, it should be mp_reader_posix_readbytechunk or something that implies it reads 20 bytes b...
by Zezombye
Fri Sep 07, 2018 5:24 pm
Forum: Development of MicroPython
Topic: How do I make a port of MicroPython for Casio calculators?
Replies: 66
Views: 5562

Re: How do I make a port of MicroPython for Casio calculators?

I am perplexed by this bit of code: typedef struct _mp_reader_posix_t { bool close_fd; int fd; size_t len; size_t pos; byte buf[25]; } mp_reader_posix_t; STATIC mp_uint_t mp_reader_posix_readbyte(void *data) { mp_reader_posix_t *reader = (mp_reader_posix_t*)data; if (reader->pos >= reader->len) { if...