comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: inverse function of binary.pro
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: inverse function of binary.pro [message #39959] Wed, 30 June 2004 07:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> For something quick and dirty, how about this:
>
> FUNCTION Inverse_Binary, binaryNumber
>
> s = Size(binaryNumber, /Dimensions)
> bn = Reform(Long(binaryNumber), 8*s[1])
> len = N_Elements(bn)
>
> RETURN, Total(bn*2^Reverse(Indgen(len)))
>
> END
>
> Works for the two or three values I've tested. :-)

Well, of course it doesn't work for the example *you*
gave, but it works for all the examples *I* used. :-(

Cheers,

David

P.S. Let's just say I *always* prefer long integers to
floats. :-(

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Inconsistent errors when opening itools
Next Topic: Help calling a DLL from a DLM

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 13:21:34 PDT 2025

Total time taken to generate the page: 0.39927 seconds