… for integer types. It’s working and returning NaN for floats.
beta36_rc1 and also beta38.5
… for integer types. It’s working and returning NaN for floats.
beta36_rc1 and also beta38.5
Well throwing exception makes sense. you want to divide with 0 there. actually I wouldn’t call NaN the “working” state as that’s just sweeping the problem under the rug and causing mayhem somewhere else down the program. this also raises the side question: does vl has try-catch-finally region?
For Try-catch-finally you could import the ‘vl.core.experimental’ pack from the node browser and look for those regions. I’m not sure how heavily they’ve been road tested…
@bjoern, @microdee, Good points.
In the case of floats/doubles you may want to express that the number calculated is infinite or undefined, as you have this situation in mathematics/science. You would want to actually return this value in those circumstances because it isn’t an ‘exception’ as such, its a valid real number, just an extreme one.
In the case of integers they are not ‘real’ numbers so the ‘infinite’ and ‘undefined’ aren’t concepts handled by that data type.
try/catch is usable in vl
Ah, so it’s actually a feature not a bug. Changed the category accordingly.
after some more digging it is indeed the expected behavior. floating point numbers do not throw a DivisionByZero exception and just return NaN. integers do not have NaN and can only hold integers, so they throw an exception.
if that get’s into your casual way of patching too often, you could make your own little wrapper node with the behavior you want and use that instead.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.