fork download
  1. #include <iostream>
  2. using namespace std;
  3. float f_abs(float a)
  4. {
  5. unsigned char* temp = (unsigned char *)&a;
  6. *(temp+3) &= 0x7f;
  7. return a;
  8. }
  9. int main() {
  10. cout << f_abs(-2.56789f);
  11. return 0;
  12. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
2.56789