SyntaxFix
Write A Post
Hire A Developer
Questions
int sign(float n) { union { float f; std::uint32_t i; } u { n }; return 1 - ((u.i >> 31) << 1); }
This function assumes: