将整数强转浮点数,取ln,然后再转回整数。用于hash-table。
求问有没有什么好的性质?
#include <bits/stdc++.h>
using namespace std;
unsigned int x;
inline unsigned int f(unsigned int x) {
float tmp = log(*(float *) &x);
return *(unsigned int *) &tmp;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> x;
cout << f(x);
return 0;
}