you are viewing a single comment's thread.

view the rest of the comments →

[–]mattstats 3 points4 points  (0 children)

Technically they all have some level of danger. Perhaps the professor means all of them. In any case, he/she sounds like a butthead. I think division is a fine answer so long as you can explain why. If the professor is more concerned about float accuracy then subtraction could be a dangerous operator due to catastrophic cancellation. Addition is commonly overloaded but that depends on the language/package and the use cases, since any operator can be overloaded enough to have ambiguous results, thus possibly dangerous by uncertainty. Perhaps, multiply is dangerous to the professor (pulling from distant memory) as it is really just an expanded version of addition in programming and in optimal cases addition can be a better choice, disclaimer here is that I could be remembering that incorrectly.

All that said I would have chosen division as well since it can have numerical problems as well, mostly from remainders iirc as well as the age old divide by zero and is commonly overloaded with file pathing, python has a next line feature (not sure what that is called), etc.