diff --git a/hal/instructions.go b/hal/instructions.go index 2b89143..627cfec 100644 --- a/hal/instructions.go +++ b/hal/instructions.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) } diff --git a/parser/program_parser.go b/parser/program_parser.go index dcffe0c..861c43e 100644 --- a/parser/program_parser.go +++ b/parser/program_parser.go @@ -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) }