commit b352b2979b55d3ec9148657b2bdf4a9f53c4e607
parent 779c9770ac19438a2cc049a17aef212af518d503
Author: Commit-Bot <unknown>
Date: Fri, 14 May 2010 18:23:34 +0000
Automatic commit from picoLisp.tgz, From: Fri, 14 May 2010 15:23:34 GMT
Diffstat:
9 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/CHANGES b/CHANGES
@@ -1,4 +1,5 @@
* XXjun10 picoLisp-3.0.3
+ 'sqrt' optionally rounds
'format' also accepts 'lst' argument
'adr' function
'dir' can also return '.'-files
diff --git a/ReleaseNotes b/ReleaseNotes
@@ -1,4 +1,4 @@
-12may10abu
+14may10abu
(c) Software Lab. Alexander Burger
@@ -27,18 +27,3 @@ D. The 'format' number <-> string conversion function now also accepts a list
(format Lst)
will also do.
-
-E. There is a partially implemented 32-bit emulator of the 64-bit version in
- "src64/arch/x86-32.l". It is intended as a demonstration of how to port the
- assembler to a different CPU (not a very suitable demonstration, though), and
- a way to thest 64-bit programs on a 32-bit machine. If it ever works, it will
- be deadly slow, though.
-
- In case somebody likes to grit his teeth on it, an exprimental executable
- "bin/emu32" can be built with
-
- (cd src64; ./mkEmu32)
-
- Be warned, however, it builds something which doesn't run. Most instructions
- that return CPU flags, and 128-bit multiplication/division are not right yet.
- Besides this, there are probably a lot of bugs.
diff --git a/doc/ref.html b/doc/ref.html
@@ -1880,6 +1880,7 @@ abbreviations:
<a href="refP.html#pad">pad</a>
<a href="refO.html#oct">oct</a>
<a href="refH.html#hex">hex</a>
+ <a href="refH.html#hax">hax</a>
<a href="refF.html#fmt64">fmt64</a>
<a href="refM.html#money">money</a>
</code>
diff --git a/doc/refH.html b/doc/refH.html
@@ -191,7 +191,11 @@ Content-Type: text/html; charset=utf-8
<dt><code>(hex 'sym) -> num</code>
<dd>Converts a number <code>num</code> to a hexadecimal string, or a hexadecimal
string <code>sym</code> to a number. See also <code><a
-href="refO.html#oct">oct</a></code> and <code><a
+href="refO.html#oct">oct</a></code>, <code><a
+href="refF.html#fmt64">fmt64</a></code>, <code><a
+href="refH.html#hax">hax</a></code>
+
+ and <code><a
href="refF.html#format">format</a></code>.
<pre><code>
diff --git a/doc/refO.html b/doc/refO.html
@@ -66,7 +66,9 @@ Obj (+A +B +C)
<dt><code>(oct 'sym) -> num</code>
<dd>Converts a number <code>num</code> to an octal string, or an octal string
<code>sym</code> to a number. See also <code><a
-href="refH.html#hex">hex</a></code> and <code><a
+href="refH.html#hex">hex</a></code>, <code><a
+href="refF.html#fmt64">fmt64</a></code>, <code><a
+href="refH.html#hax">hax</a></code> and <code><a
href="refF.html#format">format</a></code>.
<pre><code>
diff --git a/doc/refS.html b/doc/refS.html
@@ -554,14 +554,17 @@ href="refS.html#stem">stem</a></code>.
-> ("The" "quick" "brown" "fox")
</code></pre>
-<dt><a name="sqrt"><code>(sqrt 'num) -> num</code></a>
-<dd>Returns the square root of the <code>num</code> argument.
+<dt><a name="sqrt"><code>(sqrt 'num ['flg]) -> num</code></a>
+<dd>Returns the square root of the <code>num</code> argument. If
+<code>flg</code> is given and non-<code>NIL</code>, the result will be rounded.
<pre><code>
: (sqrt 64)
-> 8
: (sqrt 1000)
-> 31
+: (sqrt 1000 T)
+-> 32
: (sqrt 10000000000000000000000000000000000000000)
-> 100000000000000000000
</code></pre>
diff --git a/lib/misc.l b/lib/misc.l
@@ -1,4 +1,4 @@
-# 30apr10abu
+# 14may10abu
# (c) Software Lab. Alexander Burger
# *Allow *Tmp
@@ -40,7 +40,7 @@
(set (link @) (name (read))) ) ) ) ) )
### Math ###
-(de sqrt (N)
+(de sqrt (N F)
(cond
((lt0 N) (quit "Bad argument" N))
(N
@@ -54,6 +54,7 @@
(inc 'B A) )
(setq B (>> 1 B) A (>> 2 A))
(T (=0 A)) )
+ (and F (> N B) (inc 'B))
B ) ) ) )
# (Knuth Vol.2, p.442)
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 12may10abu
+# 14may10abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 0 2 19)
+(de *Version 3 0 2 20)
# vi:et:ts=3:sw=3
diff --git a/test/src/big.l b/test/src/big.l
@@ -1,4 +1,4 @@
-# 30apr10abu
+# 14may10abu
# (c) Software Lab. Alexander Burger
### format ###
@@ -145,6 +145,7 @@
### sqrt ###
(test 8 (sqrt 64))
(test 31 (sqrt 1000))
+(test 32 (sqrt 1000 T))
(test 100000000000000000000
(sqrt 10000000000000000000000000000000000000000) )
(test NIL (sqrt NIL))