Skip to content
Browse files

All current tests pass

  • Loading branch information...
1 parent 6df55cc commit 9a38df85b6cddacc52955dc50ae36dec962cc76c @Gabriano Gabriano committed Jun 7, 2012
Showing with 17 additions and 6 deletions.
  1. +16 −5 gsc/_t-univ.scm
  2. +1 −1 include/stamp.h
View
21 gsc/_t-univ.scm
@@ -753,6 +753,14 @@ function Flonum(val) {
this.val = val;
}
+Flonum.prototype.toString = function ( ) {
+ if (parseFloat(this.val) == parseInt(this.val)) {
+ return this.val + ".";
+ } else {
+ return this.val;
+ }
+}
+
var chars = {}
function Char(i) {
this.i = i;
@@ -860,7 +868,7 @@ function lbl1_println() { // println
else if (reg[1] === true)
print("#t");
else if (reg[1] instanceof Flonum)
- print(reg[1].val);
+ print(reg[1].toString());
else if (reg[1] instanceof _String)
print(reg[1].toString());
else if (reg[1] instanceof Char)
@@ -930,11 +938,12 @@ def lbl1_println(): # println
raise "wrong number of arguments"
if reg[1] is False:
print("#f")
+ elif reg[1] is True:
+ print("#t")
+ elif isinstance(reg[1], float) and (int(reg[1]) == round(reg[1])):
+ print(str(int(reg[1])) + '.')
else:
- if reg[1] is True:
- print("#t")
- else:
- print(reg[1])
+ print(reg[1])
return reg[0]
glo["println"] = lbl1_println
@@ -986,6 +995,8 @@ $lbl1_println = lambda { # println
print("#t")
elsif $reg[1].equal?(nil)
print("'()")
+ elsif $reg[1].class == Float && $reg[1] == $reg[1].round
+ print($reg[1].round.to_s() + ".")
else
print($reg[1])
end
View
2 include/stamp.h
@@ -3,4 +3,4 @@
*/
#define ___STAMP_YMD 20120607
-#define ___STAMP_HMS 193904
+#define ___STAMP_HMS 203554

0 comments on commit 9a38df8

Please sign in to comment.
Something went wrong with that request. Please try again.