LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Single Precision Float

Can any one help?

I  see the SGL icon which converts a number to Single Precision Float.

But I cannot see how to convert a 32 bit Single Precision Float back to a number.

0 Kudos
Message 1 of 15
(3,901 Views)

Do you by 'number' mean some integer? A float is a number. 🙂

If so, It's any of the to Ixx or Uxx functions. The most common one would be to I32.

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 15
(3,896 Views)

I may have it all wrong. The SGL icon is on second look probably not what I need.

What I a looking for is to convert to and from a number in IEEE-754 Floating Point.

the number input could be any real number.  

 
 

 

0 Kudos
Message 3 of 15
(3,877 Views)

I think a valid question here - perhaps even a better one is, "Why do you have to do this?"

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 15
(3,873 Views)

john@crane wrote:

I may have it all wrong. The SGL icon is on second look probably not what I need.

What I a looking for is to convert to and from a number in IEEE-754 Floating Point.

the number input could be any real number.  

 

SGLs represent "real numbers" (quantized to their inherent binary resolution). There is nothing to "convert".

 

You really need to explain the problem better. What do you define as "real number" in the above sentence:

 

  • A numeric in one of the other representations (DBL, etc.)
  • A flattened string representing the bits in the four bytes of a SGL (given correct endian-ness)
  • A ASCII formatted string showing the number in human readable text consisting of characters 0..9, a decimal delimiter, and maybe an exponent delimiter?
  • Something else?

 

 

0 Kudos
Message 5 of 15
(3,856 Views)

john@crane wrote:

 

What I a looking for is to convert to and from a number in IEEE-754 Floating Point.

the number input could be any real number.  

 

Convert to and from what IEEE-745? As all the floating point numeric types below are IEEE-745 types.

 

IEECapture.PNG

========================
=== Engineer Ambiguously ===
========================
Message 6 of 15
(3,822 Views)

And if it isn't obvious from the table that RTSLVU posted, LabVIEW Sgl is IEEE-754 Binary32, LabVIEW Dbl is IEEE-754 Binary64, and LabVIEW Ext is IEEE-754 Binary128.

 

Many of us "standardize" on Dbl for Reals.

 

Bob Schor

Message 7 of 15
(3,801 Views)

john@crane wrote:

Found solution at:


There is no way we could have known that this is what you are looking for. You never mentioned "binary" or "boolean" anywhere here.

Re-reading your questions, you wanted to "convert a number" (and never explain what you mean by that!). Your link shows how to convert properly formed boolean arrays (representing 32bits) to a SGL. Who would have guessed!? 😮 Boolean arrays are not "numbers" by most definitions!

0 Kudos
Message 9 of 15
(3,757 Views)

@altenbach wrote:


There is no way we could have known that this is what you are looking for. You never mentioned "binary" or "boolean" anywhere here.

Re-reading your questions, you wanted to "convert a number" (and never explain what you mean by that!). Your link shows how to convert properly formed boolean arrays (representing 32bits) to a SGL. Who would have guessed!? 😮 Boolean arrays are not "numbers" by most definitions!


As an FPGA programmer, I am not sure how to feel.... 🤔

 

0 Kudos
Message 10 of 15
(3,716 Views)