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

angular - DownloadURL return null in below code -

python 2.7 - Given three nested dictionaries, sort the top two nested dictionaries from a value in the innermost dictionary? -