You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The divide function has a test for when the denominator is zero, but it is returning zero it the test is true. This is wrong, it should be expected to return an error or infinity. To avoid crashes, the function could return the maximum value for a double (double.MaxValue). This is a much more sensible value than returning zero...
What Operating System are you on?
Windows
The text was updated successfully, but these errors were encountered:
This was actually done by design to stop NaN and infinity values from cascading through apsim models which is both very hard to track down, and is normally the result of using or storing a value before it is ready to be calculated. With the DivideFunction model in particular, it's difficult to handle if the values it is acting on have been modified yet, and the default for most values is going to be a 0.
For example, if you are using DivideFunction to produce a percentage based on the leaf area for example, it needs to still be able to produce a sensible number when there are no leaves, which we found is normally a 0.
If you have a specific us case where when the denominator is 0 and the value it returns should be something other than 0, then you'd need to think about wrapping the model in further checks for handling it.
What happened?
The divide function has a test for when the denominator is zero, but it is returning zero it the test is true. This is wrong, it should be expected to return an error or infinity. To avoid crashes, the function could return the maximum value for a double (
double.MaxValue
). This is a much more sensible value than returning zero...What Operating System are you on?
Windows
The text was updated successfully, but these errors were encountered: