Re: Using Math function in zephyr


Michael Hope
 

Huh, interesting.  It works for me in a test program:

#include <zephyr.h>
#include <misc/printk.h>
#include <math.h>

void main(void)
{
        printf("round up: %f\n", round(1.9));
        printf("round down: %f\n", round(3.1));
}

"""
***** BOOTING ZEPHYR OS v1.10.99- - BUILD: Dec 21 2017 21:44:19 *****
round up: 2.000000
round down: 3.000000
"""

This is on BOARD=qemu_cortex_m3 which uses the ARM soft float ABI.  There's a chance that you've got a mix of hard float / soft float code but I thought the linker checked that.

What board is this for?

-- Michael

On Fri, 22 Dec 2017 at 08:17 ashish.shukla@... <ashish.shukla@...> wrote:
Hi Michael,

After switching to new library, code compiles but it rounds off all the values to 0.


--
Warm regards,
Ashish Shukla
Jr. Embedded Engineer
Research & Development


Please consider the environment before printing this e-mail or its attachments.

Disclaimer: The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Corvi


On Fri, Dec 22, 2017 at 12:01 PM, Michael Hope <michaelh@...> wrote:
Hi Ashish.  I haven't used this personally, but try switching the libc from the built-in minimal libc to newlib.  See http://docs.zephyrproject.org/subsystems/c_library.html for more.

-- Michael

On Fri, 22 Dec 2017 at 06:00 ashish.shukla@... <ashish.shukla@...> wrote:
Hello everyone !

I'm to use round()  function in zephyr. How to include math functions in zephyr ?

--
Warm regards,
Ashish Shukla
Jr. Embedded Engineer
Research & Development


Please consider the environment before printing this e-mail or its attachments.

Disclaimer: The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this message, please immediately delete it and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. The contents of this message may not necessarily represent the views or policies of Corvi

_______________________________________________
Zephyr-devel mailing list
Zephyr-devel@...
https://lists.zephyrproject.org/mailman/listinfo/zephyr-devel

Join devel@lists.zephyrproject.org to automatically receive all group messages.