In doing some work on a library I'm writing, I'm trying to use the
`floor()` function to get the largest integral value of a variable.
I'm compiling everything using the mpich mpicc built with gcc 4.1.0
[standard build with OpenSuse 10.1]. For some reason, it doesn't like
my floor function :
mrng.c:137: error: called object 'floor' is not a function
I've included the correct <math.h>
The code is pretty simplistic :
ran->max_num = floor( td );
both `ran->max_num` and `td` are double values.
I wrote a *very* simple test program to see if it would find 'floor'
and it worked.
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
printf( "%s%f\n", "FLOOR OF 2.3 :: ", floor( 2.3 ) );
return 0;
}
Any thoughts why this is happening? 5 2444
On 5ÔÂ12ÈÕ, ÏÂÎç10ʱ02·Ö, john.lei...@gmail.com wrote:
In doing some work on a library I'm writing, I'm trying to use the
`floor()` function to get the largest integral value of a variable.
I'm compiling everything using the mpich mpicc built with gcc 4.1.0
[standard build with OpenSuse 10.1]. For some reason, it doesn't like
my floor function :
mrng.c:137: error: called object 'floor' is not a function
I've included the correct <math.h>
The code is pretty simplistic :
ran->max_num = floor( td );
both `ran->max_num` and `td` are double values.
I wrote a *very* simple test program to see if it would find 'floor'
and it worked.
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
printf( "%s%f\n", "FLOOR OF 2.3 :: ", floor( 2.3 ) );
return 0;
}
Any thoughts why this is happening?
I think maybe you should post more code which can cause the error
message.
On 2007-05-12, jo*********@gmail.com <jo*********@gmail.comwrote:
In doing some work on a library I'm writing, I'm trying to use the
`floor()` function to get the largest integral value of a variable.
I'm compiling everything using the mpich mpicc built with gcc 4.1.0
[standard build with OpenSuse 10.1]. For some reason, it doesn't like
my floor function :
mrng.c:137: error: called object 'floor' is not a function
I'd guess you have something declared with the name floor after
your #include <math.hline. Could be a variable or something that
is not a function. If you turn up your warning level your compiler
will probably detect that.
I've included the correct <math.h>
The code is pretty simplistic :
ran->max_num = floor( td );
both `ran->max_num` and `td` are double values.
I wrote a *very* simple test program to see if it would find 'floor'
and it worked.
#include <stdio.h>
#include <stdlib.h>
Here you should have included math.h instead of stdlib.h
int main( int argc, char **argv )
{
printf( "%s%f\n", "FLOOR OF 2.3 :: ", floor( 2.3 ) );
return 0;
}
Any thoughts why this is happening?
<jo*********@gmail.comha scritto nel messaggio
news:11**********************@u30g2000hsc.googlegr oups.com...
In doing some work on a library I'm writing, I'm trying to use the
`floor()` function to get the largest integral value of a variable.
I'm compiling everything using the mpich mpicc built with gcc 4.1.0
[standard build with OpenSuse 10.1]. For some reason, it doesn't like
my floor function :
mrng.c:137: error: called object 'floor' is not a function
Maybe there's something else named 'floor' declared in an inner
block...
I've included the correct <math.h>
Some compilers don't automatically link some functions from
<math.h>. You have to tell them to do that (e.g. for gcc use the
switch -lm). But if the test below does work I don't think this is
your case.
The code is pretty simplistic :
ran->max_num = floor( td );
both `ran->max_num` and `td` are double values.
I wrote a *very* simple test program to see if it would find 'floor'
and it worked.
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
printf( "%s%f\n", "FLOOR OF 2.3 :: ", floor( 2.3 ) );
return 0;
}
Any thoughts why this is happening?
On May 12, 10:04 am, "Army1987" <please....@for.itwrote:
<john.lei...@gmail.comha scritto nel messaggionews:11**********************@u30g2000hsc .googlegroups.com...In doing some work on a library I'm writing, I'm trying to use the
`floor()` function to get the largest integral value of a variable.
I'm compiling everything using the mpich mpicc built with gcc 4.1.0
[standard build with OpenSuse 10.1]. For some reason, it doesn't like
my floor function :
mrng.c:137: error: called object 'floor' is not a function
Maybe there's something else named 'floor' declared in an inner
block...I've included the correct <math.h>
Some compilers don't automatically link some functions from
<math.h>. You have to tell them to do that (e.g. for gcc use the
switch -lm). But if the test below does work I don't think this is
your case.
The code is pretty simplistic :
ran->max_num = floor( td );
both `ran->max_num` and `td` are double values.
I wrote a *very* simple test program to see if it would find 'floor'
and it worked.
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv )
{
printf( "%s%f\n", "FLOOR OF 2.3 :: ", floor( 2.3 ) );
return 0;
}
Any thoughts why this is happening?
AHA!! Sorry everyone... I had not yet consumed enough coffee this
morning... The function from which I was having trouble was defined
as :
extern MRNG *m_init_mrng( MPI_Comm RCOMM,
RNG_T type,
RNG_OPT_T options,
int mem,
double seed,
double floor,
double ceil,
int extend )
I can't use `floor` and 'ceil` as variable defs!!! ARG!! :-)
Problem is fixed :-) jo*********@gmail.com wrote:
I can't use `floor` and 'ceil` as variable defs!!! ARG!! :-)
Don't you mean "ARGC!!!"? :-)
(You can name variables "floor" and "ceil" if you want, just not when
you include <math.hdirectly or indirectly.)
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: SpaceCowboy |
last post by:
I'm using Sun ONE Studio 4 update 1, Community Edition with Nokia
Developer's Suite integration. I'm developing a J2ME project with MIDP.
I wanted to use the java.math.floor() function, but...
|
by: Murat Tasan |
last post by:
here is the situation...
i have an array... and i select something from random from it.
i pick a random number x by using Math.random() and multiplying it by the
length of the array.
but this...
|
by: Nicolas Fleury |
last post by:
Hi,
How can I know if a system command doesn't exist? All the ways I have
tried behave like if the system command was existing but returning one.
I don't want to sound provocative, but open in...
|
by: Henke |
last post by:
I wanna round an value in a javascript Down to nearest hundred.
For example: 3234 = 3200 and 3890 = 3800
Always down and to hundred.
I have tried Math.floor but that just round down to ten.
Is...
|
by: RobG |
last post by:
I am writing a script to move an absolutely positioned element on a
page by a factor using style.top & style.left.
The amount to move by is always some fraction, so I was tossing up
between...
|
by: Francois Grieu |
last post by:
In ISO/IEC 9899:1999, it is unambiguous that floor(-0.5)
has the value -1 (converted to double).
Was this the case in earlier C standards?
Is anyone aware of an implementaton that has it wrong...
|
by: lilmax88 |
last post by:
I have a program in which I need to take a numeric value for dollars.
There is a "set" function that must screen the value for the following
3 conditions with the indicated handling functionality:...
|
by: arnaudk |
last post by:
Will the casting operation int (x) on a double x have the same effect as floor (x) (except that floor returns a double)? If this is true, then I can floor floats by recasting them instead of calling...
|
by: Catalyst159 |
last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows:
Part A: Maximum FAR and Floor Area:
Part B: Gross Floor Area of...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |