forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Is there a better way to READ if ODD or EVEN numbers exists?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Feb 26, 2006 7:25 am    Post subject: Is there a better way to READ if ODD or EVEN numbers exists? Reply with quote

Is there a better way to READ if ODD or EVEN numbers exists?

Heres how I do it, but there must be a less complex way out there.
I just thought if someone else has this worked out allready it would save me time re-inventing the ODD EVEN wheel Rolling Eyes
Code:
%%counter = 0
REPEAT 
%%counter = @succ(%%counter)
%%divide = @format(@fdiv(%%counter,2),100.1)
%%total = @fmul(%%divide,2),%%multiply)
%%multiply = @fmul(%%divide,2)
%%check_fraction =  @SUBSTR(%%divide,3,3)
IF @EQUAL(%%check_fraction,0)
INFO EVEN whole number if the fraction part of the counter number is zero  %%total"."%%check_fraction
END
UNTIL @equal(%%counter,7)


Thanks in advance...
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sun Feb 26, 2006 8:45 am    Post subject: Reply with quote

there is an easier way ... i knew that my years at uni would one day pay off

Code:
%i = 0
repeat
   if @zero(@mod(%i,2))
      warn %i is even
   else
      warn %i is odd
   end
   %i = @succ(%i)
until @equal(%i,10)


serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Fri Mar 03, 2006 10:58 am    Post subject: Reply with quote

yes,

that helped me tremendously Very Happy even works on multiplication.

I should have noticeed that function, but its been too long since my algebra and geometry old skool days.
Thanks a @FABS(1,000,000,000.321) ( I didnt notice that either) Laughing

Good thing we have you here Wink

Hey I been trying to get a math formula that I can write on paper and take up on a roof for example, in case you dont have a calc handy say.

Heres all I have, but as you can see it requires a calc for the SQ ROOT.

I bet you know another formula that could get the diagonal by using the known sides a and b without requiring a calc. ( I lost the formula I had)

Pythagorean Theorem (I know the a and b - just want the diagonal)
Oh, and it would need to be for rectangles only (not a square).
a^2+b^2=c^2
lets try EXAMPLE: 4 x 3 = c^2
SQ root is a lot of Newtonizing estimating type divisional formula... Mad

Thanks again I mean Serge...
Back to top
View user's profile Send private message Visit poster's website
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Sat Mar 04, 2006 1:36 am    Post subject: Reply with quote

you are welcome ... this was an easy question for me Smile

i am not sure what you are asking ... are you after a formula to find the diagonal using pythagoras but without having to use a calculator because of the square root?

if so, i am not aware of any other formula except for an approximation formula that you can use for squares ... the formula has many terms and depending on the accuracy you want, you may only need to use the first 2 terms of the formula, it is a series actually ... i don't remember it off hand but i may be able to look it up if you need it

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Tue Mar 07, 2006 9:03 am    Post subject: Reply with quote

Yeah, that was what I meant, and I allready looked it up before this post, so thanks for confirming what I was thinking, I found that I used to used a fixed number in the place of the PWR number, so I guess i was just spitten words to see where they would splatter Laughing

but thanks again, problem solved... twas a fun mathmatical interaction Very Happy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group