简体   繁体   中英

convert double into int

I have following double value: 8.943 need to convert(cast) into int eg: 8.943*1000000 = 8943000 required value --> 8943000

please help!

thanks.

double myDouble = 8.943
int myInt = (int) (myDouble * 1000000)

Using (int) casts the double into an int

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM