You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nudt-compiler-cpp/test_float_full.sy

31 lines
496 B

float test_float(float x, int y) {
float z = x * 2.5;
float w = y + z; // 隐式转换 int -> float
return w / 3.0;
}
int main() {
float a = 1.5;
float b = 2.5;
// 浮点运算
float c = a + b;
float d = a - b;
float e = a * b;
float f = a / b;
// 浮点比较
int g = a < b;
int h = a == b;
// 一元运算
float i = -a;
int j = !a;
// 混合运算(隐式转换)
int k = 10;
float m = k + a;
return 0;
}