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
1
vote
1 answer

Is it possible to write an XS module when the shared library is already mapped into the process space?

This is on the limits of what I know, please correct any confusion here. In this question I ask why functionality provided by libm isn't already exposed to the user with a Perl interface. Now I want to know how it's done. There is a module on CPAN…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
1 answer

If Perl already links to libm, why aren't any of the functions exposed to the user?

Perl already links to libm. $ ldd $(which perl) ... libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd8ce2ea000) ... So if Perl already links to libm, why aren't often used features like ceil, floor, and pow provided as…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
1
vote
1 answer

Is there any reliable data for benchmarking math library?

I'm going to test the performance for some math function like pow, exp and log etc. Is there any reliable test data for that? As those functions were highly optimized in exist modern system library like glibm or in OpenJDK, the general random inputs…
Tiger
  • 157
  • 2
  • 10
1
vote
0 answers

Link libm statically to get equal results on multiple computers

I have a numerical C++ model of thousands of LOC that outputs different results on different machines and I want to fully understand why that is. Those differences start out in like the 14th significant digit but then propagate to produce quite…
konse
  • 885
  • 1
  • 10
  • 21
1
vote
1 answer

How to build math libraries of glibc package?

I already know how to build the new version of Glibc (e.g. 2.3) beside the older version (e.g. 2.19). I followed the instructions in https://www.tldp.org/HOWTO/html_single/Glibc-Install-HOWTO/ But rather compiling whole libraries in Glibc, I only…
Ali Salari
  • 29
  • 4
1
vote
2 answers

Calculation of maximum floating point error

pow(x,y) is computed as e^(y*log(x)) Generally math libraries compute log(x) in quad precision (which is time consuming) in order to avoid loss of precision when computing y*log(x) as precision errors will magnify in the computation of…
1
vote
0 answers

Double division in sqrtf? [UPDATE]

I'm using floating point operations(software implementation) on a STM32F0 and found something weird in the listing. As soon as i use sqrtf, the linker is adding __aeabi_ddiv which is ~1.6kB of memory. This code for example links to ddiv: float…
1uk3
  • 21
  • 4
1
vote
2 answers

How to use Intel's Math function library with gcc?

I am trying the following: gcc -o foo foo.c -L /path/to/directory/containing/libimf.so -limf and I have used 'log2' function in foo.c. I want it to link with Intel optimized library function but I am getting the following error /usr/bin/ld: skipping…
user1669844
  • 703
  • 9
  • 23
1
vote
1 answer

Natural Logarithm using series in Haskell Gives Imprecise Results

So I wrote two functions to calculate natural logarithm of variable x, after increasing the upperbound of incremental sum to 33000 the functions still return imprecise results being tested in ghci, compared with the default log function imported…
Leo Mingo
  • 40
  • 8
1
vote
1 answer

How to install Amd LibM?

Im trying to install AMD LibM to my linux debian but I dont know how to. I Downloaded the : amdlibm-3.1-lin64.tar.gz AMD LibM Library for Linux®. Built with GCC 4.7.2 However it just comes with the following folders : include , lib What am i…
KenobiBastila
  • 539
  • 4
  • 16
  • 52
1
vote
1 answer

How to keep compatibility when compiling ffmpeg with android ndk

I have successfully compiled ffmpeg as a static library for my project with android-platform 19 which specified in Application.xml as below: APP_PLATFORM := android-19 I test my project on a device(4.4),it runs well. But it will crash on 4.0…
Jiakang Zhang
  • 869
  • 1
  • 7
  • 6
1
vote
1 answer

Why does a program using sqrt compile with gcc without specifying a math library

given the following program: #include #include int main(void) { double x = sqrt(2); printf("The square root of two is %f\n", x); return 0; } and compiling with: gcc calc.c -o calc succeeds? why doesn't it require…
decuser
  • 238
  • 5
  • 20
1
vote
2 answers

Why is atan first call much slower than the next ones?

The following code demonstrates that atan computation time can vary a lot: #include #include #include #include #include #include double get_time() { struct timeval t; …
Thomas Moulard
  • 5,151
  • 2
  • 21
  • 28
1
vote
0 answers

Does gcc automatically link libm?

In my program I neither include math.h nor do I link -lm against it: g++ -std=c++11 -g -O0.. Still ldd shows this ldd ./bin/apps/dummy linux-vdso.so.1 => (0x00007fff9e5fe000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6…
hlitz
  • 635
  • 6
  • 24
1
vote
1 answer

Link the static system library libm.a in Code::Blocks

I successfully compile my program in the shell with the command below. It produces the example binary file and works normally. gcc -g -o build/debug/example -Iinclude docs/example.c \ build/debug/libmupdf.a \ build/debug/libfreetype.a…
pang1567
  • 125
  • 7