swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fmax fmin: more of the GNU C library portability problem?


From: Paul Johnson
Subject: fmax fmin: more of the GNU C library portability problem?
Date: Mon, 03 Apr 2000 18:00:52 -0500

Dear Marcus:

I've been providing support around here on our local swarmlist.  The
queston dealt with why an app using fmax and fmin won't compile on a
Windows computer. Do you think I give the right answer?

The compiler output is:
> MktMaker.m: In function `-[MktMaker step]':
> MktMaker.m:839: warning: implicit declaration of function `fmin'
> make: *** [MktMaker.o] Error 1

So I said to him:
--------------------
I bet this is a C library thing.  fmax is in the GNU c library, but I
bet it is not in the cygnus c library.  In unix, fmax and fmin are from
the header file tgmath.h. I had no trouble with them. You can check in
your setup to see if you have that in the cygnus directory.

Here is the way the header is defined.  From tgmath.h:

/* Return maximum numeric value from X and Y.  */
#define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
/* Return minimum numeric value from X and Y.  */
#define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)

So if you can't find fmax and fmin in your system, I think they should
be easy to write.  Assuming I understand that the thing is returning the
bigger of two numbers, I'd try something like

#define fmax(Val1, Val2)  (Val1>Val2)? Val1:Val2
#define fmin(Val1, Val2)  (Val1<Val2)? Val1:Val2

I'm just guessing that is what those are for. Can you tell from the
context of the code? 
---------------------

The more I look at tgmath.h, the worse I feel about my answer.  So I'm
asking you.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]