Re: [GD-General] The joy of type aliasing and C
Brought to you by:
vexxed72
From: Brian H. <ho...@py...> - 2003-12-31 01:39:31
|
> Surely, most hardware cannot work with float16 natively, but it is > still useable for lossy compression of some data. As long as I > define what I want my float16 to look like, it is not less portable > than any other user defined type. Sure. > Generally, trying to look at a float as if it's some kind of a > black box that stores real numbers, is kinda silly. I think this depends entirely on the application's domain. A lot of applications will merrily use a float and perform floating point operations and have no care at all whether the underlying implementation is IEEE-754 or some freakish VAX implementation. > You have to be > aware of its internal representation, or you can't work with it > (without getting yourself into various precision losses, etc). You can inspect an implementation's internal representation by using <float.h> and inspecting the associated predefined constants. These are a part of the C standard and must exist on all implementations that claim to adhere to it. These will give you the min, max, radix (FLT_RADIX), precision in digits (FLT_DIG), etc. I feel so ashamed for knowing this stuff... Brian |