Re: [CHALLENGE] finding rightmost zero bit
- From: Bart Vandewoestyne <MyFirstName.MyLastName@xxxxxxxxxx>
- Date: Mon, 29 Aug 2005 19:38:18 +0000 (UTC)
On 2005-08-29, Michel OLAGNON <molagnon@xxxxxxxxxxxxxxxxx> wrote:
>
>
> I claim the slowest
bartv@vonneumann:~/fortran$ ./time_findpos
huge(n) is 2147483647.
Enter first number: 1
Enter last number: 147483647
Total bits counted: 294967286
Bart1's method did it from 1 to 147483647 in 1.82 seconds.
Total bits counted: 294967286
Bart2's method did it from 1 to 147483647 in 1.88 seconds.
Total bits counted: 294967286
Bart3's method did it from 1 to 147483647 in 1.89 seconds.
Total bits counted: 294967286
Michel's method did it from 1 to 147483647 in 18.50 seconds.
*fwew*... that's indeed slow :-)
> but it's a one-liner:
>
> pos = nint (log (real(ieor(n,n+1)+1, kind=renough)) / log (2.0_renough))
>
>:-)
OK. Bonus-point for you :-)
Regards,
Bart
--
"Share what you know. Learn what you don't."
.
- Follow-Ups:
- Re: [CHALLENGE] finding rightmost zero bit
- From: Michel OLAGNON
- Re: [CHALLENGE] finding rightmost zero bit
- References:
- [CHALLENGE] finding rightmost zero bit
- From: Bart Vandewoestyne
- Re: [CHALLENGE] finding rightmost zero bit
- From: Michel OLAGNON
- [CHALLENGE] finding rightmost zero bit
- Prev by Date: Re: [CHALLENGE] finding rightmost zero bit
- Next by Date: Re: [CHALLENGE] finding rightmost zero bit
- Previous by thread: Re: [CHALLENGE] finding rightmost zero bit
- Next by thread: Re: [CHALLENGE] finding rightmost zero bit
- Index(es):
Relevant Pages
|
|