Skip to content

rust: pow does not work as is #551

Open
@alekssamos

Description

@alekssamos

python:

def asdf(a:int, b:int)->int:
    x:int = a**b
    return x

after conversion to rust:

pub fn asdf(a: i32, b: i32) -> i32 {
    let x: i32 = pow(a, b);
    return x;
}

But in this form, the code did not work. With error messages and explanations I wrote this:

pub fn asdf(a: u32, b: u32) -> u32 {
    let x: u32 = u32::pow(a, b);
    return x;
}

And then everything was fine. Everything worked well!

Can this be fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions