Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I convert a nsnumber into a float

I need to multiply the value of an nsnumber by a float but they are of course incompatible types. How can I cast the nsnumber to a float?

like image 208
dubbeat Avatar asked Sep 10 '25 16:09

dubbeat


1 Answers

float result = [myNSNumber floatValue] * myFloat;

Please check the "Accessing Numeric Values" section from NSNumber class reference for converting to other types.

like image 149
taskinoor Avatar answered Sep 12 '25 07:09

taskinoor