• C

'Invalid floating point' urgent dilemma!

Hello
I have recently completed a C program and when it is run, one of its options
causes the program to stop and bring up an error of 'floating point invalid'
I cannot for the life of me figure out this problem!!!

I have the source code and a input file(*.raw) used within the program if anybody wishes to find where the problem is and I cannot seem to find out where the problem is lying.

I will e-mail the problem if you wish

altsmithAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexVirochovskyCommented:
Hi, i translate and run you programm.
1. My BC 5.1 reports about 5 warning(declared, but never used)
2. What is the value (for test) of next vars:
      THRESHOLD = 0.5;//get_threshold();
      num_iter = 200;//get_num_iter();
      angle = 30;//get_angle();

      slope_type = 2;//get_slope_type();
fot my values i runm you programm without errors
Alex
0
zultiCommented:
please write your e-mail address and i'll send you a request for your code.
( my email is zulti@cimatron.co.il )
please send the code, input file and which option made the error you talk about.

avi
0
hongjunCommented:
Please send your program to asteroids_88@hotmail.com and I will try my best to help you.

hongjun
0
What were the top attacks of Q1 2018?

The Threat Lab team analyzes data from WatchGuard’s Firebox Feed, internal and partner threat intelligence, and a research honeynet, to provide insightful analysis about the top threats on the Internet. Check out our Q1 2018 report for smart, practical security advice today!

rbrCommented:
Send it to rbr@tip-informatik.at pls.
0
Lab_RatCommented:
Me too!

I've managed to reproduce this problem by passing floats to a function that uses int's, even if I use typecasting! Yes the compiler is supposed to convert it, no it doesn't do it properly. I got around it by defining a few int types and storing the floats in these variables, then passing them to the function. It's messy, it's slow, but it works.

Any comments on this would be app...

Borland C++ V4.5
0
basantCommented:
send me too at
basant_kukreja@hotmail.com
0
captainkirkCommented:
email to khutchinson@tvgnetwork.com... I'd be glad to look at it for you...
0
zultiCommented:
please as i wrote, insted of every one of us will write his (hers) E-mail
(it's a good way to collect all of our E-mails :) )
please write yours, and every one that will want to join the crowdwill write you, and you will reply the program.
0
hongjunCommented:
Where are you altsmith? You seem to have 'disappeared'. Please send your code and everything to everyone of us here who have listed our email address in an attempt to help you.

hongjun
0
hongjunCommented:
Where are you altsmith? You seem to have 'disappeared'. Please send your code and everything to everyone of us here who have listed our email address in an attempt to help you.

hongjun
0
AlexVirochovskyCommented:
honquin, i 've get code, and i can post it you (and others), but if altsmith
"disappeared", i don't see sence in this...  
0
Lab_RatCommented:
Is there 'sense' in anything?
0
hongjunCommented:
To AlexVirochovsky

It is meant to be a joke and that's why I quote it with a single quote.

hongjun
0
zultiCommented:
that's what i saw :

1. with option 4 had no problem.
2. i replaced the following line
case 3:
   for(y=0; y < 100; y++)
      for(x=0; x < 100; x++)
....

insted
   for(y=1; y < 101; y++)
      for(x=0; x < 100; x++)
....
( the index was too big started from 100 to 100099 and not 0 to 99999 )

3. change all the float to double !!!
   and all the %f to %lf.
   the line
surface[index]=exp(y+1)*100;
has an overflow when using float.
double is good enough.

after those correction all worked fine.


0
zultiCommented:
btw
the line
   case 4:
      for (y = 1;y >= 101 ;y++)

is not understandable !!!
should be ( as i understand )
   case 4:
      for (y = 0;y < 100 ;y++)

as all other cases.

0
zultiCommented:
where r u ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.