Divide By Zero Errors in Input
Fields
In some cases, you may enter an expression into an input field such as X/Y where at some point during the simulation, both X and Y are zero. In most instances, when GoldSim encounters zero in the denominator of an expression, it will display a fatal error and stop the simulation. However, if both the numerator and the denominator are zero, GoldSim will not display a fatal error; instead, the resulting expression will be set to zero and the simulation will continue. This can be very convenient, as it allows you to avoid adding complex logic to check for such cases.
Note, however, that GoldSim only sets the expression to zero if both the numerator and denominator are zero. To understand this, consider an example where A and C are equal to zero, and B is non-zero. In this case, the following two expressions would be treated differently by GoldSim:
- A*B/C: would return zero, as A*B would be evaluated first (and considered to be the numerator for C.
- A*(B/C) would result in a fatal error, as B/C would be evaluated first, and B is non-zero.
- Built-in Constants
- Built-in Functions
- Creating Conditional Expressions
- Creating Links Using the Link Cursor
- Deleting Links and Influences
- Displaying Link Suggestions in Input Fields
- Divide By Zero Errors in Input Fields
- Editing an Element's Name, Description and Appearance
- Editing an Element's Properties and Creating Links
- Entering and Editing Expressions in Input Fields
- Entering Mathematical Expressions into Element Input
- Error Checking in Input Fields
- Input Field Context Menu
- Input Field Tool-Tips
- Referencing Dates in Expressions
- Referencing Outputs of Other Elements (Creating Links)
- Specifying the Contents of an Input Field
- Understanding Locally Available Properties