If I make my own math header with similar functions as math.h, can I possibly make it as fast as the implementations of math.h, or does math.h use special hardware or something?
Labdabeta
182
Posting Pro in Training
Featured Poster
Recommended Answers
Jump to PostAre you talking about whether or not the library use an algorithm that optimized its performance for all their functions?
Jump to PostTo correct a confusion: math.h is a header. A library (that is, implementation) is libm.so in unix world, and something similar in windows.
Jump to PostMost "special" math functions (like trigo., sqrt and exp/log) translate directly into a single instruction or a few (in assembly), and the performance of those instructions depends on the hardware. Of course, this is if your system has those instructions, most non-microcontrollers have them (unless your PC is more than …
All 10 Replies
Zvjezdan23
-13
Junior Poster
Labdabeta
182
Posting Pro in Training
Featured Poster
Taywin
312
Posting Virtuoso
nezachem
616
Practically a Posting Shark
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
Labdabeta
182
Posting Pro in Training
Featured Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
Labdabeta
182
Posting Pro in Training
Featured Poster
NathanOliver
429
Veteran Poster
Featured Poster
BCBTP
0
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.