Zack Lee
Zack Lee

Reputation: 3044

How do I convert std::numeric_limits<float>::epsilon() in c?

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?

Upvotes: 0

Views: 252

Answers (1)

Brandon
Brandon

Reputation: 23500

#include <float.h>

and use

FLT_EPSILON DBL_EPSILON LDBL_EPSILON

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

Upvotes: 4

Related Questions