Skip to content

runtime error when formatting a large int64 #1254

@nrwiersma

Description

@nrwiersma

Hi,

I am getting a weird runtime error when formatting a large int64 using strconv.FormatInt on my Arduino Nano. This problem does not exist in Go. I am using go version go1.14.5 darwin/amd64.

The following code snippet consistently produces the issue.

package main

import (
	"strconv"
	"time"
)

func main() {
	for {
		var now int64 = 6854775807
		println(strconv.FormatInt(now, 10))

		time.Sleep(time.Second)
	}
}

Output:

panic: runtime error: index out of range
panic: runtime error: index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions