MathGroup Archive 2012

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

Search the Archive

Putting a Test or Condition on the Right-Hand Side of a Function


Hello everyone,

I have a simple function that displays the integer part of a real number if the fraction part is less than a millionth.

	dropDecimal[x_] := If[FractionalPart[x] < .000001, IntegerPart[x], x]

In trying to learn more about functional programming, I was wondering whether there is a way to put the condition or test on the right-hand side of the 
function.

Gregory



  • Prev by Date: Re: Can anyone see a faster way to compute quantities for a pair or
  • Next by Date: Re: Contour plot labels with higher precision
  • Previous by thread: how to jump from one cell to the other using the keyboard?
  • Next by thread: Re: Putting a Test or Condition on the Right-Hand Side of a Function