Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2008

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

Search the Archive

Re: IsIntegerOrFloat

  • To: mathgroup at
  • Subject: [mg87089] Re: IsIntegerOrFloat
  • From: carlos at Colorado.EDU
  • Date: Mon, 31 Mar 2008 02:06:16 -0500 (EST)
  • References: <> <fsnbfs$dcg$>

Thanks to all who replied.  I have collected here 4 solutions
for comparison,

  True,False]];  (* Peter Breitfeld *)

   (* Szabolcs Horvat *)

              {False}->False/.{}->True;  (* Jean-Marc Gulliet *)

              (Head[#]=!=Complex)&];  (* Andrzej Kozlowski *)

(* Albert Retey's submission not tested since it wasnt
   wrapped as function *)

A timing test on a random-float list of 10^6 items gives
(version 5.2 on MacBook Pro laptop running Mac OS X 10.4.11,
dual 2.3GHz Intel processors)

  IIOF1      0.396629 Second
  IIOF2      2.47186 Second
  IIOF3      2.81298 Second
  II0F4      2.9122 Second

I have no idea why IIOF1 is about 6 times faster than the others.

  • Prev by Date: Re: conversion of sin to cos
  • Next by Date: Re: Fast way to select those elements from a list that are in another
  • Previous by thread: Re: IsIntegerOrFloat
  • Next by thread: Re: IsIntegerOrFloat