rustgym 0.2.0

rustgym solutions
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct Solution;

impl Solution {
    fn my_pow(x: f64, n: i32) -> f64 {
        x.powi(n)
    }
}

#[test]
fn test() {
    use assert_approx_eq::assert_approx_eq;
    assert_approx_eq!(Solution::my_pow(2.0, 10), 1024.0);
    assert_approx_eq!(Solution::my_pow(2.0, -3), 0.125);
    assert_approx_eq!(Solution::my_pow(1.0, -2_147_483_648), 1.0);
}