The Dink Network

Reply to Re: Square Root

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 2nd 2004, 11:07 PM
wizardg.gif
Paul
Peasant He/Him United States
 
It doesn't work for me either. You could always use the brute force method if the numbers aren't too big:

int &testit;
int &answer = 0;
int &mynumber = 73; //whatever

loop: &answer += 1;
&testit = &answer;
&testit *= &testit;
if (&testit < &mynumber)
goto loop;
say("The answer, rounded up, is &answer", 1);

Or if you'd rather round down, start &answer at the highest value you anticipate, use -= and test for > &mynumber. Obviously it will have to be rounded since the squere root of most numbers is a faction and Dink only does intigers.