Jump to content

Get representation of a number


Recommended Posts

Hello,

I have to generate a random unsigned integer from 0 to max. possible.

So I take "Random Number 0-1.VI" and multiple it's output with eg. 65536 (for U16). Ok, but if I would change the representation to U32, so I want programmaticaly know that I have to take 2^32 for my max. value.

Is it possible to get the representation of the wire? Should I flatten it to binary and use type string for it?

Here the screenshot

Link to comment

I don't understand what it is you want to do. If you want to change the output based on the type of the input the easiest and most reliable way is to use a polymorphic VI.

Another option is to just use DBL which should cover most other representations, I believe. OpenG has a function which does exactly this and accepts DBL. It might have polymorphic versions, but I don't think it does - the cleanest thing is probably to output the double value and then convert it after it leaves the subVI.

Link to comment

QUOTE (Yen @ Jun 14 2008, 09:54 PM)

I don't understand what it is you want to do. If you want to change the output based on the type of the input the easiest and most reliable way is to use a polymorphic VI.

Another option is to just use DBL which should cover most other representations, I believe. OpenG has a function which does exactly this and accepts DBL. It might have polymorphic versions, but I don't think it does - the cleanest thing is probably to output the double value and then convert it after it leaves the subVI.

Yeah, polymorphic VI is the right solution for this, I think.

Thank you, Yen

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.