Hi,
I'm successfully using the "q" math (16 bit fixed point math) from QmathLib.h on an MSP430 (F5528). However I seem to have stumbled in 2 problems related to _q to / from ASCII conversion:
First ASCII to _q conversion using _atoQ()
_atoQ() fails for numbers without decimal point! So e.g.
- _atoQ( "100" ) will yield 0 (unexpectedly),
- while _qtoQ( "100." ) will yield 100.0 as expected!
Now _q to ASCII conversion using _Qtoa()
This works for all (?) values except for the minimum value! So e.g. with GLOBAL_Q = 3
- _Qtoa( string, "%4.3f", -32768 ) will put a strange "-58:4" into string, while using the next larger value:
- _Qtoa( string, "%4.3f", -32767 ) will put "-4095.875" into string, as expected
Am I doing something wrong? Or is the library doing something wrong? At least it does not do what I expect...
I can easily use workarounds for these unexpeced behaviours, but a fix would be helpfull in the long term.
I'm using the QmathLib.h from MSP430ware_1_80_01_03
Thanks in advance for any replies.