Questions tagged [libm]

Under Linux, the mathematical functions (as declared in math.h) are bundled separately in the mathematical library libm. If any of them is used, the linker must be given the directive -lm.

Taken from here.

72 questions
4
votes
0 answers

Is there a version of the standard math library which uses VEX instructions?

I have this large library with a mix of regular C++, a lot of SSE intrinsics and a few insignificant pieces of assembly. I have reached the point where I would like to target the AVX instruction set. To do that, I would like to build the whole thing…
Olivier
  • 1,144
  • 1
  • 8
  • 15
4
votes
1 answer

linking succeeds with arm-none-eabi-g++ but not arm-none-eabi-gcc

I am using the Launchpad Arm compiler tools. Specifically, arm-none-eabi-g++ and arm-none-eabi-gcc from: (GNU Tools for ARM Embedded Processors) 5.2.1 20151202 (release) [ARM/embedded-5-branch revision 231848] I have a simple program targeted at an…
Peter Harrison
  • 367
  • 1
  • 3
  • 15
3
votes
1 answer

no implementation of __fpclassify in armhf

I'm cross-compiling for Raspberry Pi 4B using ARM's 10.3-2021.07 GCC toolchain (specifically this file uncompressed into ARMGCC). I'm also using the latest Raspberry OS image as sysroot (loop-mounted into RPISYSROOT). The host is an Ubuntu Xenial VM…
vesperto
  • 804
  • 1
  • 6
  • 26
3
votes
2 answers

How should I obtain the fractional part of a floating-point value?

I have a variable x of type float, and I need its fractional part. I know I can get it with x - floorf(x), or fmodf(x, 1.0f) My questions: Is one of these always preferable to the other? Are they effectively the same? Is there a third alternative…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
3
votes
3 answers

php memcached stats page, using PECL::memcache

I'm running php 5.3. I have installed the pecl memcache extension. Once upon a time there was the memcache.php (which I'm aware is still around and usable) for viewing useful memcached stats and other info. At some point this page was committed into…
xzyfer
  • 13,937
  • 5
  • 35
  • 46
3
votes
1 answer

How can I link libm to my emscripten port

I am trying to use emscripten to port some C code that requires libm. Usually, it uses my system's version, and I don't need to worry about linking to it, but I need to manually link it with emscripten. How can I link libm? I have tried using…
zzmp
  • 421
  • 4
  • 9
3
votes
5 answers

Libm has no trigonometric functions

The libmath on a particular embedded system does not have functions like sin and cos due to missing fp-operation unit. Is there some library around that provides the functions via look-up tables? I do not actually need 100% reliable values.
Stasik
  • 2,568
  • 1
  • 25
  • 44
2
votes
0 answers

Mathematical (exp) function result vs glibc version

I need your help regarding an explanation (and maybe a workaround) regarding different results produced by exp() mathematical function on some Linux distros. Results are produced by this very simple program : #include #include…
URaoul
  • 523
  • 3
  • 13
2
votes
1 answer

Linking errors when using functions from in using API level 22

I'm porting a C and C++ library that currently works on iOS to be used on an Android application. I'm down to these last 3 linker errors (obfuscated for privacy reasons): /Users/fer662/projects/xxx/jni/xxx_preprocessing.c:10184: error: undefined…
Fernando Mazzon
  • 3,562
  • 1
  • 19
  • 21
2
votes
0 answers

C++ libm based program taking too much time on baremetal ubuntu server 16 compared to VM ubuntu server 12

I am trying to run a math intensive C++ program on Ubuntu server and surprisingly the Ubuntu Server 16 running on a baremetal Core i7 6700 is taking more time than a dual core Ubuntu server 12.04.5 running on a VM over windows 10 on the same…
Siril
  • 21
  • 3
2
votes
1 answer

How to include the math library in MS-VS 2005 compiler project settings?

I am trying to build a C program which was originally built on Linux with gcc -lm ... option, which uses the math library while linking the code. How can use the same in project settings of a Visual Studio 2005 compiler, on Win32 environment? EDIT:…
goldenmean
  • 18,376
  • 54
  • 154
  • 211
2
votes
1 answer

Optimize mathematical library (libm)

Have anyone tried to compile glibc with -march=corei7 to see if there's any performance improvement over the version that comes by default with any Linux x68_64 distribution? GCC is compiled with -march=i686. I think (not sure) that the mathematical…
pcremades
  • 83
  • 1
  • 5
2
votes
1 answer

C sinhl undefined reference when including math.h and linking libm

Hoping someone has seen this before and can provide some insight. I'm including math.h AND linking libm, using gcc 4.2.1 on FreeBSD 9.2 x86_64. Functions like sinl, cosl, tanl work, but as soon as I call sinhl and the like I'm getting warnings about…
TCCSE
  • 31
  • 3
2
votes
0 answers

How can I use Standard C libraries that are not supported in the Bionic C library to build with Android-NDK?

My native source makes use of complex operations (defining ). These operations are implemented in the standard C99 math library but not in the bionic math library used by Android-NDK. For this reason I would like to make use of the Standard Math…
Sam
  • 314
  • 3
  • 8
1
vote
0 answers

architecture arm64 missing in libm?

I have ported a small tool from Linux to MacOS on x86 using simply the existing Makefile. Now, I need to build a universal app, since some users have got M1 hardware. I have followed Apple's instructions on building a universal app, and have add a…
Uwe M.
  • 11
  • 2