LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Div by Zero Error

    Employee
    Posted 03-23-2016 05:40

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Jagdev

    Hi Expert,

    I am facing the error while dividing zero value with the number. Like in excel we have option of Iferror to be used in such case. Is there any way to deal with this issue in lavastrom.

    Regards,
    Jagdev


  • 2.  RE: Div by Zero Error

    Employee
    Posted 03-24-2016 06:06

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: lnason

    Hi Jagdev - Try pasting the content below into a graph and running it. Let me know if that doesn't meet your needs.

    -------------------------------------------------------------------------------------------------------------------------

    node:Filter
    bretype:core::Filter
    editor:sortkey=56f3e7873a8311b6
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX

    result = if ('DENOMINATOR' == 0) then {int(null)} else {'NUMERATOR'/'DENOMINATOR'}


    emit *
    emit result as RESULT
    EOX
    editor:XY=480,100
    end:Filter

    node:Static_Data
    bretype:core::Static Data
    editor:sortkey=56f3e72a5704376e
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    NUMERATOR:int,DENOMINATOR:int
    10,5
    4,2
    5,0
    6,3
    EOX
    editor:XY=380,100
    end:Static_Data


  • 3.  RE: Div by Zero Error

    Employee
    Posted 03-29-2016 06:31

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Jagdev

    Fantastic explanation! Will try to add it in my live scenario.

    Thanks
    Jagdev


  • 4.  RE: Div by Zero Error

    Employee
    Posted 03-29-2016 07:07

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ryeh

    Another quick addition - if you're using doubles, you can use Inf and NaN as well. So something like:

    result = if ('DENOMINATOR' == 0) then {double("Inf")} else {'NUMERATOR'/'DENOMINATOR'}


  • 5.  RE: Div by Zero Error

    Employee
    Posted 03-30-2016 08:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: Jagdev

    Hi Ryeh,

    Thanks for your input. Even this looks fine.

    Regards,
    Jagdev