Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

question

jbarrio
2018-01-11
2018-01-15
  • jbarrio - 2018-01-11

    hello:
    Is there any way that if a calculation gives me infinite as a result, it returns a 0?

    I tried something like

    and try that instead of infinity I get 0 with
    IF out := "Infinity" THEN
    out := 0
    END_IF

    but logically recognizes it as a string and it does not work, is there a way to do what I want?

    best regards

    IMG: Captura.PNG

     
  • josepmariarams - 2018-01-13

    Hi.

    I think that in oscat there are a function which test if an real is infinite.

    If not, search in wikipedia how an float number is bit coded. After read the float as ulint, there are a bit which mark the number as infinite.

     
  • jbarrio - 2018-01-15

    thankss

    CHK_REAL in oscat.basic

     

Log in to post a comment.