]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/math.cpp
webapps.wiki: adding search bar
[factor.git] / vm / math.cpp
index 29daa91e1b555cea212784532ebeea23ff89af0e..ef56d265dcf95eaae7962feafbc0ef8dd03a48e5 100644 (file)
@@ -174,22 +174,22 @@ void factor_vm::primitive_bignum_shift() {
 
 void factor_vm::primitive_bignum_less() {
   POP_BIGNUMS(x, y);
-  ctx->replace(tag_boolean(bignum_compare(x, y) == bignum_comparison_less));
+  ctx->replace(tag_boolean(bignum_compare(x, y) == BIGNUM_COMPARISON_LESS));
 }
 
 void factor_vm::primitive_bignum_lesseq() {
   POP_BIGNUMS(x, y);
-  ctx->replace(tag_boolean(bignum_compare(x, y) != bignum_comparison_greater));
+  ctx->replace(tag_boolean(bignum_compare(x, y) != BIGNUM_COMPARISON_GREATER));
 }
 
 void factor_vm::primitive_bignum_greater() {
   POP_BIGNUMS(x, y);
-  ctx->replace(tag_boolean(bignum_compare(x, y) == bignum_comparison_greater));
+  ctx->replace(tag_boolean(bignum_compare(x, y) == BIGNUM_COMPARISON_GREATER));
 }
 
 void factor_vm::primitive_bignum_greatereq() {
   POP_BIGNUMS(x, y);
-  ctx->replace(tag_boolean(bignum_compare(x, y) != bignum_comparison_less));
+  ctx->replace(tag_boolean(bignum_compare(x, y) != BIGNUM_COMPARISON_LESS));
 }
 
 void factor_vm::primitive_bignum_not() {
@@ -223,8 +223,7 @@ void factor_vm::primitive_format_float() {
   try {
     localized_stream.imbue(std::locale(locale));
   } catch (const runtime_error&) {
-    byte_array* array = allot_byte_array(1);
-    array->data<char>()[0] = '\0';
+    byte_array* array = allot_byte_array(0);
     ctx->replace(tag<byte_array>(array));
     return;
   }
@@ -239,15 +238,15 @@ void factor_vm::primitive_format_float() {
     localized_stream << std::setfill(fill[0]);
   }
   if (width >= 0) {
-    localized_stream << std::setw(width);
+    localized_stream << std::setw(static_cast<int>(width));
   }
   if (precision >= 0) {
-    localized_stream << std::setprecision(precision);
+    localized_stream << std::setprecision(static_cast<int>(precision));
   }
   localized_stream << value;
   const std::string& tmp = localized_stream.str();
   const char* cstr = tmp.c_str();
-  size_t size = tmp.length()+1;
+  size_t size = tmp.length();
   byte_array* array = allot_byte_array(size);
   memcpy(array->data<char>(), cstr, size);
   ctx->replace(tag<byte_array>(array));