[ create a new paste ] login | about

Link: http://codepad.org/pkYX1f3i    [ raw code | output | fork ]

C, pasted on Oct 8:
#include <stdio.h>
#include <assert.h>
#include <float.h>
#include <math.h>

int main() {
  
  float f;
  union {
    float f;
    unsigned int u32;
  } a, b;

  assert(sizeof(float) == 4);
  assert(sizeof(unsigned int) == 4);

  f = exp(1.0) + 1.0;
  a.f = f * (1.0 + FLT_EPSILON);
  b.f = f;
  b.u32 += 1;
  printf("%.10f\n%.10f\n", a.f, b.f);
  return 0;
}
/* end */


Output:
1
2
3.7182822227
3.7182819843


Create a new paste based on this one


Comments: