LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary to Decimal convert in reverse manner.

Solved!
Go to solution

"You are basically measuring the debugging overhead" ... hummm, It's possible, I don't say "no".

When you will have free time, I would be very interested to see how you could solve this, really.

0 Kudos
Message 21 of 32
(1,970 Views)

Dear All,

 

How can I do teh same thing in reverse. I mean what should I do to get back those numeric values ( encircled in black ) by just providing a DBL number ( encircled in red ). 

 

Capture.JPG


Regards.


0 Kudos
Message 22 of 32
(1,911 Views)

Typecast the double to an array of I16, then you have your bytes, though you still have to reverse the manipulation you've done  in between.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 23 of 32
(1,905 Views)

First I need to find the log of base 2 and then add it with 127 to find the biased exponent which I have successfuly achived ( not so difficult though ). I feed the value 0.1 and exponent comes out to be -4 and biased will be 123 (127-4). Since I also need to find mantissa. The corresponding code in visual basic to find mantissa is:

Mantissa = 1
     MantissaString = ""
     absfloat = Abs(float)
     For ctr = 1 To 23
       MantissaTemp = Mantissa + 2 ^ -ctr
       If MantissaTemp * 2 ^ Exponent <= absfloat Then
         MantissaString = MantissaString + "1"
         Mantissa = MantissaTemp
       Else
         MantissaString = MantissaString + "0"
       End If
     Next ctr

 

 

This is a similar to the way that you convert an integer from decimal to binary. You just go through checking each digit to see if it makes the value less than or greater than the value you're trying to approximate. Here's the code that I use. Remember that the 1 before the decimal point is implied for the significand. I should also add that what I refer to as Mantissa and MantissaTemp below are actually the significand, and only MantissaString refers to the actual mantissa.

Regards.


0 Kudos
Message 24 of 32
(1,889 Views)

Hey Nap,

 

Did you end up figuring it out?

Jesse S.
Applications Engineer
National Instruments
0 Kudos
Message 25 of 32
(1,848 Views)

Hi ouadji!

 


I did a benchmark of the two .VIs shown in message 15 (Boolean) and message 17 (non-Boolean)

 

and here's what I get for "allow debugging: ON" and "allow debugging: OFF"

 

 

2013-10-04_allow-debugging-ON.png

 

2013-10-04_allow-debugging-OFF.png

 

 

 

Regards,
Alex

0 Kudos
Message 26 of 32
(1,835 Views)

Dear Fox,

 

NOPE!

 

Regards.


0 Kudos
Message 27 of 32
(1,817 Views)

I need a solution, not here to see grand prix of functions executions. 

Regards, 


0 Kudos
Message 28 of 32
(1,813 Views)

You have a VI for forward conversion, and you have the VB code, so what's the issue? You dont find the 2log(x) in LV?

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 29 of 32
(1,810 Views)

I was able to find the Log(x) but the rest of the part I couldn't figure out. I am still on the verge of figuring it out myself. Meanwhile if someone could come up with solution I will appreciate it. 🙂


Regards.


0 Kudos
Message 30 of 32
(1,806 Views)