473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to handle floating point error

and it is not running successfully... abnormal trmination
Nov 7 '13 #1
3 1044
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3.  void main()
  4.  {
  5.  float a[4],b[4],c[4];
  6.  int i;
  7.  float sum12,sum13,sum23,d12,d23,d13;
  8.  clrscr();
  9.  printf("enter 3 digits wd 4 boundries\n");
  10.  for(i=0;i<4;i++)
  11.  {
  12.  scanf("%f",&a[i]);
  13.   scanf("%f",&b[i]);
  14.   scanf("%f",&c[i]);
  15.   }
  16.   d12=(1.0/4.0) * (fabs(a[0]-b[0])+fabs(a[1]-b[1])+fabs(a[2]-b[2])+ fabs(a[3]-b[3]));
  17.   d13=(1.0/4.0) * (fabs(a[0]-c[0])+fabs(a[1]-c[1])+fabs(a[2]-c[2])+ fabs(a[3]-c[3]));
  18.   d23=(1.0/4.0) * (fabs(b[0]-c[0])+fabs(b[1]-c[1])+fabs(b[2]-c[2])+ fabs(b[3]-c[3]));
  19.   printf("distance btwn 1 & 2=%f\n",d12);
  20.    printf("distance btwn 1 & 3=%f\n",d13);
  21.    printf("distance btwn 2 & 3=%f\n",d23);
  22.   getch();
  23.   }
Nov 7 '13 #2
this is not running successful
Nov 7 '13 #3
donbock
2,426 Expert 2GB
Please tell us the symptoms. In what way is the program not running successfully?
  • Compiler/linker error. Tell us the error.
  • Run-time error. Tell us the error.
  • Incorrect answer. What answer did you get; what did you expect?

We cannot look for discrepancies between what your program actually does and what you intend it to do if you don't tell us what the program is supposed to do.
Nov 7 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dylan Nicholson | last post by:
The following C code: float f = 5.15002; double d = 5.15002; if (d + FLT_EPSILON < f) puts("huh?"); Where 'FLT_EPSILON' is defined as the minimum number whereby 1.0 + FLT_EPSILON != 1.0,...
13
by: Dylan Nicholson | last post by:
I just posted regarding a possible floating point error (not sure where), and have since discovered that: float f = 5.15002; double d = 5.15002; if (float(d) < f) puts("huh 1?"); float f2 =...
3
by: C. Sengstock | last post by:
Hi, i´ve got an iteration with random generated floating point numbers. During the iteration process sometimes the programm stops with the error: "floating point error: overflow" Is the...
0
by: mehulmite | last post by:
Hi! My program is compiling and running properly, but on the output screen it gives FLOATING POINT ERROR:INVALID DOMAIN ABNORMAL PROGRAM TERMINATION The same program runs fine on someone...
5
by: loftusoft | last post by:
While debugging the following code: #include <iostream> using namespace std; int main() { float f = 583312.0F * 0.1F; cout << f << endl; return 0; }
6
by: Torben Frandsen | last post by:
Hi I'm porting an old Access/VB application to .Net, and I've encountered a small problem. The VB application takes a value from a query and stores it in a Double. This value is the result of...
3
by: talibbhai | last post by:
hello friends; I have an error in my program what is the reason behind it. /*this is mathematical function of EXPONENT*/ #include<conio.h> #include<stdio.h> #include<math.h>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.