SyntaxError: decimal numbers not supported

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
nudomarinero
Posts: 4
Joined: Wed Oct 14, 2015 7:34 pm

SyntaxError: decimal numbers not supported

Post by nudomarinero » Wed Oct 14, 2015 7:39 pm

Hello,
I have received my Wipy :D

However, I found the following error when I tried to type a float number in the REPL:
SyntaxError: decimal numbers not supported

Is this something temporal until a new firmware update or am I doing something wrong?

Best regards.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: SyntaxError: decimal numbers not supported

Post by dhylands » Wed Oct 14, 2015 8:13 pm

I don't have a WiPy yet, but it would be useful to know exactly what you typed...

It looks like the WiPy was built with:

Code: Select all

#define MICROPY_FLOAT_IMPL                          (MICROPY_FLOAT_IMPL_NONE)
I'm not sure if that was intentional or not.

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: SyntaxError: decimal numbers not supported

Post by platforma » Wed Oct 14, 2015 8:21 pm

Actually I've just noticed that myself...
Also I can't seem to be able to use division operation

Code: Select all

var = 4.1
SyntaxError: decimal numbers not supported
5.34 * 2
... same ...
4/2
TypeError: unsupported type for operator

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: SyntaxError: decimal numbers not supported

Post by dhylands » Wed Oct 14, 2015 8:35 pm

/ is floating point division
// is integer division

so since floating point seems to be configured off in the WiPy, you need to use //

The teensy also doesn't have hardware floating point, but I was able to build it with software floating point. So I suspect that this will probably just require some new firmware.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: SyntaxError: decimal numbers not supported

Post by danicampora » Thu Oct 15, 2015 7:51 am

Floating point takes a lot of code space that the WiPy cannot afford. Divisions need to be done with // as Dave pointed out.

nudomarinero
Posts: 4
Joined: Wed Oct 14, 2015 7:34 pm

Re: SyntaxError: decimal numbers not supported

Post by nudomarinero » Thu Oct 15, 2015 8:54 am

danicampora wrote:Floating point takes a lot of code space that the WiPy cannot afford.
OK. It is good to know that.

Actually, I found this error trying to use the library https://github.com/micropython-IMU/micropython-mpu9x50 to interact with a MPU-9250 unit. It uses floating point algebra and raised the error quickly.

I have also realized now that there is no math module as probably expected. I think this is important information to know the possible constrains in the uses of the WiPy and how to program it.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: SyntaxError: decimal numbers not supported

Post by Damien » Thu Oct 15, 2015 11:46 am

It would be possible to build firmware for the WiPy that includes floating point support. You could choose to install it, or the original. The trade off would be less RAM available when floating point is enabled.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: SyntaxError: decimal numbers not supported

Post by pythoncoder » Thu Oct 15, 2015 12:54 pm

It would be possible to strip down the MPU9250 driver to return the raw integer data from the sensors. Most likely uses for the data would require integer maths and integer approximations for any square roots and trig you might need. There are well established algorithms for these.
Peter Hinch
Index to my micropython libraries.

nudomarinero
Posts: 4
Joined: Wed Oct 14, 2015 7:34 pm

Re: SyntaxError: decimal numbers not supported

Post by nudomarinero » Thu Oct 15, 2015 3:17 pm

I compiled the current source code and got a firmaware binary of about 182 KB. I think that the maximum possible size is 192 KB (?). If that is correct I think it could be very difficult if not impossible to implement the floating point algebra in that size.

Just out of curiosity I have tried to compile the firmware with floating point support. After some complains by the linker about some functions missing (sqtrf, etc) I added the libm sources to the compiler options in application.mk but eventually got this error:
CC ../lib/libm/math.c
../lib/libm/math.c: In function 'sqrtf':
../lib/libm/math.c:86:5: error: inconsistent operand constraints in an 'asm'
asm volatile (
^
And solving this error is out of reach for me.

Anyway, I think that the best option for me is to use integer algebra with the WiPy. I would appreciate some information about the implementation of some common functions (sqrt, acos, atan2, etc) with integers.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: SyntaxError: decimal numbers not supported

Post by Damien » Thu Oct 15, 2015 11:55 pm

I don't think software floating point adds that much code. The thing that will add code is the math module since it needs all the special math functions.

Post Reply