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

2
Contributors
4
Replies
6
Views
8 Years
Discussion Span
Last Post by Unidennn

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

Edited by thomas_naveen: n/a

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?

Edited by Unidennn: n/a

fmaxf for floats.

alright thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.