murphy@pur-phy (William J. Murphy) (11/17/88)
[ for all you do..... this line's for you] I have been perplexed by the typing of doubles reals and ints in Turbo Pascal 4.0. My problem is this, I have an array of doubles that I wish to plot to the screen. In order to do that, I must map them to the screen coords. To do the mapping, I use the following bit of code. yshift := Win1.Height - trunc( Win1.YScale * Win1.YMin); For i := 1 to 512 do Begin y := data[i]; y1 := yshift + trunc( Win1.Yscale * y); PutPixel(i, y1, 13); End; The preplexing part is that trunc requires a real. o.k, I give it a real, and I get a floating point overflow error (#205 to be specific). I give it a double, and I get error (#207 : invalid floating point operation). What I can guess from the description of the error, is my value for Win1.YScale * y is outside the range of a longint. Question: Has anyone come up against such a problem? If so, did you solve it? Is it possible to write your own int() or trunc() functions that will return a value when outside that range? This may all be a moot point. (do moot's have points?) I am interested in other's experience with this type of problem. Thanks, Bill Murphy murphy@newton.physics.purdue.edu