fork download
  1. #include <stdio.h>
  2.  
  3. float funky_float_abs(float a);
  4.  
  5. int main(void) {
  6.  
  7. float temp = -1.333;
  8.  
  9. temp = funky_float_abs(temp);
  10. printf("%f", temp);
  11.  
  12. return 0;
  13. }
  14.  
  15.  
  16.  
  17. float funky_float_abs(float a)
  18. {
  19. unsigned int temp = *(unsigned int*)&a;
  20. temp = temp & 0x7fffffff;
  21. return *(float*)&temp;
  22. }
Success #stdin #stdout 0s 9424KB
stdin
Standard input is empty
stdout
1.333000