Path: chuka.playstation.co.uk!news From: "Jon Prestidge (alias Moose)" Newsgroups: scee.yaroze.programming.codewarrior Subject: Re: "No FP... no comment" Date: 15 Aug 1997 16:33:40 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 31 Message-ID: <01bca99a$10782be0$b8567ec2@default> References: <01bca987$927743a0$e6567ec2@default> NNTP-Posting-Host: client86b8.globalnet.co.uk X-Newsreader: Microsoft Internet News 4.70.1155 I've had a bit of an experiment since I submitted to above item and produced the listing below. This seems to give OK-ish results, but I would have thought it was not nearly the most efficient way of doing it.... also you can't just throw any-old figure at it. Can anyone think of a better way? Suggestions greatfully received! Jon --------------------------------- int integer_square_root( int n ) { register int i; register int square; if ( n < 0 ) { printf( "integer_square_root. error %d is neg\n", n ); return 0; } for ( i = 0; i <= 200; i++ ) { square = i * i; if ( n <= square ) return i; } printf( "integer_square_root - can't do square-root of %d\n", n ); return 200; }