Skip to content

float64 conversion: invalid operation #1316

@peterGo

Description

@peterGo
package main

func exp2(x uint64) float64 {
    // valid operations
    e := uint64(1) << x
    return float64(e)
    f := uint64(1 << x)
    return float64(f)
    return float64(uint64(1 << x))
    // 11: invalid operation: 1 << x (shift of type float64)
    return float64(uint64(1) << x)
}

The two sets of operations should be equivalent. The first set of operations is
accepted, the second is improperly rejected.

hg id d3e867d23e3e+ tip, 6g, linux, amd64.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions