ref: 7c284022867d6a453b72e90235c8a86ce13fcccc
parent: e1f7ee14e89c4d5219245bdb3e917cbca48b4a04
author: Ori Bernstein <[email protected]>
date: Tue Sep 16 22:22:49 EDT 2014
Rename float -> flt Matches int, etc.
--- a/6/isel.c
+++ b/6/isel.c
@@ -76,8 +76,8 @@
* intention of loading /through/ the pointer? For now, we'll just say it's
* the pointer mode, since we expect to address through the pointer */
switch (t->type) {
- case Tyfloat32: return ModeF; break;
- case Tyfloat64: return ModeD; break;
+ case Tyflt32: return ModeF; break;
+ case Tyflt64: return ModeD; break;
default:
if (stacktype(t))
return ModeQ;
@@ -1050,10 +1050,10 @@
case Lbool: fprintf(fd, "\t.byte %d\n", v->lit.boolval); break;
case Lchr: fprintf(fd, "\t.long %d\n", v->lit.chrval); break;
case Lflt:
- if (tybase(v->lit.type)->type == Tyfloat32) {
+ if (tybase(v->lit.type)->type == Tyflt32) {
u.fv = v->lit.fltval;
fprintf(fd, "\t.long 0x%"PRIx32"\n", u.lv);
- } else if (tybase(v->lit.type)->type == Tyfloat64) {
+ } else if (tybase(v->lit.type)->type == Tyflt64) {
u.dv = v->lit.fltval;
fprintf(fd, "\t.quad 0x%"PRIx64"\n", u.qv);
}
--- a/6/simp.c
+++ b/6/simp.c
@@ -166,7 +166,7 @@
int floattype(Type *t)
{
t = tybase(t);
- return t->type == Tyfloat32 || t->type == Tyfloat64;
+ return t->type == Tyflt32 || t->type == Tyflt64;
}
int stacknode(Node *n)
@@ -343,9 +343,9 @@
return 8;
/*end integer types*/
- case Tyfloat32:
+ case Tyflt32:
return 4;
- case Tyfloat64:
+ case Tyflt64:
return 8;
case Tyslice:
@@ -699,7 +699,7 @@
case Tyint8: case Tyint16: case Tyint32: case Tyint:
case Tyuint8: case Tyuint16: case Tyuint32: case Tyuint:
case Tyint64: case Tyuint64: case Tylong: case Tyulong:
- case Tyfloat32: case Tyfloat64:
+ case Tyflt32: case Tyflt64:
case Typtr: case Tyfunc:
v = mkexpr(pat->line, Oeq, pat, val, NULL);
v->expr.type = mktype(pat->line, Tybool);
@@ -1036,7 +1036,7 @@
case Typtr:
r = intconvert(s, val, to, 0);
break;
- case Tyfloat32: case Tyfloat64:
+ case Tyflt32: case Tyflt64:
if (tybase(to)->type == Typtr)
fatal(val->line, "Bad cast from %s to %s",
tystr(exprtype(val)), tystr(to));
@@ -1048,7 +1048,7 @@
tystr(exprtype(val)), tystr(to));
}
break;
- case Tyfloat32: case Tyfloat64:
+ case Tyflt32: case Tyflt64:
t = tybase(exprtype(val));
switch (t->type) {
case Tyint8: case Tyint16: case Tyint32: case Tyint64:
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -13,9 +13,9 @@
env.myr \
execvp.myr \
extremum.myr \
- floatbits.myr \
+ fltbits.myr \
fmt.myr \
- floatfmt.myr \
+ fltfmt.myr \
hashfuncs.myr \
hasprefix.myr \
hassuffix.myr \
--- a/libstd/floatbits.myr
+++ /dev/null
@@ -1,60 +1,0 @@
-pkg std =
- const float64bits : (flt : float64 -> int64)
- const float32bits : (flt : float32 -> int32)
- const float64frombits : (bits : uint64 -> float64)
- const float32frombits : (bits : uint32 -> float32)
- const float64explode : (flt : float64 -> (bool, int64, int64))
- const float32explode : (flt : float32 -> (bool, int32, int32))
-;;
-
-const float64bits = {flt; -> (&flt castto(int64#))#}
-const float32bits = {flt; -> (&flt castto(int32#))#}
-const float64frombits = {bits; -> (&bits castto(float64#))#}
-const float32frombits = {bits; -> (&bits castto(float32#))#}
-
-const float64explode = {flt
- var bits, isneg, mant, exp
-
- bits = float64bits(flt)
- isneg = (bits >> 63) != 0 /* msb is sign bit */
- exp = (bits >> 52) & 0x7ff /* exp is in bits [52..63] */
- mant = bits & ((1l << 52) - 1) /* msb is in bits [..51] */
-
- /* add back the implicit bit if this is not a denormal */
- if exp != 0
- mant |= 1l << 52
- else
- exp = 1
- ;;
- /*
- adjust for exponent bias. nb: because we are
- treating the mantissa as m.0 instead of 0.m,
- our exponent bias needs to be offset by the
- size of m
- */
- -> (isneg, mant, exp)
-}
-
-const float32explode = {flt
- var bits, isneg, mant, exp
-
- bits = float32bits(flt)
- isneg = (bits >> 31) != 0 /* msb is sign bit */
- exp = (bits >> 22) & 0xff /* exp is in bits [23..30] */
- mant = bits & ((1 << 22) - 1) /* msb is in bits [0..22] */
-
- /* add back the implicit bit if this is not a denormal */
- if exp != 0
- mant |= 1 << 22
- else
- exp = 1
- ;;
- /*
- adjust for exponent bias. nb: because we are
- treating the mantissa as m.0 instead of 0.m,
- our exponent bias needs to be offset by the
- size of m
- */
- -> (isneg, mant, exp)
-}
-
--- a/libstd/floatfmt.myr
+++ /dev/null
@@ -1,237 +1,0 @@
-use "bigint.use"
-use "types.use"
-use "floatbits.use"
-use "extremum.use"
-use "utf.use"
-use "alloc.use"
-use "slpush.use"
-use "die.use"
-
-pkg std =
-
- const float64bfmt : (buf : byte[:], val : float64, mode : int, precision : int -> size)
- const float32bfmt : (buf : byte[:], val : float32, mode : int, precision : int -> size)
-;;
-
-const Dblbias = 1023
-const Fltbias = 127
-
-const float64bfmt = {buf, val, mode, precision
- var isneg, exp, mant
-
- (isneg, mant, exp) = float64explode(val)
- -> dragon4(buf, isneg, mant, (exp - 52) castto(int64), Dblbias, mode, precision)
-}
-
-const float32bfmt = {buf, val, mode, precision
- var isneg, exp, mant
-
- (isneg, mant, exp) = float32explode(val)
- -> dragon4(buf, isneg, mant castto(int64), (exp - 52) castto(int64), Fltbias, mode, precision)
-}
-
-/*
-buf: output buffer
-e: exponent
-p: precision
-f: mantissa
-
-floating value: x = f^(e - p)
-*/
-const dragon4 = {buf, isneg, f, e, p, mode, cutoff
- var r, s, t, u, v, y
- var udig
- var mm, mp /* margins above and below */
- var roundup
- var low, high
- var k, n
- var a, i
-
- /* if we have zero for the mantissa, we can return early */
- n = 0
- if isneg
- n += encode(buf, '-')
- ;;
- if f == 0
- n += encode(buf[n:], '0')
- n += encode(buf[n:], '.')
- n += encode(buf[n:], '0')
- -> n
- ;;
-
- /* initialize */
- roundup = false
- r = mkbigint(f)
- r = bigshli(r, max(e - p, 0))
- s = bigshli(mkbigint(1), max(0, -(e - p)))
- mm = bigshli(mkbigint(1), max((e - p), 0))
- mp = bigdup(mm)
-
- /* fixup: unequal gaps */
- t = mkbigint(1)
- bigshli(t, p - 1)
- if bigeqi(t, f)
- bigshli(mp, 1)
- bigshli(r, 1)
- bigshli(s, 1)
- ;;
- bigfree(t)
-
- k = 0
- while true
- /* r < ceil(s/b) */
- t = bigdup(s)
- bigaddi(t, 9)
- bigdivi(t, 10)
- match bigcmp(r, t)
- | `Before:
- k--
- bigmuli(r, 10)
- bigmuli(mm, 10)
- bigmuli(mp, 10)
- | _:
- bigfree(t)
- break
- ;;
- bigfree(t)
- ;;
-
- while true
- t = bigdup(r)
- bigshli(t, 1)
- bigadd(t, mp)
- while true
- u = bigdup(s)
- bigshli(u, 1)
- match bigcmp(t, u)
- | `Before:
- bigfree(u)
- break
- | _:
- k++
- bigmuli(s, 10)
- bigfree(u)
- ;;
- ;;
- if mode == 0
- cutoff = k - buf.len - 1
- else
- if mode == 2
- cutoff += k
- ;;
- a = cutoff - k
- y = bigdup(s)
- if a < 0
- for i = 0; i < a; i++
- bigmuli(y, 10)
- ;;
- else
- for i = 0; i < -a; i++
- bigaddi(y, 9)
- bigdivi(y, 10)
- ;;
- ;;
- match bigcmp(y, mm)
- | `Before: /* nothing */
- | _:
- bigfree(mm)
- mm = y
- ;;
- match bigcmp(y, mp)
- | `Before: /* nothing */
- | _:
- bigfree(mp)
- mp = y
- roundup = true
- ;;
- ;;
- u = bigdup(s)
- bigshli(u, 1)
- match bigcmp(t, u)
- | `Before:
- bigfree(t)
- bigfree(u)
- break
- ;;
- ;;
-
- if k <= 0
- n += encode(buf[n:], '0')
- n += encode(buf[n:], '.')
- ;;
- while true
- k--
- bigmuli(r, 10)
- u = bigdup(r);
- bigdiv(u, s)
-
- bigmod(r, s)
- bigmuli(mm, 10)
- bigmuli(mp, 10)
-
- low = false
- t = bigdup(r)
- bigshli(t, 1)
- match bigcmp(t, mm)
- | `Before: low = true
- ;;
- bigfree(t)
-
- v = bigdup(r)
- bigshli(v, 1)
- t = bigdup(s)
- bigshli(t, 1)
- bigsub(t, mp)
- match bigcmp(v, t)
- | `After: high = true
- | `Equal: high = roundup
- | `Before: high = false
- ;;
- bigfree(v)
- bigfree(t)
- if low || high || k == cutoff
- break
- ;;
- n += format(buf[n:], lowdig(u), k)
- bigfree(u)
- ;;
-
- /* format the last digit */
- udig = lowdig(u)
- if low && !high
- n += format(buf[n:], udig, k)
- elif high && !low
- n += format(buf[n:], udig + 1, k)
- else
- bigmuli(r, 2)
- match bigcmp(r, s)
- | `Before: n += format(buf[n:], udig, k)
- | `Equal: n += format(buf[n:], udig, k)
- | `After: n += format(buf[n:], udig + 1, k)
- ;;
- ;;
- -> n
-}
-
-const lowdig = {u
- if u.dig.len > 0
- -> u.dig[0]
- ;;
- -> 0
-}
-
-const format = {buf, d, k
- const dig = "0123456789abcdefghijklmnopqrstuvwxyz"
- var n, i
-
- n = 0
- if k == 0
- n += encode(buf[n:], '.')
- elif k < 0
- for i = 0; i < -k; i++
- n += encode(buf[n:], '0')
- ;;
- ;;
- buf[n++] = dig[d]
- -> n
-}
--- /dev/null
+++ b/libstd/fltbits.myr
@@ -1,0 +1,60 @@
+pkg std =
+ const flt64bits : (flt : flt64 -> int64)
+ const flt32bits : (flt : flt32 -> int32)
+ const flt64frombits : (bits : uint64 -> flt64)
+ const flt32frombits : (bits : uint32 -> flt32)
+ const flt64explode : (flt : flt64 -> (bool, int64, int64))
+ const flt32explode : (flt : flt32 -> (bool, int32, int32))
+;;
+
+const flt64bits = {flt; -> (&flt castto(int64#))#}
+const flt32bits = {flt; -> (&flt castto(int32#))#}
+const flt64frombits = {bits; -> (&bits castto(flt64#))#}
+const flt32frombits = {bits; -> (&bits castto(flt32#))#}
+
+const flt64explode = {flt
+ var bits, isneg, mant, exp
+
+ bits = flt64bits(flt)
+ isneg = (bits >> 63) != 0 /* msb is sign bit */
+ exp = (bits >> 52) & 0x7ff /* exp is in bits [52..63] */
+ mant = bits & ((1l << 52) - 1) /* msb is in bits [..51] */
+
+ /* add back the implicit bit if this is not a denormal */
+ if exp != 0
+ mant |= 1l << 52
+ else
+ exp = 1
+ ;;
+ /*
+ adjust for exponent bias. nb: because we are
+ treating the mantissa as m.0 instead of 0.m,
+ our exponent bias needs to be offset by the
+ size of m
+ */
+ -> (isneg, mant, exp)
+}
+
+const flt32explode = {flt
+ var bits, isneg, mant, exp
+
+ bits = flt32bits(flt)
+ isneg = (bits >> 31) != 0 /* msb is sign bit */
+ exp = (bits >> 22) & 0xff /* exp is in bits [23..30] */
+ mant = bits & ((1 << 22) - 1) /* msb is in bits [0..22] */
+
+ /* add back the implicit bit if this is not a denormal */
+ if exp != 0
+ mant |= 1 << 22
+ else
+ exp = 1
+ ;;
+ /*
+ adjust for exponent bias. nb: because we are
+ treating the mantissa as m.0 instead of 0.m,
+ our exponent bias needs to be offset by the
+ size of m
+ */
+ -> (isneg, mant, exp)
+}
+
--- /dev/null
+++ b/libstd/fltfmt.myr
@@ -1,0 +1,237 @@
+use "bigint.use"
+use "types.use"
+use "fltbits.use"
+use "extremum.use"
+use "utf.use"
+use "alloc.use"
+use "slpush.use"
+use "die.use"
+
+pkg std =
+
+ const flt64bfmt : (buf : byte[:], val : flt64, mode : int, precision : int -> size)
+ const flt32bfmt : (buf : byte[:], val : flt32, mode : int, precision : int -> size)
+;;
+
+const Dblbias = 1023
+const Fltbias = 127
+
+const flt64bfmt = {buf, val, mode, precision
+ var isneg, exp, mant
+
+ (isneg, mant, exp) = flt64explode(val)
+ -> dragon4(buf, isneg, mant, (exp - 52) castto(int64), Dblbias, mode, precision)
+}
+
+const flt32bfmt = {buf, val, mode, precision
+ var isneg, exp, mant
+
+ (isneg, mant, exp) = flt32explode(val)
+ -> dragon4(buf, isneg, mant castto(int64), (exp - 52) castto(int64), Fltbias, mode, precision)
+}
+
+/*
+buf: output buffer
+e: exponent
+p: precision
+f: mantissa
+
+flting value: x = f^(e - p)
+*/
+const dragon4 = {buf, isneg, f, e, p, mode, cutoff
+ var r, s, t, u, v, y
+ var udig
+ var mm, mp /* margins above and below */
+ var roundup
+ var low, high
+ var k, n
+ var a, i
+
+ /* if we have zero for the mantissa, we can return early */
+ n = 0
+ if isneg
+ n += encode(buf, '-')
+ ;;
+ if f == 0
+ n += encode(buf[n:], '0')
+ n += encode(buf[n:], '.')
+ n += encode(buf[n:], '0')
+ -> n
+ ;;
+
+ /* initialize */
+ roundup = false
+ r = mkbigint(f)
+ r = bigshli(r, max(e - p, 0))
+ s = bigshli(mkbigint(1), max(0, -(e - p)))
+ mm = bigshli(mkbigint(1), max((e - p), 0))
+ mp = bigdup(mm)
+
+ /* fixup: unequal gaps */
+ t = mkbigint(1)
+ bigshli(t, p - 1)
+ if bigeqi(t, f)
+ bigshli(mp, 1)
+ bigshli(r, 1)
+ bigshli(s, 1)
+ ;;
+ bigfree(t)
+
+ k = 0
+ while true
+ /* r < ceil(s/b) */
+ t = bigdup(s)
+ bigaddi(t, 9)
+ bigdivi(t, 10)
+ match bigcmp(r, t)
+ | `Before:
+ k--
+ bigmuli(r, 10)
+ bigmuli(mm, 10)
+ bigmuli(mp, 10)
+ | _:
+ bigfree(t)
+ break
+ ;;
+ bigfree(t)
+ ;;
+
+ while true
+ t = bigdup(r)
+ bigshli(t, 1)
+ bigadd(t, mp)
+ while true
+ u = bigdup(s)
+ bigshli(u, 1)
+ match bigcmp(t, u)
+ | `Before:
+ bigfree(u)
+ break
+ | _:
+ k++
+ bigmuli(s, 10)
+ bigfree(u)
+ ;;
+ ;;
+ if mode == 0
+ cutoff = k - buf.len - 1
+ else
+ if mode == 2
+ cutoff += k
+ ;;
+ a = cutoff - k
+ y = bigdup(s)
+ if a < 0
+ for i = 0; i < a; i++
+ bigmuli(y, 10)
+ ;;
+ else
+ for i = 0; i < -a; i++
+ bigaddi(y, 9)
+ bigdivi(y, 10)
+ ;;
+ ;;
+ match bigcmp(y, mm)
+ | `Before: /* nothing */
+ | _:
+ bigfree(mm)
+ mm = y
+ ;;
+ match bigcmp(y, mp)
+ | `Before: /* nothing */
+ | _:
+ bigfree(mp)
+ mp = y
+ roundup = true
+ ;;
+ ;;
+ u = bigdup(s)
+ bigshli(u, 1)
+ match bigcmp(t, u)
+ | `Before:
+ bigfree(t)
+ bigfree(u)
+ break
+ ;;
+ ;;
+
+ if k <= 0
+ n += encode(buf[n:], '0')
+ n += encode(buf[n:], '.')
+ ;;
+ while true
+ k--
+ bigmuli(r, 10)
+ u = bigdup(r);
+ bigdiv(u, s)
+
+ bigmod(r, s)
+ bigmuli(mm, 10)
+ bigmuli(mp, 10)
+
+ low = false
+ t = bigdup(r)
+ bigshli(t, 1)
+ match bigcmp(t, mm)
+ | `Before: low = true
+ ;;
+ bigfree(t)
+
+ v = bigdup(r)
+ bigshli(v, 1)
+ t = bigdup(s)
+ bigshli(t, 1)
+ bigsub(t, mp)
+ match bigcmp(v, t)
+ | `After: high = true
+ | `Equal: high = roundup
+ | `Before: high = false
+ ;;
+ bigfree(v)
+ bigfree(t)
+ if low || high || k == cutoff
+ break
+ ;;
+ n += format(buf[n:], lowdig(u), k)
+ bigfree(u)
+ ;;
+
+ /* format the last digit */
+ udig = lowdig(u)
+ if low && !high
+ n += format(buf[n:], udig, k)
+ elif high && !low
+ n += format(buf[n:], udig + 1, k)
+ else
+ bigmuli(r, 2)
+ match bigcmp(r, s)
+ | `Before: n += format(buf[n:], udig, k)
+ | `Equal: n += format(buf[n:], udig, k)
+ | `After: n += format(buf[n:], udig + 1, k)
+ ;;
+ ;;
+ -> n
+}
+
+const lowdig = {u
+ if u.dig.len > 0
+ -> u.dig[0]
+ ;;
+ -> 0
+}
+
+const format = {buf, d, k
+ const dig = "0123456789abcdefghijklmnopqrstuvwxyz"
+ var n, i
+
+ n = 0
+ if k == 0
+ n += encode(buf[n:], '.')
+ elif k < 0
+ for i = 0; i < -k; i++
+ n += encode(buf[n:], '0')
+ ;;
+ ;;
+ buf[n++] = dig[d]
+ -> n
+}
--- a/libstd/fmt.myr
+++ b/libstd/fmt.myr
@@ -6,7 +6,7 @@
use "varargs.use"
use "extremum.use"
use "chartype.use"
-use "floatfmt.use"
+use "fltfmt.use"
/*
printf-like functions. These use a different syntax from the C printf,
@@ -168,7 +168,7 @@
var z_val : size
var p_val : byte#
var c_val : char
- var f_val : float64, F_val : float32
+ var f_val : flt64, F_val : flt32
n = 0
while fmt.len != 0
@@ -221,11 +221,11 @@
(f_val, ap) = vanext(ap)
b = buf[n:]
/* FIXME(ori): bug, b[n:].len fails since b[n:] isn't an lval */
- n += float64bfmt(buf[n:], f_val, 0, b.len)
- /* FIXME: float casts are currently broken
+ n += flt64bfmt(buf[n:], f_val, 0, b.len)
+ /* FIXME: flt casts are currently broken
| 'F':
(F_val, ap) = vanext(ap)
- n += floatfmt(buf[n:], F_val castto(float64))
+ n += fltfmt(buf[n:], F_val castto(flt64))
*/
/* format integers */
| 'b':
--- a/opt/fold.c
+++ b/opt/fold.c
@@ -54,7 +54,7 @@
if (!dcl->decl.init)
return 0;
t = tybase(exprtype(dcl->decl.init));
- if (t->type <= Tyfloat64)
+ if (t->type <= Tyflt64)
return 1;
return 0;
}
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -372,7 +372,7 @@
case Lchr: return mktype(n->line, Tychar); break;
case Lbool: return mktype(n->line, Tybool); break;
case Lint: return mktylike(n->line, Tyint); break;
- case Lflt: return mktylike(n->line, Tyfloat64); break;
+ case Lflt: return mktylike(n->line, Tyflt64); break;
case Lstr: return mktyslice(n->line, mktype(n->line, Tybyte)); break;
case Llbl: return mktyptr(n->line, mktype(n->line, Tyvoid)); break;
case Lfunc: return n->lit.fnval->func.type; break;
@@ -1662,7 +1662,7 @@
if (!tyint)
tyint = mktype(-1, Tyint);
if (!tyflt)
- tyflt = mktype(-1, Tyfloat64);
+ tyflt = mktype(-1, Tyflt64);
t = tysearch(orig);
if (orig->type == Tyvar && hthas(st->delayed, orig)) {
--- a/parse/type.c
+++ b/parse/type.c
@@ -296,7 +296,7 @@
int istyfloat(Type *t)
{
switch (tybase(t)->type) {
- case Tyfloat32: case Tyfloat64:
+ case Tyflt32: case Tyflt64:
return 1;
default:
return 0;
@@ -502,8 +502,8 @@
case Tyuint32: p += snprintf(p, end - p, "uint32"); break;
case Tyuint64: p += snprintf(p, end - p, "uint64"); break;
case Tyulong: p += snprintf(p, end - p, "ulong"); break;
- case Tyfloat32: p += snprintf(p, end - p, "float32"); break;
- case Tyfloat64: p += snprintf(p, end - p, "float64"); break;
+ case Tyflt32: p += snprintf(p, end - p, "flt32"); break;
+ case Tyflt64: p += snprintf(p, end - p, "flt64"); break;
case Tyvalist: p += snprintf(p, end - p, "..."); break;
case Typtr:
@@ -705,16 +705,16 @@
traits[Tybyte][1] = traittab[Tcint];
/* <integer types>::(numeric,integral) */
- for (i = Tyint8; i < Tyfloat32; i++) {
+ for (i = Tyint8; i < Tyflt32; i++) {
traits[i][0] = traittab[Tcnum];
traits[i][1] = traittab[Tcint];
}
/* <floats>::(numeric,floating) */
- traits[Tyfloat32][0] = traittab[Tcnum];
- traits[Tyfloat32][1] = traittab[Tcfloat];
- traits[Tyfloat64][0] = traittab[Tcnum];
- traits[Tyfloat64][1] = traittab[Tcfloat];
+ traits[Tyflt32][0] = traittab[Tcnum];
+ traits[Tyflt32][1] = traittab[Tcfloat];
+ traits[Tyflt64][0] = traittab[Tcnum];
+ traits[Tyflt64][1] = traittab[Tcfloat];
/* @a*::(sliceable) */
traits[Typtr][0] = traittab[Tcslice];
--- a/parse/types.def
+++ b/parse/types.def
@@ -23,8 +23,8 @@
Ty(Tyuint64, "uint64")
Ty(Tyulong, "ulong")
/*end integer types*/
-Ty(Tyfloat32, "float32")
-Ty(Tyfloat64, "float64")
+Ty(Tyflt32, "flt32")
+Ty(Tyflt64, "flt64")
/* end primitive types */
Ty(Tyvalist, NULL)
--- a/test/sqrt.myr
+++ b/test/sqrt.myr
@@ -11,7 +11,7 @@
const Eps = 0.00001
const Maxiter = 20
-const sqrt = {x : float64
+const sqrt = {x : flt64
var val
var iter
var i;