Re: The joy of type aliasing and C

Brian Hook <[email protected]>
Newsgroups gmane.games.devel.general
Message-ID <20031230203921.423306@GATEWAY>
> 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





-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_idU7
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.