public
/
ack.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
67d635c
)
Removed the use of float from the test.
author
em
<none@none>
Tue, 12 Feb 1985 23:27:23 +0000
(23:27 +0000)
committer
em
<none@none>
Tue, 12 Feb 1985 23:27:23 +0000
(23:27 +0000)
Using int's in sqrt gives the same result.
lang/cem/ctest/ctdecl/decl.c
patch
|
blob
|
history
diff --git
a/lang/cem/ctest/ctdecl/decl.c
b/lang/cem/ctest/ctdecl/decl.c
index
8da1d64
..
024f35f
100644
(file)
--- a/
lang/cem/ctest/ctdecl/decl.c
+++ b/
lang/cem/ctest/ctdecl/decl.c
@@
-48,7
+48,7
@@
static int sqr(par) int par ; {
}
int sqrt(par) int par ; {
-
floa
t x1,x2 ;
+
in
t x1,x2 ;
int i ;
if ( par<0 ) return -1 ;
@@
-58,7
+58,7
@@
int sqrt(par) int par ; {
x2 = x1 ;
x1 = ( x2*x2 + par ) / (2*x2) ;
if ( i++>=100 ) return -2 ;
- } while ( ( x2<x1 ? x1-x2 : x2-x1 ) >
1e-5
) ;
+ } while ( ( x2<x1 ? x1-x2 : x2-x1 ) >
0
) ;
return (x1+x2)/2 ;
}