Subj : Re: Any help on why? To : borland.public.cpp.borlandcpp From : waking Date : Thu Jul 08 2004 07:29 am On Wed, 07 Jul 2004 13:45:43 -0700, Bob Gonder wrote: >>In fortran I can map an array of integers on top of an array of >>floating point. >>Is there a similar operation within C ? > >See union. But be forewarned (from the BC++ 5.02 and Builder help): ================================================= 3.1.2.5 The representations and sets of values of the various types of floating-point numbers. The IEEE floating-point formats as used by the Intel 8087 are used for all Borland C++ floating-point types. The float type uses 32-bit IEEE real format. The double type uses 64-bit IEEE real format. The long double type uses 80-bit IEEE extended real format. [snip] 3.3.2.3 What happens when a member of a union object is accessed using a member of a different type. The access is allowed and the different type member will access the bits stored there. You’ll need a detailed understanding of the bit encodings of floating-point values to understand how to access a floating-type member using a different member. If the member stored is shorter than the member used to access the value, the excess bits have the value they had before the short member was stored. ============================================================= >printf( "%LI", number.i ); Upper case "I"? If so inclined, you might also experiment with: printf("%I64d", number.i); printf("%I64X", number.i); and: char *_i64toa(__int64 value, char *strP, int radix); char *_ui64toa(unsigned __int64 value, char *strP, int radix); using a radix of 16 (and also radix 2). Of the BC++ line, only 5.02 supports these for 32-bit targets. None of the above can be used with any 16-bit compiler. None of the above are ANSI-compliant. (Haven't checked C99.) -- Wayne A. King (waking@idirect.com, Wayne_A_King@compuserve.com) .