# question

## Integer vs single format in PointF function

I posted this initially in the wrong forum so excuse the double post.

I am working with graphing some functions and I need some clarity on the following code snippet.

`````` For x = -175 To 175 Step 0.1
y = -CSng((x ^ 2) / 100)
Next

For x = -175 To 175 Step 0.1
y = -CSng((x ^ 2) / 100)
g.DrawLine(Pens.LightGray, New Point(x,-y), New Point(x, y))
Next
``````

In the first code snippet PoinF appears to store the X value as an integer and the Y value as a decimal number which is great, no problem.
For example the x and y values are like:

X Y
-175 306.25

but in the second code snippet New point has to be only integer??

Can someone explain to me why thats the case? Perhaps the point function allows decimals and the Drawline does not?

Or does the PointF function convert automatically to integer?

And is one method better to use then the other since I am also using antialiasing to smooth my graphing functions more smoothly?

Les

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Les-0449 ,
Point uses integer coordinates, but PointF uses floating coordinates.
You need to use PointF parameters in Graphics.DrawLine function in your case.

`````` g.DrawLine(Pens.LightGray, New PointF(x, -y), New PointF(x, y))
``````

Best Regards,
Xingyu Zhao

· 2 ·

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi X

First thx for the help in understanding this. So PointF uses floating point I got that now. So for as smooth a line I can make I should use floating point? So when things get graphed what I don't understand is since you can not have a partial pixel isn't everything converted to integer?? Just trying to fully understand.

And lastly does it matter which way I code things to produce my graph?? Code snippet 1 vs code snippet 2

Thank you

Les