diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-12 13:10:23 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-12 17:00:19 -0700 |
commit | 3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7 (patch) | |
tree | 330d04974b9d30bff1b16adc8d14a3d9fd77643d /041name.cc | |
parent | a70d593dfb8eea87a898a69adeb9689a21199edf (diff) | |
download | mu-3663ca6c2d4c42c4a7bf6af4b2edf71dd8d10dd7.tar.gz |
1356 - snapshot #2: floating point support
I added one test to check that divide can return a float, then hacked at the rippling failures across the entire entire codebase until all tests pass. Now I need to look at the changes I made and see if there's a system to them, identify other places that I missed, and figure out the best way to cover all cases. I also need to show real rather than encoded values in the traces, but I can't use value() inside reagent methods because of the name clash with the member variable. So let's take a snapshot before we attempt any refactoring. This was non-trivial to get right. Even if I convince myself that I've gotten it right, I might back this all out if I can't easily *persuade others* that I've gotten it right.
Diffstat (limited to '041name.cc')
-rw-r--r-- | 041name.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/041name.cc b/041name.cc index e5e9449b..ff2b811c 100644 --- a/041name.cc +++ b/041name.cc @@ -46,7 +46,7 @@ void transform_names(const recipe_number r) { if (!already_transformed(inst.ingredients.at(in), names)) { raise << "use before set: " << inst.ingredients.at(in).name << " in " << Recipe[r].name << '\n'; } - inst.ingredients.at(in).set_value(lookup_name(inst.ingredients.at(in), r)); + inst.ingredients.at(in).set_value(mu_integer(lookup_name(inst.ingredients.at(in), r))); // must be a positive integer } for (index_t out = 0; out < inst.products.size(); ++out) { if (is_numeric_location(inst.products.at(out))) numeric_locations_used = true; @@ -57,7 +57,7 @@ void transform_names(const recipe_number r) { names[inst.products.at(out).name] = curr_idx; curr_idx += size_of(inst.products.at(out)); } - inst.products.at(out).set_value(lookup_name(inst.products.at(out), r)); + inst.products.at(out).set_value(mu_integer(lookup_name(inst.products.at(out), r))); // must be a positive integer } } if (names_used && numeric_locations_used) @@ -220,7 +220,7 @@ if (inst.operation == Recipe_number["get"] if (inst.ingredients.at(1).name.find_first_not_of("0123456789") == string::npos) continue; // since first non-address in base type must be a container, we don't have to canonize type_number base_type = skip_addresses(inst.ingredients.at(0).types); - inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name)); + inst.ingredients.at(1).set_value(mu_integer(find_element_name(base_type, inst.ingredients.at(1).name))); // must be a positive integer trace("name") << "element " << inst.ingredients.at(1).name << " of type " << Type[base_type].name << " is at offset " << inst.ingredients.at(1).value; } @@ -256,6 +256,6 @@ if (inst.operation == Recipe_number["maybe-convert"]) { if (inst.ingredients.at(1).name.find_first_not_of("0123456789") == string::npos) continue; // since first non-address in base type must be an exclusive container, we don't have to canonize type_number base_type = skip_addresses(inst.ingredients.at(0).types); - inst.ingredients.at(1).set_value(find_element_name(base_type, inst.ingredients.at(1).name)); + inst.ingredients.at(1).set_value(mu_integer(find_element_name(base_type, inst.ingredients.at(1).name))); // must be a positive integer trace("name") << "variant " << inst.ingredients.at(1).name << " of type " << Type[base_type].name << " has tag " << inst.ingredients.at(1).value; } |