display "double" without loss of data

     Iam new to graphics programming.
   Iam involved in some mathematical formulation and endup with "double data type".
while trying to display the after proper scaling, I receive a warning " possible loss of data".

please help

best regards

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

OK, note that the error says "possible" that means it may not be loosing any data.
The second thing to note is that this is a compiler warning message, which enerally implies that you are trying to covert some sort of data type (doubles in this case) to another data type (possibly integers).
What are the two types you are converting between? Also, what language are you using and what is development program you are using?

Note that if you are using those values to plot pixel locations etc then it is not possible to put a pixel at location 2.5 for example, the pixel will have to be at either screen location 2, or 3.
cbodapatiAuthor Commented:
hello shamstar
    Iam coding in VC++,using winAPI, audio recording program.
to display the DFT reults.
    now Iam laded in a very strange problem.
       in my program iam not able  to initialise all the buffers to zero.
       when I check randomly the value is not a zero.
 I included math.h, even the poblem persists.
    what should I do.

Hummm... strange problem.
But quite likely to have a simple solution.  Are you setting the data to zero through pointers? In which case you should verify that the pointers point to the correct location in memory.
You should also make sure that the code where you read the values back from the buffer is correct.
If the values are still zero, are you sure you have initialised the buffer correctly.
Lastly, check to make sure that the values in the buffer are not changed somewhere else in the code after you have initialised them.

If you are familiar on using the VC++ debugger then you should ideally use this to check the data held in the memory locations of the buffer.  You should also set the program to break when a value in the buffer is changed, that way you can be sure that some other bit of code isn’t changing the buffer values after you have initialised them.
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

cbodapatiAuthor Commented:
hello shamstar
       now Iam solved with the initialisation problem.
   how to display the double datatype without loss of data.
   am I only the person facing the problem or I think this problem is quite common coz, many involve in maths and endup in double data(dealing with sin and cos).how do they manage.

please make clear

best regards
Ok, as I mentioned before, when it comes to doing graphics, the smallest unit you can use to draw something is a pixel.  Therefore it clearly isn’t possible to draw something at 10.41 pixels in from the screen, however you can draw it at either pixel 10 or pixel 11.
There are a number of different steps you can take when drawing things to screen.

The first, and simplest way is that you simple ignore the part after the decimal point, to if you value is 52.56673 you simply draw to pixel 52.

Sometimes the above method is fine to use, but in other situations, more precision is required.
In this case what you can do is to add the numbers after a decimal point together until they are equal to or great than 1, then this can be added to the rest of the value... so for example:
  if I have calculate the position of a car with a variable: real TheCar, and i want to
  plot the car position to the screen over a number of frames, then I can do this:

        ...do this every frame or while output is needed:
       TheCar = DoCalculation();
       if ( (TheCar - (int)TheCar) <> 0 )
                         TempStorage = TempStorage + ( TheCar - (int)TheCar);

       if ( TempStorage => 1 )
                         TheCar = TheCar + 1;
                         TempStorage = TempStorage -1;

That’s just some quick code that might help you to see how you can ignore the fractional part of the number until it becomes a size which you can draw to the screen.  In essence what it does is: say the value of TheCar is always 2.3 and TempStorage starts as 0.
Then in the value of those values are shown below in their successive iterations:
Note the value of the car is truncated to a decimal number since only those can be plotted on a screen.

  Iteration     TheCar       TempStorage
       1               2                   0.3
       1               2                   0.6
       1               2                   0.9
       1               3                   0.2       <---- TheCar value has been increased
       1               2                   0.5

Hopefully I’ve explained that well enough for you to understand the concept.

The third and final thing you can do is to simply use a function to round the double precision number either up or down based on its value, they may be the easiest-best solution in most cases.

Maybe Ive got things wrong here and you actually want to know how to display the text value of the double precision number???

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
cbodapatiAuthor Commented:
 hello shamstar
     i want to display only the int part.(no decimal part). but is it sure that there is no loss of data.(the value is well below the range of the max int value).I know the pixel position take only the integral values.  

thanking you
best regards

If you only want to display the integer part then you arnt loosing any of the data that you want to keep.  The compiler only give you that warning just to inform you of whats going on.  The method you're using the probally the best way to display only the integer part of the number so theres nothing to worry about, you can simply ignore those compiler warning.

Goodluck with your program!
cbodapatiAuthor Commented:
 hello Mr shamstar
    thank q,  I'll come back to you if any problem arises.
mean while

    when iam recording, the recorded sound is being heard from the speakers . can I get rid of this feature.
   I want only recording (without playback).
 Iam using
   windows 98-VC++,WinAPI.
 please help me

best regards
Yes, you can turn it off... this is most likely due to an option set somewhere in your control panels.
The name of the command you need to look for varies from software to software so I couldnt tell you what to look for exactly... but often its known as "Playthrough".
Genreally, you should look around in the Sounds and Multimedia control panel (try looking in some of the advanced settings).

If you cant find it there, then the recording program may well have an option to turn off the playback as well.  What program are you using to record sounds?

[Note that this thread may no longer allow us to post (since it has been closed - not sure), but if it does, then just create a new one somewhere with my name in it and I'll reply there.]
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
Web Graphics Software

From novice to tech pro — start learning today.