user1861013
user1861013

Reputation: 139

Converting a double to a float?

I have a list of 100k stars each are plotted using doubles an example:

Coordinates of a star [32.381562, 124.628052, -354.710990]

I'm working with unity and large scales so I need to be able to convert these doubles to floats, is there any method available without losing critical precision?

Upvotes: 0

Views: 363

Answers (1)

HalpPlz
HalpPlz

Reputation: 701

If you're sure this is what you want to do, the standard way to convert from a double to a float is:

float someFloat = 32.381562;
double someDouble = (double) someFloat;

It's called casting or type conversion, and you can read all about it here.

Upvotes: 2

Related Questions