return NaN

I'm still working on the control of Java, and right now I'm working on a GUI loan calculator. Everything seems to work just and right eye until I hit calculate. The clear button works fine, but once I hit calculate that it returns NaN (not a number). Here is the code:
< code >
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* LoanCalculaterUI.java
*
* Created on 19 December 2010, 22:07:22
*/

package my. LoanCalculator;

/**
*
owner of * @author
*/
SerializableAttribute public class LoanCalculaterUI extends javax.swing.JFrame {}

/ * Creates the new LoanCalculaterUI form * /.
public LoanCalculaterUI() {}
initComponents();
}

/ * This method is called in the constructor for
to initialize the form.
* ATTENTION: Do NOT change this code. The contents of this method is
* always regenerated by the form editor.
*/
@SuppressWarnings ("unchecked")
< Publisher-fold defaultstate = "collapsed" desc = "Generated Code" > //GEN-BEGIN:initComponents
private void initComponents() {}

btngrp_Credit = new javax.swing.ButtonGroup ();
jPanel1 = new javax.swing.JPanel ();
jLabel1 = new javax.swing.JLabel ();
jLabel2 = new javax.swing.JLabel ();
jLabel3 = new javax.swing.JLabel ();
jLabel4 = new javax.swing.JLabel ();
txtVehiclePrice = new javax.swing.JTextField ();
txtDownPymnt = new javax.swing.JTextField ();
txtLoanLength = new javax.swing.JTextField ();
badCredit = new javax.swing.JRadioButton ();
avgCredit = new javax.swing.JRadioButton ();
greatCredit = new javax.swing.JRadioButton ();
txtPayment = new javax.swing.JTextField ();
Calculating = new javax.swing.JButton ();
btnClear = new javax.swing.JButton ();

setDefaultCloseOperation (javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText ("loan calculator");

jLabel2.setText ("price of the vehicle :");

jLabel3.setText ("deposit:" "");

jLabel4.setText "(Length (yrs):)") loan;

txtVehiclePrice.setName ("price"); NOI18N
txtVehiclePrice.addActionListener (new java.awt.event.ActionListener () {}
{} public void actionPerformed (java.awt.event.ActionEvent evt)
txtVehiclePriceActionPerformed (evt);
}
});

txtDownPymnt.setName ("txtDownPymnt"); NOI18N
txtDownPymnt.addActionListener (new java.awt.event.ActionListener () {}
{} public void actionPerformed (java.awt.event.ActionEvent evt)
txtDownPymntActionPerformed (evt);
}
});

txtLoanLength.setName ("loanyrs"); NOI18N
txtLoanLength.addActionListener (new java.awt.event.ActionListener () {}
{} public void actionPerformed (java.awt.event.ActionEvent evt)
txtLoanLengthActionPerformed (evt);
}
});

btngrp_Credit.Add (badCredit);
badCredit.setText ("bad credit (12%) ») ;
badCredit.addMouseListener (new java.awt.event.MouseAdapter () {}
{} public void mouseClicked (java.awt.event.MouseEvent evt)
badCreditMouseClicked (evt);
}
});
badCredit.addActionListener (new java.awt.event.ActionListener () {}
{} public void actionPerformed (java.awt.event.ActionEvent evt)
badCreditActionPerformed (evt);
}
});

btngrp_Credit.Add (avgCredit);
avgCredit.setText ("average credit (10%) ») ;
avgCredit.addMouseListener (new java.awt.event.MouseAdapter () {}
{} public void mouseClicked (java.awt.event.MouseEvent evt)
avgCreditMouseClicked (evt);
}
});

btngrp_Credit.Add (greatCredit);
greatCredit.setText ("in the spotlight (5%) ») ;
greatCredit.addMouseListener (new java.awt.event.MouseAdapter () {}
{} public void mouseClicked (java.awt.event.MouseEvent evt)
greatCreditMouseClicked (evt);
}
});

txtPayment.setName ("payment"); NOI18N

Calculate.setText ("Calculate");
Calculate.addMouseListener (new java.awt.event.MouseAdapter () {}
{} public void mouseClicked (java.awt.event.MouseEvent evt)
CalculateMouseClicked (evt);
}
});

btnClear.setText ("clear form");
btnClear.addMouseListener (new java.awt.event.MouseAdapter () {}
{} public void mouseClicked (java.awt.event.MouseEvent evt)
btnClearMouseClicked (evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout (jPanel1);
jPanel1.setLayout (jPanel1Layout);
() jPanel1Layout.setHorizontalGroup
jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (jPanel1Layout.createSequentialGroup)
.addGap (10, 10, 10)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addComponent (avgCredit)
.addComponent (badCredit)
.addComponent (greatCredit))
.addGap (41, 41, 41))
.addGroup (jPanel1Layout.createSequentialGroup)
. addContainerGap()
.addComponent (Calculate)
.addGap (17, 17, 17)
.addComponent (txtPayment, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
.addGroup (jPanel1Layout.createSequentialGroup)
. addContainerGap()
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent (jLabel3)
.addComponent (jLabel4)
.addComponent (jLabel2))
.addComponent (jLabel1))
.addGap (18, 18, 18)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent (txtVehiclePrice, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE, 74)
.addComponent (txtLoanLength, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE, 74)
.addComponent (txtDownPymnt, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE, 74)
.addComponent (btnClear))
.addGap (11, 11, 11))
);

jPanel1Layout.linkSize (javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component [] {txtDownPymnt, txtLoanLength, txtVehiclePrice});

() jPanel1Layout.setVerticalGroup
jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (jPanel1Layout.createSequentialGroup)
. addContainerGap()
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (btnClear)
.addComponent (jLabel1))
.addGap (13, 13, 13)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (jLabel2)
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, txtVehiclePrice, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap (11, 11, 11)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, txtDownPymnt, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (jLabel3))
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, txtLoanLength, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent (jLabel4, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent (badCredit)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent (avgCredit)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent (greatCredit)
.addPreferredGap (javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup (jPanel1Layout.createParallelGroup (javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, txtPayment, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent (Calculate))
(. addContainerGap())
);

txtVehiclePrice.getAccessibleContext () .setAccessibleName ("price");
txtVehiclePrice.getAccessibleContext () .setAccessibleDescription ("purchase price");
txtDownPymnt.getAccessibleContext () .setAccessibleName ("down");
txtDownPymnt.getAccessibleContext () .setAccessibleDescription ("down_pymnt");
txtLoanLength.getAccessibleContext () .setAccessibleName ("loanyrs");
txtLoanLength.getAccessibleContext () .setAccessibleDescription ("years_of_loan");
txtPayment.getAccessibleContext () .setAccessibleName ("payment");
txtPayment.getAccessibleContext () .setAccessibleDescription ("payment_amount");

layout = new javax.swing.GroupLayout javax.swing.GroupLayout (getContentPane ());
getContentPane () .setLayout (layout);
() layout.setHorizontalGroup
layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup)
. addContainerGap()
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap (javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
() layout.setVerticalGroup
layout.createParallelGroup (javax.swing.GroupLayout.Alignment.LEADING)
.addGroup (layout.createSequentialGroup)
. addContainerGap()
.addComponent (javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap (16, Short.MAX_VALUE))
);

Pack();
} / / < / Publisher-fold > //GEN-END:initComponents

private void txtVehiclePriceActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtVehiclePriceActionPerformed
price = Double.parseDouble (txtVehiclePrice.getText ());
} //GEN-LAST:event_txtVehiclePriceActionPerformed

private void badCreditActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_badCreditActionPerformed
interest =. 12;
} //GEN-LAST:event_badCreditActionPerformed

private void CalculateMouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CalculateMouseClicked
Payment =(Price-PDown) /(Term*12);
intPymt =(payment*interest);
monthPymnt = Double.toString (intPymt);
txtPayment.setText (monthPymnt);
} //GEN-LAST:event_CalculateMouseClicked

private void avgCreditMouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_avgCreditMouseClicked
interest =. 10;
} //GEN-LAST:event_avgCreditMouseClicked

private void greatCreditMouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_greatCreditMouseClicked
interest =. 05;
} //GEN-LAST:event_greatCreditMouseClicked

private void badCreditMouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_badCreditMouseClicked
interest =. 12;
} //GEN-LAST:event_badCreditMouseClicked

private void txtDownPymntActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDownPymntActionPerformed
PDown = Double.parseDouble (txtDownPymnt.getText ());
} //GEN-LAST:event_txtDownPymntActionPerformed

private void txtLoanLengthActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtLoanLengthActionPerformed
expression = Double.parseDouble (txtLoanLength.getText ());
} //GEN-LAST:event_txtLoanLengthActionPerformed

private void btnClearMouseClicked (java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnClearMouseClicked
txtVehiclePrice.setText("");
txtDownPymnt.setText("");
txtLoanLength.setText("");
txtPayment.setText("");
btngrp_Credit.ClearSelection ();
} //GEN-LAST:event_btnClearMouseClicked

/**
@param args command-line arguments
*/
Public Shared Sub main (String [] args) {}
java.awt.EventQueue.invokeLater (new Runnable() {}
public void run() {}
new LoanCalculaterUI () .setVisible (true);
}
});
}

Declaration of variables - do not modify / / GEN-BEGIN: variables
private javax.swing.JButton calculating;
javax.swing.JRadioButton private avgCredit;
private javax.swing.JRadioButton badCredit;
private javax.swing.JButton btnClear;
private javax.swing.ButtonGroup btngrp_Credit;
javax.swing.JRadioButton private greatCredit;
private javax.swing.JLabel jLabel1.
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField txtDownPymnt;
private javax.swing.JTextField txtLoanLength;
private javax.swing.JTextField txtPayment;
private javax.swing.JTextField txtVehiclePrice;
End of variables declaration / / GEN-END: variables
Private double payment;
intPymt double private;
interest double private;
double private;
pdown double private;
double private term;
private String monthPymnt;
}
< code >

Your term variable in this method:

private void CalculateMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CalculateMouseClicked
payment=(price-pdown)/(term*12);
intPymt=(payment*interest);
monthPymnt=Double.toString(intPymt);
txtPayment.setText(monthPymnt);

is always 0.0, so there's a division by 0 error.

Check where you got that figure from.

Tags: Java

