Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5451

SDK • Re: Lua math issue

$
0
0
I have been looking at the SDK sources as well and the log1p() math library function is a TODO. From double_math.c in the SDK:

Code:

// todo these are marked as lofidouble WRAPPER_FUNC(expm1(double x) { check_nan_d1(x); return exp)(x)-1; }double WRAPPER_FUNC(log1p(double x) { check_nan_d1(x); return log)(1+x); }double WRAPPER_FUNC(fma)(double x,double y,double z) { check_nan_d1(x); return x*y+z; }
Whoops. RP2040 is just a Cortex-M0+ chip, floating-point is a luxury and a math lilbrary implementation usually is subject to many limitations. That how some of us old embedded fellas think -- I was testing a sensor breakout board a couple of months ago and the dinosaur in me used fixed point integer to do conversion for the I2C raw data, haha.

To avoid the hassle of such floating-point limitations, the best strategy is simply to wait for the next Pico chip, it will likely be more powerful than a RP2040 -- hints of which has been discussed in the General subforum recently.

Statistics: Posted by katak255 — Mon Jul 22, 2024 1:38 pm



Viewing all articles
Browse latest Browse all 5451

Trending Articles