int main()
  float a,x,y,w,g,s,area,b,c,hg,radius,ho;
    printf("enter the value of one side:");
    printf("enter the lengths:");
    printf("the area of the triangle is:%f",area);
    printf("the diatance is:%f",hg);
    return 0;

the area comes right but the distance hg shows -1.#IND00 which i think means that the value of points are very very large...can anybody tell me the process of solving this error expect using the BIGFLOAT library

Try using double, or long double values instead of floating point values. Floats are only 32 bits and hence are quite limited in precision as well as exponent size. Doubles are 64-bits, and I think new compilers that support long doubles allow 128 bit values, which though allowing much larger (and precise) numbers, are much slower to compute as most (or all) current microprocessors will be limited to 64-bit or 80-bit internal floating point operations. Also, remember that precision (the number of decimal places after the integer part of the value) is NOT the scale of the value (the exponent size).

Use signed long double.. This increases the values that can be held by long double by two times (As it doesnt take values less than 0, and in this case, i dont think u require it)

Also, if u want to define the number of decimal places in your output... U can use setw() and set precision(forgot the function for it)

This article has been dead for over six months. Start a new discussion instead.