2 ms·
It's weird that most of the code is in the header files.. also do you check for divide by zero? Try to rewrite the whole thing as a single recursive function w
by jhallenworld 11y ago
It's weird that most of the code is in the header files.. also do you check for divide by zero?
Try to rewrite the whole thing as a single recursive function with two arguments (rest of input string, precedence of left side). You could use longjmp/setjmp to abort when there are errors.
- vivekkannan 11y agoI checked division by zero initially, but then realised that 1/0 causes double to represent inf. Thought that this could be useful(?) in some situations. For example, atan(1/0) --> 1.57... instead of error.
- jhallenworld 11y agoI was thinking to catch errors which could crash the program. Actually you should install a signal handler for SIGFPE to take care of this.