Question about numeric formats

Steve Resnick stever at Octopus.COM
Tue Nov 13 06:26:53 AEST 1990



Hello Netlanders!

	I have a question for you all (geez, does this guy ever stop asking
	questions?) :)

	I have a program where I deal with data using 2 decimal places. I
	am trying to avoid using IEEE floating point (due to lack of
	precision [when 1 != 1 it gets hairy]) The numbers I need to
	deal with are in the range of -99999.99 - +99999.99. What I
	have come up with is a format which, essentially, takes these
	numbers from a float, multiplies by 1000 and stores them in
	a 31bit long. (MSB is used for the sign). This gives me a
	precision of one place beyond my requirement of two, and
	leaves me with a "hard" number. No quessing or approximations.

	What I want to know is, are there any pitfalls to this meathod?
	Has anyone else implemented anything similar?

	Any opinions are welcome [asbestos suit intact! :)]

	Please respond via E-mail to apple!camphq!105!steve.resnick
	as I don't normally read this group (comp.lang.c), due to the
	sheer volume.

	Thanx, in advance,
	Steve

	
-- 
----------------------------------------------------------------------------
steve.resnick at f105.n143.z1.FIDONET.ORG - or - apple!camphq!105!steve.resnick
Flames, grammar errors, spelling errrors >/dev/nul
The Asylum OS/2 BBS - (408)263-8017 IFNA 1:143/105.0



More information about the Comp.lang.c mailing list