MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

IsIntegerOrFloat

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87011] IsIntegerOrFloat
  • From: carlos at Colorado.EDU
  • Date: Sat, 29 Mar 2008 04:21:33 -0500 (EST)

Thanks to all who replied to my previous questions. Those functions work
fine now. Here is another question - I apologize if it has been asked before.
I need a function

                 IsIntegerOrFloat[expr]

that returns True if expr, which is generally a flat list, contains
only integers or floating point numbers, and False otherwise.
Rational numbers such as 1/2 are considered symbolic for this test; so is
\[Pi] or Sqrt[5]. Appearance of any symbol, as in 2.0*a+3.5, makes it False.
As in previous questions, this should work on versions >=4.0.

Use: unified printing of simulation data structures in table formats.
Expressions containing only integers or floats are filtered through
PaddedForm[] and ToString[], others through Symbol[].  The end
result (a flat table of strings) is filtered through TableForm with
appropriate options.


  • Prev by Date: Re: Collect coefficients of array variables during calculation:
  • Next by Date: Re: symbolic evaluation
  • Previous by thread: Re: Re: Mathematica notebooks the best method
  • Next by thread: Re: IsIntegerOrFloat