0

I'm trying to use std::numeric_limits<float>::epsilon() in c.

The description says

Returns the machine epsilon, that is, the difference between 1.0 and the next value representable by the floating-point type T.

How can I represent the identical value in c?

Zack Lee
  • 2,784
  • 6
  • 35
  • 77

1 Answers1

4

#include <float.h>

and use

FLT_EPSILON DBL_EPSILON LDBL_EPSILON

See here: http://www.cplusplus.com/reference/cfloat/

Brandon
  • 22,723
  • 11
  • 93
  • 186
  • 2
    My apologies, I was going off of Zack's quoted text, which is "the largest finite value that can be represented by the type", but that's not actually what `std::numeric_limits::epsilon()` is. `FLT_EPSILON` matches that, it just doesn't match the quoted text. – Lily Ballard Nov 06 '17 at 04:53
  • 1
    @KevinBallard I'm sorry it was my mistake. I just edited my post. – Zack Lee Nov 06 '17 at 04:56