Testing UserRPL arguments for numerosity?


I am writing a package of routines to do both algebra and numeric calculations using the generalized hypergeometric function.

If all incoming parameters are numeric, or can be evaluated to numeric, then for some ranges of the parameters, I can return a numeric result.

However, if a parameter is a symbolic, and cannot be evaluated to a numeric result (like an undefined global name, etc.) then I can't return a numeric result, (but I may be able to return a simplified symbolic result).

Here comes the question: What's the best way to validate/evaluate/check/test incoming parameters for "numerosity"? That is, what's the best way to test a parameter to see if it can be resolved to a numeric value?

Is there any kind of built in UserRPL function (or even a SYSEVAL) that does this kind of thing?

Right now I have a long CASE statement that checks various TYPE values, and returns true/false. That works ok, but it's not very fast.

Complications come in because an algebraic expression may be evaluable down to a numeric result, and I would like to handle that case correctly too.

Global names may have a numeric value; need to handle that too. Perhaps a global name refers to another global name, that refers to another global name, that refers to a numeric or an evaluable algebraic; that should count as a numeric parameter too.

Would it be better just to attempt to do an EVAL and/or a ->NUM against a parameter (guarded with IFERR) and see if that results in a numeric? Would that be definitive?

Thanks for any suggestions!


what goes wrong if you just eval it? is it the error trapping?


Actually I have something that works for all the cases I have tried. It ended up being a very long IF test, with some recursive calls to itself.

I also use IFERR extensively to catch errors during EVAL & ->NUM; if an error occurs, I just return a false result (treat it as non-numeric).

So, I do have it working, but it's slow, looks a bit inelegant, and I worry about obscure or rare combinations that could slip through the cracks. I just keep using it in my code; that will be the only way to thouroughly test it.

I looked in the SysRPL manuals, but didn't see anything quickly that looked what I wanted.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Prime]Passing lists as arguments Andy Gryc 2 435 11-18-2013, 10:16 PM
Last Post: Andy Gryc
  does WAIT command in userRPL do a busy wait? Pier Aiello 10 926 05-15-2013, 08:09 AM
Last Post: Pier Aiello
  Testing card reader motor for 65 Michae Altmann 2 517 03-17-2013, 09:24 PM
Last Post: Randy
  [WP 34S] New GCC - Testing required Marcus von Cube, Germany 3 497 01-07-2013, 01:59 PM
Last Post: Marcus von Cube, Germany
  Testing the water Ken McPherson 0 225 08-07-2012, 09:18 PM
Last Post: Ken McPherson
  NCEES and Computer Based Testing Richard Garner 2 387 04-10-2012, 07:14 PM
Last Post: Steve Fennell
  UserRPL local variables not available to algebraics? John R. Graham 33 2,265 03-29-2012, 03:07 PM
Last Post: Gilles Carpentier
  WP 34S: Memory Allocation - New Document / Testing Marcus von Cube, Germany 0 244 11-09-2011, 11:48 AM
Last Post: Marcus von Cube, Germany
  Fully testing HP 41 Le Babou 7 609 10-23-2011, 08:59 AM
Last Post: Allen
  WP 34S: Some testing required Marcus von Cube, Germany 27 2,116 10-15-2011, 11:15 AM
Last Post: Marcus von Cube, Germany

Forum Jump: