Sheer
2012-07-12 20:30:03 UTC
"Floats are inherently inexact because of the way they are stored internally. If you want exact precision, use decimal variables instead."
But how on earth do I declare fixed point decimal constants in C?And what's the format specifier for it? It's not in my book nor could I find any good answers on google.It takes me to an IBM site which only serves to confuse me more.
http://publib.boulder.ibm.com/infocenter/zos/v1r12/index.jsp?topic=%2Fcom.ibm.zos.r12.cbcpx01%2Fcbcpg1b0263.htm
It says we have to to declare a fixed point decimal like this "decimal(10,2) x;" and also we need to include a "decimal.h" header file.I tried on my Mingw compiler but it says there is no such header file and the "decimal(10,2) x;" thing shows error.The IBM site then says I need to tweak the compiler to enable the header file.DAMN.
So can you PLEASE tell me in simple words how to declare a fixed point decimal constant/variable in C.