[SOLVED] A question about the fmod() function in C...
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can you offer me the code about fmod() in C...
I want to know how this function work, i am very interested in it because i have no idea to implement it, thanks your consideration!
==========================================
i want to know... how to write the function... not 'how to use the function'...
can anyone post the source codes of this function here?
Can you offer me the code about fmod() in C...
I want to know how this function work, i am very interested in it because i have no idea to implement it, thanks your consideration!
I think the simplest way is to check how the open-source math library (libm) implements this function. Check out the sources of the GNU C library (libm is a part of glibc) and look at
i want to know... how to write the function... not 'how to use the function'... thanks!
Right! So, why don't you then lookup a reference implementation!? I already posted a link to a reference implementation ... BTW, are you already familiar with the layout of the IEEE floating point specification? I think this is somehow crucial :-) to write such a function ...
Right! So, why don't you then lookup a reference implementation!? I already posted a link to a reference implementation ... BTW, are you already familiar with the layout of the IEEE floating point specification? I think this is somehow crucial :-) to write such a function ...
Andi
Oh,my god!Thanks for remind me that link...i feel ashamed...
At first i just glance the site you linked...so i overlook the sentence----"The return value is x - n y, where n is the quotient of x / y, rounded to the first integer towards zero."...i so damn foolish!!!I will be care next time...
To the layout of the IEEE floating point specification...it is my first time to here now and i go to read it right now...
Thanks very much!Please forgive my negligence!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.