Mapping a BigInteger to a circle

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-04-28T12:04:22Z Indexed on 2010/04/28 12:13 UTC
Read the original article Hit count: 354

Filed under:
|
|

I have a C# system using 160 bit numbers, stored in a BigInteger. I want to display these things on a circle, which means mapping the 0->2^160 range into the 0->2Pi range. How would I do this?

The approach that jumps instantly to mind is

angle = (number / pow(2, 160)) * TwoPi;

However, that has complexities because the division will truncate the result into an integer.

© Stack Overflow or respective owner

Related posts about c#

Related posts about biginteger