Solved

# how to handle float numbers as keys to MAP containr?

Posted on 2011-02-17

Hi,

I read Data to my program, numbers like 1.3434 100.34 etc

I put them inside floats variables.

1.3434 can be stored in the memory as 1.3433999 or 1.3433998 etc.

1) I want to use these numbers as keys in a map container.

How can I do it?

For example I want to put 1.3434 as a key in a MAP container,When I do calculations I get this number as 1.34339998 so converting it to 1.3434 would not be easy because I have many data types and I need to check how many digits after the decimal point each one of them has.

2) Are there special libraries for Visual C++ 2010 to represent these numbers in a different form ? (not as floats)

Thanks