cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

kbrafford
Adept II

conversion from double and float to int

How many cycles does it take to convert a double to an int?  What about a float? (on the 5870, BTW)

0 Likes
3 Replies

kbrafford,
Float to int can be executed in a single instruction. Double to int is not 100% supported in SDK 2.1, but the current non-conforming implementation executes it in 2 instructions(dbl->float then float->int). In the upcoming release, double to int will be fully supported and should take ~12-15 instructions for 32bit ints and ~20-23 instructions for 64bit ints.
0 Likes

current non-conforming implementation executes it in 2 instructions(dbl->float then float->int)...In the upcoming release, double to int will be fully supported and should take ~12-15 instructions


Will we still be able to do the 2 cycle path when the 12-15 cycle solution is in place?

0 Likes

If you want to execute it in two instructions, you will need to explicitly cast from double to float, and then float to int.
0 Likes