Re: Question about IIO_DEGREE_TO_RAD macro in include/linux/iio.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Got it, THX,

Gwendal.

On Thu, Jul 16, 2015 at 2:19 AM, Lars-Peter Clausen <lars@xxxxxxxxxx> wrote:
> On 07/16/2015 01:24 AM, Gwendal Grignou wrote:
>>
>> Lars,
>>
>> Looking at the macro IIO_DEGREE_TO_RAD() to translate degree/s into rad/s,
>> I don't understand why we add an offset when doing the conversion:
>>
>> #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) /
>> 18000000ULL)
>>
>> Shouldn't it just be
>> #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL) / 18000000ULL)
>
>
> Hi,
>
> The offset is for rounding to the nearest integer. Without the offset it
> would round down.
>
> - Lars
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux