24 lines
441 B
Plaintext
24 lines
441 B
Plaintext
[code]
|
|
fn cast_f32_to_i32(x: f32) -> i32 {
|
|
return x as i32;
|
|
}
|
|
|
|
fn cast_f64_to_u64(x: f64) -> u64 {
|
|
return x as u64;
|
|
}
|
|
|
|
[harness]
|
|
#include <stdint.h>
|
|
|
|
extern int32_t cast_f32_to_i32(float x);
|
|
extern uint64_t cast_f64_to_u64(double x);
|
|
|
|
int main() {
|
|
if (cast_f32_to_i32(3.14f) != 3) return 1;
|
|
if (cast_f32_to_i32(-2.9f) != -2) return 2;
|
|
if (cast_f64_to_u64(42.999) != 42) return 3;
|
|
return 0;
|
|
}
|
|
|
|
[expected_return_code]
|
|
0 |