c# - using float.Parse() vs casting to get a value from double -


i wasn't able find question directly answers question, came across line of code in project @ work (i added comment)

// act.score double float score = float.parse(act.score.tostring()); 

is there greater loss of precision in converting double -> string-> float vs double -> float?

the original engineer no longer works here, know comes python background, maybe wasn't aware of loss of precision? or there reason convert string first, , float?

in case sound confusing, reference, have done:

float score = (float)act.score; 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -