-nan(ind) error as output from the MySqL Database.

  1. 6 months ago

    I am trying to calculate the output value for set of equations saved in the database by giving the input via xojo in the front end. I am able to connect the database successfully. I am able to get the output for few equations. Few lengthy equations are giving -nan(ind) as outputs. I need to find out why this happens and need solution how to solve it.
    I am new to Xojo.
    Kindly help me in this regard.
    Thanks in advance.

  2. Greg O

    25 Nov 2018 Xojo Inc
    Edited 6 months ago

    Nan means Not A Number. Typically this means that you are attempting a numerical operation on a non-numerical field.

    Did it maybe say?

    Nan(inf)

    That would mean that something in your equation becomes Infinite (like a division by zero error) and that “inf” is not a number.

    It could also mean that the value is too big or too small to be represented by the field type.

  3. Edited 6 months ago

    Thanks for your reply.

    i am using some variable in the equation AS STRING. After substituting the variable with numeric values the length of the equation is is about 42,000 character. For equations of such length am getting an output as nan(ind)
    But after substituting the variable with numeric values and for the length of the equation which is around 8,000 characters, i am able to get the exact output.

    I understand the value is too big to be represented by the field type could be a reason.
    Can u kindly suggest me how to sort this problem or what field type should i use to solve it?

    i am just copying a sample part of the eqn.

    Eqn output =((2.727*((2.762+4.792*(sqrt((0.086*((0.0-((1.0*input+ ... *Ttim-0)/15)+0.0)/0.999))^2))+1)))/1)-2.896)/1.0)

  4. Greg O

    25 Nov 2018 Xojo Inc

    Without knowing more about the equation, I doubt it... but have you tried using XojoScript? There you could programmatically create the script (a bunch of Dim statements for each of the variables and one more for the equation itself) and run it to get a result.

  5. Robert W

    25 Nov 2018 Western Canada

    Possibly dividing by zero, or taking the square root of a negative number?

  6. @Grey O'Lone

    Yes.. i have scripted the equation in Xojo and got the result. Since i have bunch of such equations, i am forced to use MysQL database.

    But, can u suggest me what could be the field type that we should use to solve such equations with around 70,000 character in the a field in the database.

    Well, thanks in Advance.

  7. Greg O

    26 Nov 2018 Xojo Inc

    @Weki G But, can u suggest me what could be the field type that we should use to solve such equations with around 70,000 character in the a field in the database.

    I can’t say that I’ve ever tried to store 70K in a database field. If you don’t need to search on that field, you might consider compressing the equations.

    @Weki G Yes.. i have scripted the equation in Xojo and got the result. Since i have bunch of such equations, i am forced to use MysQL database.

    Right. Store the equations in the database, do the calculations in Xojo. That’s what I meant.

or Sign Up to reply!