[SOLVED] Where to find atan2() function for nrf52?

I believe that it’s supposed to be in but when I try to include it I am getting an error. However, the file cmath does exist because I can do right-click jump to its definition and I can set in on disk.

~$ ls -l .platformio/packages//toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/8.2.1/cmath
-rw-r--r-- 1 user 197121 48142 Feb 13  2019 .platformio/packages//toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/8.2.1/cmath


#include <zephyr.h>
#include <cmath>

void main(void) {
  for (int i = 6;; i++) {
    printk("%d\n", i);

build log:

> Executing task: C:\Users\user\.platformio\penv\Scripts\platformio.exe run <

Processing nrf52_dk (platform: nordicnrf52; board: nrf52_dk; framework: zephyr)
-------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52_dk.html
PLATFORM: Nordic nRF52 (9.3.0) > Nordic nRF52-DK
HARDWARE: NRF52832 64MHz, 64KB RAM, 512KB Flash
DEBUG: Current (jlink) On-board (cmsis-dap, jlink) External (blackmagic, stlink)
 - framework-zephyr 2.20701.220216 (2.7.1)
 - tool-cmake 3.21.3
 - tool-dtc 1.4.7
 - tool-ninja 1.9.0
 - tool-sreccat 1.164.0 (1.64)
 - toolchain-gccarmnoneeabi 1.80201.190214 (8.2.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\nrf52_dk\src\main.o
src\main.cpp:3:10: fatal error: cmath: No such file or directory
 #include <cmath>
compilation terminated.
*** [.pio\build\nrf52_dk\src\main.o] Error 1
===================================== [FAILED] Took 5.73 seconds =====================================
The terminal process "C:\Users\user\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.


platform = nordicnrf52
board = nrf52_dk
framework = zephyr
debug_tool = jlink

Answering my own question. Adding CONFIG_NEWLIB_LIBC=y to zephyr/prj.conf causes the full math libraries to be used.


BTW, I am using #include <math.h> and it works. is still not available but <math.h> is just as good.