chiark
/
gitweb
/
~ian
/
sgt-puzzles.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4322b90
)
Correction from James H: sqrt(0) shouldn't occur any more than
author
Simon Tatham
<anakin@pobox.com>
Sat, 5 Jul 2008 22:07:35 +0000
(22:07 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 5 Jul 2008 22:07:35 +0000
(22:07 +0000)
sqrt(1) should.
[originally from svn r8108]
unfinished/numgame.c
patch
|
blob
|
history
diff --git
a/unfinished/numgame.c
b/unfinished/numgame.c
index 8f59c7338d5dceb9fe4389fac7f793fa00cc05b9..20861ca3fa187e4ec912b5f58f6d0bb34ec95119 100644
(file)
--- a/
unfinished/numgame.c
+++ b/
unfinished/numgame.c
@@
-542,9
+542,9
@@
static int perform_sqrt(int *a, int *b, int *output)
int half[2] = { 1, 2 };
/*
- * sqrt(1) == 1: don't perform unary noops.
+ * sqrt(
0) == 0, sqrt(
1) == 1: don't perform unary noops.
*/
- if (a[0] ==
1 && a[1] == 1
) return FALSE;
+ if (a[0] ==
0 || (a[0] == 1 && a[1] == 1)
) return FALSE;
return perform_exp(a, half, output);
}