On Tue, 2006-04-25 at 09:22 -0700, jshayden wrote: > Using the c18 libraries, does anyone have an example of using the math > functions in math.h. I'm am getting trash output. I thought it returned > IEEE floating point, but it doesn't appear to. Not even the sign bit is > correct. Here is a basic example I've tried working with. > > #include > #include > > void main(void) > { > > float_t x = 3.14; > float_t z; > > z = cos(x); > > } > > > z's output is as follows... > 00110110 11010110 11111011 00010110 > ...which is nowhere close to -1. What do you expect to see for -1 ? In a floating point format I would expect to see something representing -0.5 * 2^1 (2^1 being 2 raised to the power 1). Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist