Revision: 1414
Author: jsuijs
Date: Sun Oct 25 00:22:03 2009
Log: handle 0 and fixed warning
http://code.google.com/p/jallib/source/detail?r=1414
Modified:
/trunk/include/jal/sqrt.jal
=======================================
--- /trunk/include/jal/sqrt.jal Sat Oct 24 10:49:37 2009
+++ /trunk/include/jal/sqrt.jal Sun Oct 25 00:22:03 2009
@@ -19,6 +19,8 @@
function sqrt(dword in invalue) return word is
var dword xest
+ if (invalue == 0) then return 0 end if
+
if (invalue < 10_000) then
xest = 31
elsif (invalue < 5_000_000) then
@@ -34,6 +36,6 @@
xest = (xest + invalue / xest) / 2
end loop
- return sword(xest)
+ return word(xest)
end function
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---