?
Solved

'Invalid floating point' urgent dilemma!

Posted on 1999-11-20
16
Medium Priority
?
335 Views
Last Modified: 2011-09-20
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

0
Comment
Question by:altsmith
  • 5
  • 4
  • 2
  • +4
16 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2222048
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
 
LVL 2

Expert Comment

by:zulti
ID: 2222926
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
 
LVL 33

Expert Comment

by:hongjun
ID: 2223877
Please send your program to asteroids_88@hotmail.com and I will try my best to help you.

hongjun
0
Free tool for managing users' photos in Office 365

Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!

 
LVL 10

Expert Comment

by:rbr
ID: 2224250
Send it to rbr@tip-informatik.at pls.
0
 
LVL 1

Expert Comment

by:Lab_Rat
ID: 2225248
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
 
LVL 2

Expert Comment

by:basant
ID: 2225716
send me too at
basant_kukreja@hotmail.com
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2226353
email to khutchinson@tvgnetwork.com... I'd be glad to look at it for you...
0
 
LVL 2

Expert Comment

by:zulti
ID: 2227378
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
 
LVL 33

Expert Comment

by:hongjun
ID: 2227653
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
 
LVL 33

Expert Comment

by:hongjun
ID: 2227655
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
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2228686
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
 
LVL 1

Expert Comment

by:Lab_Rat
ID: 2230909
Is there 'sense' in anything?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 2231344
To AlexVirochovsky

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

hongjun
0
 
LVL 2

Expert Comment

by:zulti
ID: 2231948
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
 
LVL 2

Expert Comment

by:zulti
ID: 2231967
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
 
LVL 2

Accepted Solution

by:
zulti earned 300 total points
ID: 2265035
where r u ?
0

Featured Post

Live webcast with Pinal Dave

Pinal Dave will teach you tricks to help identify the real root cause of database problems rather than red herrings. Attendees will learn scripts that they can use in their environment to immediately figure out their performance Blame Shifters and fix them quickly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
Suggested Courses

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question