Hi, i know its probably the easiest thing ever, but im a noobie in c, and in need of some help with fmax function, i just dont really get it.
im trying to compare 3 floats
heres what im trying
float fmaxf (float int1, float int2, float int3)

im not sure if i can use 3 floats to compare, if not will something like this work
float fmaxf (float int1, float int2)
float fmaxf (float int1, float int3)

the thing i dont understand is what kinda return will be for that fmax function, or should i add something after float function line to get the biggest value out of those 2 or 3 values.. i cant really explain.. i guess i just dont understand how fmax works, we never did it in class but we just took a quick look at math library, so i did the same 3 value comparison with if and else but its very long, i want to try with fmax and fmin to make it shorter
thanks in advance

Recommended Answers

All 4 Replies

fmax takes only two variables as input.

So you can only use fmax(a,b)

For three variables a,b,c
use something like

d = fmax(a,b);

e = fmax(c,d)

e will be the max of a,b,c

ohhh....
so to get the largest number out of 2 you just have to make something equal to the fmax function...
thanks for the help .. im gonna give it a try now :)
but another quick question... i need .1f
so if i use ur code

d = fmaxf(float a,float b);

e = fmaxf(float c,float d);

i should use fmaxf or just fmax?

alright thanks

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.