Triangular number AND sum of first m factorials

01102018, 04:58 AM
Post: #8




RE: Triangular number AND sum of first m factorials
(01102018 04:03 AM)Gerson W. Barbosa Wrote: ISPF? (IsPerfectSquare?) has yet to be implemented. It should return 1 when the argument is a perfect square and 0 otherwise. The HP 50g LongFloat library contains a function like the one you're looking for. It's called ZSqrt, and it returns IP(sqrt(x)) to level 2, and a 0 or 1 to level 1, with 1 meaning that x was a perfect square. It works on integers of any length. Gerald H also posted a program HERE which seems to do essentially the same thing. It returns IP(sqrt(x)) to level 2 of the stack, and on level 1 it leaves a SysRPL TRUE if x was a perfect square, otherwise a FALSE. That's the same idea as HP's FPTR2 ^ZSQRT, but Gerald's program is more accurate; see Gerald's posting for evidence of HP's function's inaccuracy. BTW, LongFloat's ZSqrt function gets the same result as Gerald's program when given the example in Gerald's posting, so I surmise that ZSqrt is trustworthy. <0ΙΈ0> Joe 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)