Unity Float operations problem

Hello
When I tried to make some multplication or division between 2 float numbers it always returns an integer instead of a float.
I couldnt understand the problem? Can you help me with that
My code is below:

	public Vector3 convertDegreeToFlatEarth(float lat,float lon)
	{
		float flatConstant = 4096.0f;
		float x = (float) lon*flatConstant;
		float y = 0;
		float z = (float) lat*flatConstant;
		
		return new Vector3(x,y,z);
	}

And when I gave this numbers as input
Lat:41.10669 Lon:29.00122
It produces this output
Lat:168373 Lon:118789

Do you know what can be the problem

Thanks
Tolga

They’re still floats - just rendered that way. Read up about floats vs decimals if you want to understand more

Can you show me the link?

Use decimal instead of float and everything will be fine )

The method you displayed to us does not cast anything to an integer, you are missing something important out. Please show us how you use the returning Vector3.

Also if you try to convert polar coordinates to Cartesian coordinates, you do something terribly wrong :wink: