This commit is contained in:
parent
c055c4781f
commit
9c952560da
2
mu.md
2
mu.md
|
@ -331,7 +331,7 @@ Negate:
|
||||||
negate var
|
negate var
|
||||||
```
|
```
|
||||||
|
|
||||||
### Floating-point arithmetic
|
### Fractional arithmetic
|
||||||
|
|
||||||
Operations on `float` variables include a few we've seen before and some new
|
Operations on `float` variables include a few we've seen before and some new
|
||||||
ones. Notice here that we mostly use floating-point registers `xmm_`, but
|
ones. Notice here that we mostly use floating-point registers `xmm_`, but
|
||||||
|
|
|
@ -283,7 +283,7 @@ var x/edx: int <- copy 0
|
||||||
Run `translate` (or `translate_emulated`) as usual. Use your runbook from Task
|
Run `translate` (or `translate_emulated`) as usual. Use your runbook from Task
|
||||||
6 to address the errors that arise.
|
6 to address the errors that arise.
|
||||||
|
|
||||||
## Task 8: floating point
|
## Task 8: fractional numbers
|
||||||
|
|
||||||
All our variables so far have had type `int` (integer), but there are limits
|
All our variables so far have had type `int` (integer), but there are limits
|
||||||
to what you can do with just whole integers. For example, here's the formula
|
to what you can do with just whole integers. For example, here's the formula
|
||||||
|
@ -297,7 +297,7 @@ distance * 1.609
|
||||||
Write a function to perform this conversion. Some starting points:
|
Write a function to perform this conversion. Some starting points:
|
||||||
* Reread [the section on variables and registers](https://github.com/akkartik/mu/blob/main/mu.md#variables-registers-and-memory)
|
* Reread [the section on variables and registers](https://github.com/akkartik/mu/blob/main/mu.md#variables-registers-and-memory)
|
||||||
with special attention to the `float` type.
|
with special attention to the `float` type.
|
||||||
* Read [the section on floating-point arithmetic](https://github.com/akkartik/mu/blob/main/mu.md#floating-point-arithmetic).
|
* Read [the section on fractional arithmetic](https://github.com/akkartik/mu/blob/main/mu.md#fractional-arithmetic).
|
||||||
* One wrinkle is that the x86 instruction set doesn't permit literal
|
* One wrinkle is that the x86 instruction set doesn't permit literal
|
||||||
fractional arguments. So you'll need to _create_ 1.609 somehow. See the
|
fractional arguments. So you'll need to _create_ 1.609 somehow. See the
|
||||||
section on moving values around under [operations on simple types](https://github.com/akkartik/mu/blob/main/mu.md#operations-on-simple-types).
|
section on moving values around under [operations on simple types](https://github.com/akkartik/mu/blob/main/mu.md#operations-on-simple-types).
|
||||||
|
|
Loading…
Reference in New Issue