NABU floating point errors

Discussion about other targets
Post Reply
DJ Sures
Member
Posts: 67
Joined: Sun Dec 11, 2022 12:41 pm

NABU floating point errors

Post by DJ Sures »

Is there a libmath or something missing in the +cpm -sub-type=nabu? I get the following error when attempting to do any floaty mcducks...

Code: Select all

uint8_t _heading = 0;
float _x = 256 / 2;
float _y = 100.0;

float sinArray[360] = { 0, 0.02, 0.03,.... };
float cosArray[360] = { 1, 1, 1, 1, 1, 1,....... };

void move(uint8_t seconds) {

  for (uint s = 0; s < seconds * 10; s++) {

    _x += sinArray[_heading];
    _y += cosArray[_heading];
    
    putPixel(15, (uint8_t)_x, (uint8_t)_y);
  }
}
main.c:8672: error: undefined symbol: ___fsadd
^---- ___fsadd
main.c:8694: error: undefined symbol: ___fsadd
^---- ___fsadd
main.c:8704: error: undefined symbol: ___fs2uchar_callee
^---- ___fs2uchar_callee
main.c:8711: error: undefined symbol: ___fs2uchar_callee
^---- ___fs2uchar_callee
main.c:8756: error: undefined symbol: ___fs2uchar_callee
^---- ___fs2uchar_callee
main.c:8763: error: undefined symbol: ___fs2uchar_callee
^---- ___fs2uchar_callee
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: NABU floating point errors

Post by dom »

There’s a few: https://github.com/z88dk/z88dk/wiki/Cla ... -Libraries

Best bet is to stick —math32 onto compilation line.
DJ Sures
Member
Posts: 67
Joined: Sun Dec 11, 2022 12:41 pm

Re: NABU floating point errors

Post by DJ Sures »

Awesome! I looked at examples globe.c which used float but didn't see any references to libraries - so i resorted to picking your brain :)

I need it to calculate angles with sin/cos to make the NABU control a robot like Logo: https://youtu.be/uCJ52hgORow
Post Reply