07-20-2009 02:00 AM
hi, I was a little puzzled by this question from my friend!
He has this for loop to create a double precison random number into an array!
now, he asked me which is better when he tries to convert the number into single precision number inside the loop & outside the loop!
aren't they both the same thing?!
Jay
Solved! Go to Solution.
07-20-2009 02:09 AM
Hi Jay,
i think outside the loop is faster, because it's only one operation. If the function can do it, then you should use it, because it should be optimized for it.
Mike
07-20-2009 02:12 AM
Hi BooJay,
conversion in the loop: the output tunnel already creates a SGL array.
conversion outside: the tunnel creates a DBL array, which is converted as a block to SGL - thus needing another block of memory.
As long as memory permits you may use both methods. The conversion in the loop uses less memory, but may run slightly slower...
07-20-2009 02:32 AM
cool, thanks Mike 7 GerdW,
I can understand why now!
Thank you so much!
Jay