Similar Questions

  • Vi return NaN mode

    I use the function to calculate the value of a table mode and it returns NaN. Help of LabVIEW says that she only returns NaN at the entry of the array is empty. I don't know why this is happening. My table is

    0,00015

    0.000114

    0.000146

    0.000188

    0.000139

    I tried with value mulitple of intervals.

    Thanks in advance.

    In this case, NaN means that no method has been found.  Look at it this way... you have a group of numbers and say to LabVIEW for break in 1000 separate "bins." If each tray has only 1 value in it, then there is no mode - no value that appears more often than other values.

    For all of your data, any number of intervals of < =="" 14="" will="" return="" a="" mode.=""  any=""> 15 returns NaN.

  • FFT returns NaN, no error

    I am trying to trace the FFT of a certain number of waveforms, but I find that for some outputs simply return an array of "NaN" instead of the scale, with no indicated error. Looking at the data I see no significant difference that could cause this. anyone can shed light on the problem?

    I watched the formula apparently used by the FFT vi in aid detailed and created my own version, and he experiences the same problem with the same sets of data. Fathom what happens, it seems to descend to labview randomly taking one of my input data values and its reading like "NaN" - a bad size and TFF any fate of NaN. Why is reading that entry as NaN but is a mystery, and yet he does it regularly because the same plots always failed.

    I have attached the relevant vi to look, any help would be appreciated.

    You were asked to see if the data included NaN and you do not. The last element of the third data series is NaN. I haven't checked the other tables because it is something you need to do.

  • Deviation and variance and correlation are return NaN results

    I'm new to statistics with Labview, and I am changing the example of statistics in Labview by reading a column in a table to csv and then doing the analysis of statistics data. I tried to make it work, but when I run it, I get results NaN for the standard deviation, correlation, Kendall correlation of Spearman and no results for the Covariance.

    Can someone please help me solve this VI?

    Thank you.

    I just corrected the error. The problem is in the input array.

  • Anova 1 d return NaN values

    I have this vi, in which I want to use an anova 1 d, but I always get NaN values. I tried the example here: http://forums.ni.com/t5/LabVIEW/1D-ANOVA/td-p/702716/page/2, but I still can't make it work.

    Can someone help me please?

    Thank you.

    The table connected to the entrance of the ANOVA.vi D 1 index contains only zeros. Your case statement strange within the structure of the event, which always adds 1-1 regardless of the value of i is a specific candidate for the thread code Rube Goldberg.

    You have a lot of duplicated code, fan, hard to follow the wires twisted, and records the unused shift.

    Do not use the button abandon to stop your VI. Place a Stop boolean on the front panel and it wire end of the Terminal loop. It is not considered polite to postal code with infinite loops.

    Lynn

  • Aware of the direction of small Quiz return NaN results

    I am trying to use knowledge management to build a quiz for 3 different tracks that people can choose. My real file does not work, so I created a small example, and it does not either. Here's a screenshot of the branching view to give a sense of the flow:

    BranchingView.jpg

    When I hit the quiz for the 1 branch, I answer them correctly and show the results of the quiz:

    BranchingViewresults.jpg

    As far as I can tell, it is the same for all three branches.

    Feel free to download the file and tell me where I'm wrong. This is just my first time, so I don't know there is something that I forgot...  You can find the file here: http://www.theharagans.com/captivate7/BranchingQuizTest.cptx

    Thanks in advance!

    UPDATE with a REAL SOLUTION!

    Well, my intention to have a branching quiz was to have a student take 1, some or all the (their choice) a module in multiple ways, with each track having its own quiz. My default is native in that I had the action on the last slide of quiz for each branch to go to the quiz results slide, however, if the action on the last slide of questionnaire for a branch must return to the point at which a student chooses which module they want, the quiz is not break.

    What I ended up doing was creating a button on the "menu" slide that takes the student results of the quiz. This HAS to be the last action, the student takes before they are done with the module. If the module somehow return lines ONCE the results of the quiz are displayed, the quiz to break.

    So the branching view now looks like this, and it works for several tracks taking in the iteration of the training.

  • NaN is returned instead of text

    OK, I give up on it now, I hope someone can help!

    I can't understand why this returns NaN for the loop, instead of the string (a stripped of a full path to the file, file name could be text figures, dashes, etc.)

    Panel1 var = buttongroup.add ('group', undefined, 'File Name')

    Panel1. Add ("statictext {text: linkFileNameShort, characters: 0, justify:"droit"}");} ")

    But this code will return fine

    Panel1 var = buttongroup.add ('group', undefined, 'File Name')

    Panel1. Add ("statictext', [0,0,200, textheight, linkFileNameShort");

    Unfortunately I need to right justify!

    Hello

    Try this...

    panel1.add ('statictext {text:"' + linkFileNameShort + '", characters: 0, justify: "right"}');
    

    Concerning

  • getting NaN for a value returned by a function

    Hello, I am writing for the reason given above. I'm trying to get two values of a function gives me the hypotnuse of a triangle, like this:

    var hyp1:Number = getHypotenuseLength(theRotation,a);

    var hyp2:Number = getHypotenuseLength ((90-theRotation), b);

    Here's the function:

    public void getHypotenuseLength(theRotation:Number,_segment:Number):Number {}

    var radians = deg2rad (theRotation);

    Return segment/Math.cos (radians);

    }

    values, the 'theRotation', 'a' and 'b', all referred to a certain number, but "hype1" and "hype2" return NaN. If anyone has an idea why please let me know. The function is correct I would say.

    You must use the function trace to see what values are being processed in the getHypotenuseLength function.

  • Why does the period display NaN? What does it mean "NaN"?

    I have a vi that is supposed to measure values of period 3 and 2 tension using DAQmx.  The vi is attached.

    When I run the vi, I get no error, but one of the counters display NaN instead of a period (in seconds) value.  Why would this counter not appearing?  See the .jpg image of the screenshot, which shows the lights on the front panel, after execution and stop the vi.  Note that the period 2 shows "NaN" but, period 1 and 3 show a real value.  "NaN" only displays in "period 2" executing too. ' " "Period 2" never displays a numeric value.  Moreover, as "NaN" actually mean?

    Appreciate your thoughts.

    Thank you

    Dave

    (using 3 counters in the cDAQ-9174 and the module OR 9401 plugged into the chassis cDAQ; periods are measured from the encoders)

    NaN means not 'a number '.

    In your code, Mean.vi will return NaN (with the error-20003) if the input array is empty.

    What happens if you connect the signal of the 1 meter or 3 to counter 2? If NaN disappears, then there is a problem with the signal currently connected to the meter 2.

    1. Your current code, using usrs to (unitialized shift registers), will produce NaN when running for the first time.

    2. The size of the usrs to will increment at each iteration.

    3. If your VI is used as a Subvi, the means will be bad for the first 15 iterations since they will be calculated with the values of the usrs to--> previous lengths.

    You must use PtByPt.vi means that will calculate the average of the X last values without above mentioned problems.

  • Gauss hypergeometric function does not return a value

    I need evaluate the Gauss hypergeometric function (mathematics > elementary > hypergeometric functions > Function.vi Gauss) for one of the following constants:

    a = 11/6

    b = 1/6

    c = 5/6

    for different values of x, all of which are negative.  A value of x is - 4.  When I run a VI with this function, it returns NAN.  I don't know what is current as the help file says the function is set to leave Neg. infinite to 1.  A condition is placed above being defined more precisely to 1 which I'm not interested.

    We used a script MATLAB Labview node to calculate these values successfully.  I know that some other programs can only calculate the function for | x |< 1,="" but="" the="" help="" file="" in="" labview="" claims="" it="" doesn't="" have="" this="" limitation="" as="" is="" the="" case="" with="" matlab.=""  can="" anyone="" else="" confirms="" this="" problem="" or="" am="" i="" just="" overlooking="">

    Also, it would be useful to check with Mathematica to verify that I did stupid miscalculation...

    Third time is a charm.

  • Simulink Inport/Outport data types

    I searched for a while and I am unable to find documentation about what types of data I need to use the inports, outport, settings and in my Simulink models.

    Is there some specific types of data that are, or are not supported?  How VeriStand to determine how to coerce data to send the model?  Also, I was under heard VeriStand uses doubles for everything but then I saw a post that says he uses of I64.

    Any clarification would be much appreciated.

    VeriStand 2013 SP1 (probably upgraded to 2016 in next year if it's relevant)

    MATLAB 2010 b and MATLAB 2012 b (currently)

    > Are there types of specific data that are, or are not supported?

    I don't remember there being any limitation of types beyond what is stated in the considerations help document.

    Considerations relating to the integration of The MathWorks, Inc. Simulink® software models (model Interface T...

    The big hiccup I remember wasn't mainly with types of configurations and data bus.

    IIRC, you can choose any numeric type desired in Simulink. The structure of the model interface that uses VeriStand will handle any type and convert it to double so that it can be consumed by the VeriStand engine.

    > How VeriStand to determine how to coerce data to send the model?

    I think the way it works is that when VeriStand interacts with the Simulink model, it gets a list and information (pointer, data type) of inports, remote villages and settings. Thus, it can capture data from the model (because it has the pointer), and it can cast its data type (because he knows the type) duplicate. If you look at the example model model interface on line 212 it might help to make things more clear on how this could work.

    C:\VeriStand\2016\ModelInterface\custom\examples\template.c

    Double USER_GetValueByDataType (void * ptr, int32_t subindex, int32_t type)
    {
    switch (type)
    {
    case 0:
    {
    / * double * /.
    (double) return (((double *) ptr) [subindex]);
    }
    case 1:
    {
    / * only * /.
    (double) return (((float *) ptr) [subindex]);
    }
    }

    / * return NaN, ok for vxworks and pharlap * /.
    uint32_t nan [2] = {0xFFFFFFFF, 0xFFFFFFFF};
    return *(double*) nan;
    }

    I'm guessing that the full implementation of which uses VeriStand is much more complex, but I think that the idea is the same.

    > Also, I was under heard VeriStand uses doubles for everything but then I saw a post that says he uses of I64.

    VeriStand engine uses indeed of all double rooms.

    You happen to remember this post and you can share the link? I'd be curious to see where this is said and in what context.

  • CVI division by zero defects

    Hello

    I use NI LabWindows CVI 2012.

    I have a piece very simple code:

    Double a = 4/0;

    This piece of code, I would like to return NaN, or at least do something that isn't to stop the execution on the compilation.  "Is there a way to turn NaN handling functionality or add an exception for the compiler that said: if division by zero is found, returns zero" or something?

    Here, any help would be greatly appreciated

    Hello

    It's probably doing an entire division and then by converting the result in duplicate.  Division by zero with an integer will crash your application.  I would try this:

    Double a = 4.0/0,0;

    If adding le.0 in the end tells the compiler that it is a floating point type, where division by zero is not as bad.  Moreover,.

    Double;

    a = NotANumber ();

    Can also do what you want.  If you want to check for NaN you can do something like this:

    If (IsNotANumber (a))

    a = 0.0;

  • Error ESTK "cannot assign a value.

    Dear friends, started a new project - and of course the new problems:.

    The SumOf (list of values) function works perfectly,

    but an equivalent of the function VsumOf (list of variables) stops at line 16 in the first iteration of the loop: cannot assign a value.

    At this point, the result variable is just - 132.09 - out sort of a numerical problem.

    var z = SumOf (11.1, -11.9, 12345679.0, -12345679.0, 124.5, -17, 18.9, 2.2, 2.5, 2.5, 2.5, 31.31, 312345679, -312345679); 
    alert ("SumOf the numbers = " + z); // giving 166.610000014305  (figures after the 000 are artifacts)
    
    var z = VsumOf (11.1, -11.9, 12345679.0, -12345679.0, 124.5, -17, 18.9, 2.2, 2.5, 2.5, 2.5, 31.31, 312345679, -312345679); 
    alert ("VsumOf the numbers = " + z);
    
    function VsumOf (valuePairs) {
      var nArguments = arguments.length;
      var j, z, result = 0;
      if (Math.floor(nArguments/2) * 2 !== nArguments) {return undefined;}
      
      for (j = 0; j < nArguments; j=++2) {
        if (isNaN(arguments[j])) {return NaN;}        // should be skipped in calling environment
        if (isNaN(arguments[j+1])) {return NaN;}
        z = arguments[j] * arguments[j+1];
        result = result + z;                          // <<== Can not assign value ???
      }
      return result;
    }
    
    // this one works correctly
    function SumOf (values) {
      var nArguments = arguments.length;
      var j, result= 0;
      for (j = 0; j < nArguments; j++) {
        if (isNaN(arguments[j])) {return NaN;}        // should be skipped in calling environment
        result = result + arguments[j];
      }
      return result;
    }
    

    Any ideas what really does this error message mean?

    Hi Klaus,

    Just change your line 12 for

      for (j = 0; j< narguments;="" j="j+2)" {="">

    It should work.

  • How can I get a live streaming video timecode?

    Hi all!

    I have set up a live video feed that works very well.  Server-side, we use the Flash Media Live Encoder, Flash Media Server streaming.   On the server, we checked the box to add a 'Timecode' for video and set it to simply incorporate the time system.

    Client-side I have a SWF file using the FLVPlayback component.  I can't figure out how to get the value of time code on the client.  'totalTime' returns NaN and 'playheadTime' returns the number of seconds from the connected client.   I need to get the time system/temporal being incorporated on the server.

    Thank you!

    FYI - I was able to do using the NFB 'international' of the embedded NetStream object manager.

    myVideo.addEventListener (fl.video.VideoEvent.STATE_CHANGE, onVideoStateChange);

    function onVideoStateChange(evt:fl.video.VideoEvent)

    {

    trace ("Status =" + evt.state);

    If (evt.state == "play")

    {

    If (! ns)

    {

    NS = .netStream myVideo.getVideoPlayer (evt.vp);

    ns.client.onFI = onFIHandler;

    }

    }

    }

    function onFIHandler(infoObj:Object):void

    {

    var ts:String = infoObj.st;

    trace ("system time:" + ts);

    ExternalInterface.call("saveglobalscore",score) ("updateTimeStamp", ts);

    }

  • Totaltime reading FLV inconsistencies

    Problems with the FLVPlayback instance in AS2.  I use progressive download, and found inconsistencies with reading totatTime.  In flash player 11.9, it works fine, but in 10.3 that it returns not always causing problems in my reading.  If anyone has experienced this problem and know a workaround solution?

    It is well known that your video must have the totalTime in its metadata or totalTime returns NaN.

    the solution is to fix the metadata of the video or to assign a default value.

Maybe you are looking for