[pstricks] Testing a number
John Smith
chessfan123 at hotmail.com
Wed Jun 18 09:19:21 CEST 2008
Herbert> Date: Wed, 18 Jun 2008 08:47:23 +0200> From: Herbert.Voss at FU-Berlin.DE> To: pstricks at tug.org> Subject: Re: [pstricks] Testing a number> > John Smith schrieb:> > Is there a way to test is a number is zero, positive or negative? I tried this using the FP package as follows.> > > > \def\test#1{\FPifzero{#1} 0 \else \FPifpos{#1} 1 \else -1 \fi \fi}> > > > It works if the number is positive or negative but gives a Tex error about an extra \fi if the input is zero.> > giv an example in which case do you need such a test. I want the macro to return numbers as follows. \test{0} -> 0\test{1.234} -> 1\test{-1.234} -> -1 I need to know the sign of the number because it influences whether I draw a vector (if number is not equal to zero) and in which direction it points. Thanks.
_________________________________________________________________
Never miss another e-mail with Hotmail on your mobile.
http://www.livelife.ninemsn.com.au/article.aspx?id=343869
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20080618/32e0cac1/attachment.html
More information about the PSTricks
mailing list