Single precision constant changes value

See attached "vi". If I put a double precison numeric on my block diagram, change it to SINGLE precision, then enter the value .001 into it, it adds values to the far right of the decimal. Why is it doing this? I'm using Labview 2011 SP1.
Solved!
Go to Solution.
Attachments:
precision.vi ‏5 KB

Posting by phone and just taking a guess.
The precision is defined in bits and many fractional values don't have an exact decimal translation.
For example 0.001 cannot be represented exactly in sgl or dbl.
This is inherent to the floating point representation and not language specific. You simply get the closest possible value. Set it back to DBL and change the format to show 20 decimal digits. Same difference.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Why is the difference in execution speed of the function "SetCtrlVa​l" between constant and changing values so small ?

    In my large application (1 MB exe-file) I am continuously updating a lot of numeric controls with new values. Most of them do not really change their value. Within my search of improving the performance of my application I noticed, that there is only a small difference of the execution speed between a call of "SetCtrlValue" with constant values and calls with changing values. It runs much faster (25 times on my PC), if I get the actual control value with "GetCtrlVal", compare it with my new value an do a call to "SetCtrlVal" only if the current value and the new value are different.
    My questions to CVI-developers is:
    Isn't it possib
    le to do this compare within the function "SetCtrlVal"
    My question to all CVI-users is:
    Does anyone have similar tips to improve the performance of CVI applications ?
    I developed a small test application for this problem, which I can mail to interested users.

    What takes the extra time is the redraw of the control. When you call SetCtrlVal we ALWAYS redraw the control. We wouldn't want to build in functionality to check if the value was the same because that would add additional time to the SetCtrlVal in every case. If you want to do it outside of the loop you can as you have done above. You have a few options. First, keep a previous value variable for the controls that you can use to determine whether to set the control value. I.E.
    int oldVal = 0;
    int newVal = 0;
    if(newVal!=oldVal) {
    SetCtrlVal(..., newVal);
    oldVal = newVal;
    Also, if you set the value of a control through SetCtrlAttribute instead, there is no built in redraw of the control (which is what takes all the time). Using SetCtrlAttribute
    to set the value is very fast, but remember there isn't a built in redraw on the screen to display the new number.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • I am using the dynamic signal analyzer.vi but this vi has the output as single precision. How can I change this to DBL precision?

    I am using the dynamic signal analyzer.vi but this vi has the output as single precision. How can I change this to DBL precision? If I change the representation from single to double in the AI buffer read.vi labview returns ilegal operation and crash. I have labview 5.1 on windows 95 and one AT-MIO16XE50 DAQ board.
    Thanks in advance
    Ricardo.

    Probably by changing the data type that lvdaq.dll expects to write to is causing the crash. I can't test this since I have only 6.1 installed now. In any case, since the daq card is only 16 bits, the single precision is probably adequate for AI Buffer Read. If you do need the greater precision later on, you should be able to change representation in any one of the upper level VIs.

  • What would cause a enum typedef constant changes during execution

    Hello,
    In my program I having a problem with an enum constant for a tab selection changing value at runtime.  The enum is in the initialization part of the program and when I single step through the loop you see the tab property node for the value highlight and then in the next step the enum changes value.  I'm running LV 8.0
    Any information will be greatly appreciated.
    Gary
    Solved!
    Go to Solution.

    Ben,
    Here are three jpg's to view with the first one once I enter the loop, the second is single stepping up to the property node and the third is the next single step  and where the constant changes.  I hope this helps I'm looking into a possible race condition could be the cause of this, but I'm not sure yet.
    Gary
    Attachments:
    Enum constant changing at run-time.JPG ‏177 KB

  • Change value of a typedef in parallels to another running action

    Hello,
    Well, I have a problem with my VI.
    To summarize I use a Vi « IdsVg.vi » to achieve some measurements process.
    This one uses an action engine as a sub-vi to store data of the front panel and to precede complementary actions. The front panel is a strict typedef…
    I programmed the Vi avoiding to use sequence structures in order to be able to do other actions on the front panel in parallels. Nevertheless I’m running out of ideas for solving my problem.
    The problem:
    I would like to change values (time constant, Boolean of graph) of the front panel at any instant when the main vi is running. The actual problem is: when I start the program, using register event I can change values of the front panel, but when the program is running the while loop in which it gets the measurement, it isn’t possible to change parameter of the front panel…  
    Is there a solution or a trick??
    Thank you for help
    Attachments:
    MyProblem.lvproj ‏10 KB

    Putting in the project file does not help much, good try though. The actual files are missing though, so nothing shows up.
    I suggest you create a separate producer consumer loop in your main vi. The vi retrieving the data could pass the relevant data (producer) and the consumer loop will then process the data and update the fron tpannel. Note, only the producer consumer loop will update the front pannel.
    You would not need a sequence structure to control the update. The producer consumer loop will only execute when you provide the necessary data.

  • How can I hide constant variable value in class file?

    hi,everybody.
    I am having a problem with constant variable which define connectted with database(URL,username,password).
    when I used UltraEdit to open class file, I can see constant variable value.
    Thanks!

    OK, let's see. Firstly, if I may correct your terminology, the phrase "constant variable" is a paradox (I think that is the right word). You have either one of the other. You declaration is either 'constant' or 'variable' (ie: it can change at run-time or it doesn't). People often use the term 'variable' and 'declaration' interchangably which is where the confusion lies.
    Anyway, onto the real problem. It seems that you want to protect your connection details (in particular the password, I would guess). Unfortunately, Java compiles not to machine-code, but byte-code which is semi-human-readable. So people, if they are inquisitive enough, will always be able to see it if they try hard enough.
    You can do one of two things:
    (1) Get an 'obfusticator'. An obfusticator is something that you run over Java source files and it completely messes it up (without modifying functionality). You then compile and the original source is such gibberish that the byte-code is very difficult to understand. However, the password will still be in there somewhere.
    (2) Don't put sensitive information into your source. Have this kind of info in external files (encrypted) and allow your class to read this file, decrypt, and use it.
    Hope that helps.
    Ben

  • Single Precision Floating Point Numbers to Bytes

    Ok here is some code that i have written w hile back with some help from the support staff. It is designed to take in precision floating point numbers that are stored as 4 bytes and convert then to a decimal value. It works off of a udp input string and then also reformats the string. I have the ability to look at up to 4000 parameters from this one udp string. But now what i want to do is do the opposite of what i have written, and also perhaps get rid of the matlab i used in it as well. What i would like to be able to do is input a decimal value and then have it converted in to the 4 byte groupings that make up this decimal nd then have it inputed back in to a single long string witht hat grouping of bytes in the right order. A better explanation of what was done can be found on this website
    http://www.jefflewis.net/XPlaneUDP_8.html
    as the original code followed the "Single Precision Floating Point Numbers and Bytes" example on that site but what i want to do is "Going from Single Precision Floating Point Numbers to Bytes". The site also explains the udp string that is being represented. Also attached is the original code that i am trying to simply reverse.
    Attachments:
    x-plane_udp_master.vi ‏34 KB

    Perhaps what you are doing is an exercise in the programming of the math conversion of the bytes.
    But if you are just interested in getting the conversion done, why not use the typecast function?
    If the bytes happen to be in the wrong order for wherever you need to send the string, then you can use string functions to rearrange them.
    Message Edited by Ravens Fan on 10-02-2007 08:50 PM
    Attachments:
    Example_BD.png ‏3 KB

  • Change value table cdpos

    Can we fetch changed values stored in cdpos related to fields eindt,menge, netpr.since a single table doesn't contain all these fields when i am using select statement for cdpos i am not getting proper idea about tabname in where condition .i can put the table name overthere but if more than one table is needed then how to use select query for cdpos .actually i am running shor of information.

    in where condiiton u can write
    tabname = 'VBAK' or
    tabname = 'VBUK'

  • Why do I get this error when running the PID Control-Single Channel.vi: "Requested value is not a supported value for this property."

    Error -200077 occurred at Property Node DAQmx Timing (arg 3) in DAQmx Timing (Sample Clock).vi:1->PID Control-Single Channel.vi
    Requested value is not a supported value for this property.
    Property: SampQuant.SampMode
    You Have Requested: Hardware Timed Single Point
    You Can Select: Finite Samples, Continuous Samples
    Author: Pcorcs
    Attachments:
    PID Control-Single Channel.vi ‏53 KB

    Actually I have already tried a few things you suggested and got as far as the DAQmx Write vi. The error at the DAQmx was a buffer error indicating i needed to set it to 2 instead of the default of 1. Tried using the DAQmx Input and Output Buffer vi to change buffer, with no luck.
    Attachments:
    PID Control-Single Channel.vi ‏53 KB

  • How to change value in BADI

    I want to change value of field afnam based on the following code below in BADI ME_PROCESS_REQ_CUST.
    But this code give me endless loop.  Is there anything missing in my coding?Please correct me, Thank you.
      data : obj_pr type MEREQ_ITEM,
             wa_eine type eine.
    CALL METHOD IM_ITEM->get_data
    RECEIVING
    re_data = obj_pr.
      if obj_pr-infnr <> space.
        select single * into wa_eine from eine
        where infnr = obj_pr-infnr.
        if sy-subrc = 0.
          obj_pr-afnam = wa_eine-effpr.
        endif.
      endif.
    CALL METHOD IM_ITEM->set_data
    EXPORTING
    im_data = obj_pr.

    Hi Jessie,
    As per my understanding, the thing is that, in BADI  "ME_PROCESS_REQ_CUST", there is a method called "CLOSE".
    you have to implement this method to close the processing....
    work on triggering the method first and if it triggers, then implement the coding and see how it is working....
    thanks,
    Vishnu.

  • Single precision conversion

    Can someone explain why doing a floating point conversion compromises digit of precision accuracy? For example, if I wire the double precision number "16.0001000" to the "to Single Precision Float" vi input, the output is "16.0000991". 
    I have an application in which this level of accuracy is critical. I can think of several work arounds, but I still would like a good explanation for why this is the case.
    pmac

    Just use array to spreadsheet string on the DBL and write as text file (and an analogous operation for reading, converting back to DBL). Alternatively, you could make DBL version of "read/write  spreadheet file" by editing them slightly and saving them under a new name elsewhere. Make sure to change the icon too, e.g. give it a different color.
    If precision is that important, you might want to use binary files. The don't have any formatting loss at all.
    Of course if this is just measurement data, don't be fooled by fake precision. even SGL has a 22 bit mantissa, so if your DAQ hardware acqures in 16 bits, SGL is plenty.
    LabVIEW Champion . Do more with less code and in less time .

  • Changing value when reading from file

    When I am reading from a text tab-delimited file labview is returning a changed value. For example, the value should be 337478.47 but labview is returning 336727. I have tried changing the array to EXT, it is currently DBL, and that didnt seem to change anything.
    I am using LabView 8.
    Attachments:
    read_from_file2.vi ‏25 KB
    test data.txt ‏5 KB

    Your numbers are fine. Just right-click on your indicators and select the desired format and precision. (By default, it only shows 6 significant digits).
    See if this works.
    LabVIEW Champion . Do more with less code and in less time .

  • BO XI and the constant change rate analysis

    Hello,
    We have a BI system (BO XI + Oracle) which contains sales of all countries in the world. All the amount are stored in local currency.
    We have a 10 indicators in our univers for these local currency figures and 10 other corresponding indicators for the value in Euro. The exchange rate apply for a currency is annual (and stored in the database for each currency / year)
    ->if I report a euro indicator for a country on 3 years, 3 exchange rates will be applied to the corresponding years 
    ex: for 2007,2008,2009  and Russian sales, the Turnover of the 3 years will be : Amount_2007 * Rate_2007 + Amount_2008Rate_2008 + Amount_2009Rate_2009 (this is the normal behavior of aggregation in BO)
    For the business, it's very interesting to see the evolution of sales without the change rate effect (to work with constant change rate). So to do this analysis, I would like to apply the same change rate to the sales of the 3 years to get the amount in Euro
    -> (Amount_2007 + Amount_2008 + Amount_2009) * Rate_2008
    my question:
    is it possible to work in constant rate with BO XI without to have a too complex way to do it for users ? We would like to have an object to put in condition with the values "constant rate" / "yearly rate" of better, an object with a list of years to choose the rate to apply
    thanks in advance for your answer !
    dansledoute

    Hi
    I hope you are building query like below
    Year | Turnover | Rate
    And then Multiplying 
    Euro turnover =Turnover * Rate
    For Rate measure you can use following expression (You would need to change it as per our table name)
    CASE WHEN 'CONSTANT'=@Prompt('Which Type','A',{'CONSTANT','CHANGING'},,,,) THEN
    MAX(DECODE(DATE_DIM.YEAR,@Prompt('Which Year','N','Currdim\Year',,,,),RATE.RATE)) OVER (PARTITION BY @Prompt('Which Year','N','Currdim\Year',,,,) )
    ELSE MAX(RATE.RATE) OVER (PARTITION BY DATE_DIM.YEAR )
    END
    Now if data is like below
    Rate Table
    Curr | YearMnth | Rate
    RUB| 201001 | 3
    RUB| 201102 | 4
    Above expressions will give you rate of selected same year if CONSTANT is selected. i.e.
    Year | Turover | Rate
    2010 | 3000 | 3
    2011 | 4000 | 3
    Now you can multiply Rate * Turnover to get constant turnover for 2010 rate. Basically you can create the variable at report with following definition
    =([Euro Turover] * [Rate])
    Let me know if this solves your issue.
    Edited by: Kuldeep Chitrakar on Jun 5, 2011 3:31 PM

  • How to change value separator for html_Get function?

    I have application process, which gives invoice related information (date, amount,number). I run this process using html_Get function. Problem is with invoice amount. In polish localization decimal separator is comma (,). Then for an invoice issued today with value 1100.20 with number AA1 process returns: 2010-07-01,1100,20,AA1. It seems to be 4 values instead of expected 3.
    Is it possible to change value separator to ';'? Or maybe there is another solution for this problem.
    regards,
    Krystian

    hmmm join(separator) function     
    Joins together all the elements in an array to produce a single string. If no separator argument is passed through a comma is assumed.
    <script type="text/javascript">
    var scripts = new Array();
    scripts[0] = "PHP";
    scripts[1] = "ASP";
    scripts[2] = "JavaScript";
    scripts[3] = "HTML";
    var str=scripts.join(" : ");
    document.write(str);
    //document.write(scripts.join(" <br> "));
    </script>
    had to do research myself and found this, don't know if this will help you out tho..

  • Variants -- with changing value!!!

    Hi,
    I want to run a program by using the SUBMIT keyword and passing a variant using USING SELECTION-SET <variant name>
    And the variant changes its values for each execution of the SUBMIT statement.
    According to the replies to a similar question posted in this forum, I found that we can have constant input values in a VARIANT and pass the changing values using the WITH keyword.
    is there any other way to achieve this other than the above solution..........
    any help wud greatly be appreciated.!!!!!

    Hmm, you could set up multiple variants and change which variant you call the program with each time you SUBMIT.  Example:
    SUBMIT program_name USING SELECTION-SET variant1 AND RETURN.
    SUBMIT program_name USING SELECTION-SET variant2 AND RETURN.
    (and so on).
    Another way to do it is to specify the fields separately, like this:
    SUBMIT program_name WITH parameter1 = w_field1 AND parameter2 = w_field2
    AND RETURN.
    You can use this same statement multiple times, changing the values of w_field1 and w_field2 between calls (for instance, by putting the submit statement inside a LOOP, ENDLOOP).  I hope this helps.
    - April King

Maybe you are looking for