HP PRIME not raising overflow/underflow may cause critical errors
|
03-20-2021, 01:24 AM
Post: #10
|
|||
|
|||
RE: HP PRIME not raising overflow/underflow may cause critical errors
A simple textbook example: combinations, aka. nCr binomial coefficients:
Define nCr X!/Y!*(X-Y)! Now, this is NOT the most efficient way to compute nCr, but let's put that aside for now (I will comment on that later). We are just defining a classic textbook version of nCr, because we just want to try and apply a function we learned about in a textbook. Sadly, without exceptions being raised, we get garbage: nCr(270,1) 1 At least an error message would have told us that we better not use this function for large n producing problematic results with low accuracy and overflow. I am not being facetious. This can be critical. I am aware that most people will not write nCr this way, since we know it is not the most efficient way to compute nCr. The built-in COMB works fine, for example. We can also write some HPPL code to compute nCr the right way. The problem is that user-defined functions and HPPL code cannot be trusted when exceptions aren't raised when you expect them. - Rob "I count on old friends" -- HP 71B,Prime|Ti VOY200,Nspire CXII CAS|Casio fx-CG50...|Sharp PC-G850,E500,2500,1500,14xx,13xx,12xx... |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)