jackvoxel8.com Posted March 5, 2018 Share Posted March 5, 2018 I have some code that sets some P variables to the "magic value" of 0/0. Does anyone know what that means? Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted March 5, 2018 Share Posted March 5, 2018 Are you saying the IDE reports the value as 0/0 or your plc attempts to set the value to 0/0? In either case, I would expect the value to be reported as "nan". Link to comment Share on other sites More sharing options...
jackvoxel8.com Posted March 5, 2018 Author Share Posted March 5, 2018 I have a PLC that sets the value to 0/0 Link to comment Share on other sites More sharing options...
Eric Hotchkiss Posted March 5, 2018 Share Posted March 5, 2018 Well your variable should be set to nan (not a number). Conditional checks should make sense, nan is never going to evaluate equal a number. Feel free to test any condition you're worried about. There is also a isnan() function. See page 1395 of the October 2017 SRM for more details, but it just returns 0 for real numbers and 1 for nan. Almost forgot to add, put this in the terminal to see that 0/0 evaluates to nan: p0=0/0 p0 Link to comment Share on other sites More sharing options...
jackvoxel8.com Posted March 5, 2018 Author Share Posted March 5, 2018 Thanks Eric, pointing me to the isnan() function was helpful. Link to comment Share on other sites More sharing options...
Recommended Posts