I'm writing a widget for Uniface. I'm already pretty far but stumble accross a problem calculating minimum and maximum values as well as the steps in between. The chart has to manage float values. For instance:

the chart displays the following values:

x = 1; y = 12,5

x = 2; y = 21,7

y = 3; y = 30,5

The chart should get a y-axes with on top the value 40 and on the way down you should see the values 30, 20, 10 and of course 0 (zero). It should also work with negative values. My problem is: How do I determine what are the minimum and maximum values using floats. It's easy with integers but with floats its different.

Does any of you people have a routine lying arround that does my trick?

Thanks Paul.

#include <stdio.h>

void main(void);

float get_highest(float [],int);

float get_lowest(float [],int);

void main(void)

{

float x[10]={0,1,2,3,4,5,6,7,8,9

printf("highest=%f\n",get_

printf("lowest =%f\n",get_lowest(x,10));

}

float get_highest(float a[], int num_of_floats)

{

int x;

float highest=0;

for(x=0;x<num_of_floats;x+

if(a[x]>highest) highest=a[x];

return(highest);

}

float get_lowest(float a[], int num_of_floats)

{

int x;

float lowest=9999;

for(x=0;x<num_of_floats;x+

if(a[x]<lowest) lowest=a[x];

return(lowest);

}