CUDA теперь поддерживает printf
прямо в ядре. Формальное описание см. В Приложении B.16 Руководства по программированию CUDA C .
Your code is wrong in objective C...
(200 / 23) * abs(2987 % 23) - (23 / 2);
Should be
(200 / 23) * abs((2987 % 23) - (23 / 2));
Which is just 73.9.
But this formula is also incorrect, you want values between 0 and 100. Your current formula does not reach 0, because a%23 has a range of 0-22, so the lowest value you can get if you subtract 23/2 and then take the absolute value is .5 (11-11.5 and 12-11.5). 22 would be the ideal number in this instance.
Also by subtracting 23/2 you get an uneven distribution, if you just multiplied the mod by 100/22, you would be better off. It would help to know what you are attempting.