Re: Float as Infinity
On Sep 26, 12:13 am, The87Boy <the87...@gmail .comwrote:
Set valueMin to the largest possible value:
DBL_MAX
Set valueMax to the most negative possible value:
DBL_MIN
Then the first time you compare something, it will always get
replaced.
The start of your program will look like this:
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
static char string[32767];
int main(void)
{
double valMin = DBL_MAX;
double valMax = DBL_MIN;
On Sep 26, 12:13 am, The87Boy <the87...@gmail .comwrote:
On 25 Sep., 20:58, Mark McIntyre <markmcint...@s pamcop.netwrote :
>
>
>
>
>
>
>
>
>
>
>
>
It isn't the question, but should I set it to "float
valueMin=-999999999999999 99999999" or?- Hide quoted text -
>
- Show quoted text -
>
>
>
>
>
On Tue, 25 Sep 2007 03:27:07 -0700, in comp.lang.c , The87Boy
<the87...@gmail .comwrote:
>How can I initialize valueMin and valueMax
This is NOT a C question. This is an algorithm question. If you don't
understand the algo, you cannot safely programme it, so take time to
understand the algo first. Here's a suggestion:
understand the algo, you cannot safely programme it, so take time to
understand the algo first. Here's a suggestion:
Pick ONE number.
Work out which of it is the min, and which is the max (easy....).
What are valueMin and valueMax set to now?
What are valueMin and valueMax set to now?
Once you've solved this step, pick a second number, and compare it.
It isn't the question, but should I set it to "float
valueMin=-999999999999999 99999999" or?- Hide quoted text -
>
- Show quoted text -
DBL_MAX
Set valueMax to the most negative possible value:
DBL_MIN
Then the first time you compare something, it will always get
replaced.
The start of your program will look like this:
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
static char string[32767];
int main(void)
{
double valMin = DBL_MAX;
double valMax = DBL_MIN;
Comment