Solved

Floating-point modulo dividion in C

Posted on 1997-04-18
1
1,375 Views
Last Modified: 2008-07-03
I am using fmod() function to perform a floating-point remainder division as follows:

#include <stdio.h>
#include <math.h>

double fmod(double y, double z);

main()
{
        double x, mod, rem;

        x = 765.0;
        mod = 33.0;

        rem = fmod(x, mod);

        printf("The remainder is: %lf\n", rem);

}/* end main */

My question is: Why I am getting the following output:

queen(15)# cc test4.c
Undefined                       first referenced
 symbol                             in file
fmod                                test4.o
ld: fatal: Symbol referencing errors. No output written to a.out


Thanks for your help!
0
Comment
Question by:mkansal
1 Comment
 
LVL 4

Accepted Solution

by:
marko020397 earned 50 total points
ID: 1249968
You should link library where this fmod function is. I think
it's in math library. Look for cc options how to link a
math library. It's been a long time I have compiled programs
in unix so I don't remember any more how to link libraries,
but it's everything written in documentation.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question