SyntaxError: decimal numbers not supported
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: SyntaxError: decimal numbers not supported
From a user perspective a lack of floating point arithmetic represents a substantial lack of Python compatibility. It will also result in confusion amongst beginners who may not know how to do arithmetic programming in an integer-only environment.
The lack of a math module pales into insignificance in comparison: it's a consequence of hardware limitations. It should, of course, be clearly stated in the docs.
The lack of a math module pales into insignificance in comparison: it's a consequence of hardware limitations. It should, of course, be clearly stated in the docs.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: SyntaxError: decimal numbers not supported
I agree. I am working now on the docs, hope to push soon. Surprisingly, it doesn't take 15 minutes as everyone thinks...
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: SyntaxError: decimal numbers not supported
I must admit I chuckled at that oneit doesn't take 15 minutes
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 4
- Joined: Wed Oct 14, 2015 7:34 pm
Re: SyntaxError: decimal numbers not supported
I tried to compile the firmware with floating point support but without the math module. At this point I just wanted to check the size of the resulting binary.
I did the following:
I also gave it a try and uploaded it to the WiPy. It was very easy to do that as it is explained in the documentation. After uploading the binary, (almost) everything worked all right. In this case, trying to use a float number just blocked the WiPy but did not raise the error Given that I have no experience with firmware of embedded devices it would have been surprising that it worked.
Later, I could easily restore the original firmware after compiling it with the default options and everything went back to normal.
I will be happy to help with any test needed to implement the floating point arithmetic in the WiPy in the future.
My conclusions: It was actually very easy to do all of this. The WiPy is very robust with respect to firmware changes. I think the documentation is OK and I appreciate and understand the effort of writing it. Thank you!
I did the following:
- add #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) to mpconfigport.h
- add #define MICROPY_PY_MATH (0) to mpconfigport.h
- add APP_INC += -I../lib/libm to application.mk
- isolate the function floorf from math.c to its own file
- add libm/fmodf.c libm/roundf.c libm/floorf.c to APP_LIB_SRC_C in application.mk. I think they are required by some basic built-in operators.
- comment line 207 in objfloat.c (case MP_BINARY_OP_INPLACE_POWER...) The power function requires powf and this function requires the use of sqrtf which is the function that gave me the asm error.
- Comment lines 439 to 447 in modbuiltins.c to avoid the use of the powf function. This is just a dirty "trick" to allow the compilation of the firmware.
I also gave it a try and uploaded it to the WiPy. It was very easy to do that as it is explained in the documentation. After uploading the binary, (almost) everything worked all right. In this case, trying to use a float number just blocked the WiPy but did not raise the error Given that I have no experience with firmware of embedded devices it would have been surprising that it worked.
Later, I could easily restore the original firmware after compiling it with the default options and everything went back to normal.
I will be happy to help with any test needed to implement the floating point arithmetic in the WiPy in the future.
My conclusions: It was actually very easy to do all of this. The WiPy is very robust with respect to firmware changes. I think the documentation is OK and I appreciate and understand the effort of writing it. Thank you!
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: SyntaxError: decimal numbers not supported
Hello nudomarinero,
Thanks for your efforts, and for your comments! . I will try to build a version with float support sometime during the following days.
I am glad to see that you find the WiPy robust regarding software updates. We worked really hard in that direction, and even though the docs are lacking a lot of info, we do have tests for most things running on a dedicated server every night and after every set of commits pushed. This evening a nice update regarding docs and also Blynk support will be posted.
Cheers,
Daniel
Thanks for your efforts, and for your comments! . I will try to build a version with float support sometime during the following days.
I am glad to see that you find the WiPy robust regarding software updates. We worked really hard in that direction, and even though the docs are lacking a lot of info, we do have tests for most things running on a dedicated server every night and after every set of commits pushed. This evening a nice update regarding docs and also Blynk support will be posted.
Cheers,
Daniel
Re: SyntaxError: decimal numbers not supported
When floats are enabled, complex numbers are also enabled by default. You probably don't need these and can disable them by #define MICROPY_PY_BUILTINS_COMPLEX (0)
On pyboard (stmhal port), basic float support costs 7000 bytes of code space (no complex numbers, no math module, but does include powf and sqrtf). Full float support (incl complex numbers, math and cmath modules) costs 23000 bytes of code space.
On pyboard (stmhal port), basic float support costs 7000 bytes of code space (no complex numbers, no math module, but does include powf and sqrtf). Full float support (incl complex numbers, math and cmath modules) costs 23000 bytes of code space.
Re: SyntaxError: decimal numbers not supported
Hello danicampora,
I'm enjoying beginning to play around with my WiPy. You said you were going to try to build with floating point; any results yet?
Thanks,
Larry
I'm enjoying beginning to play around with my WiPy. You said you were going to try to build with floating point; any results yet?
Thanks,
Larry
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: SyntaxError: decimal numbers not supported
Please, WiPy will have greater value for me and others interested in collecting, processing and sharing (via WiFi) some sensor data. Using Python, of coursedanicampora wrote:Thanks for your efforts, and for your comments! . I will try to build a version with float support sometime during the following days.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
Re: SyntaxError: decimal numbers not supported
Any update on this ? Has anyone enabled floating point with success ?
Re: SyntaxError: decimal numbers not supported
I just updated my Wipy to version 1.6 and wipy version 1.2. Still no support for decimal numbers. Without this feature i can't use my sensor libraries .
Please fix this. Thanks
Please fix this. Thanks