Use float64 instead of int64

master
Jonas Franz 5 years ago
parent 0eeea6f007
commit 41bb7cf2d5
Signed by: JonasFranzDEV
GPG Key ID: 7293A220B7C38080
  1. 4
      hal/instructions.go
  2. 2
      parser/program_parser.go

@ -7,7 +7,7 @@ import (
type ProgrammedInstruction struct {
Instruction *Instruction
Operand int64
Operand float64
}
func (pi *ProgrammedInstruction) Execute(module *Module) error {
@ -23,7 +23,7 @@ func (pi *ProgrammedInstruction) Execute(module *Module) error {
type Instruction struct {
Name string
ExecuteWithOperand func(module *Module, operand int64)
ExecuteWithOperand func(module *Module, operand float64)
Execute func(module *Module)
}

@ -34,7 +34,7 @@ func parseInstruction(input string) (*hal.ProgrammedInstruction, error) {
Instruction: instruction,
}
if len(args) == 1 {
operand, err := strconv.ParseInt(args[1], 10, 64)
operand, err := strconv.ParseFloat(args[1], 64)
if err != nil {
return nil, fmt.Errorf("error while parsing operand for instruction '%s': %v", input, err)
}

Loading…
Cancel
Save