Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!relay.nswc.navy.mil!oasys!mimsy!mimsy.umd.edu!brianj From: brianj@witsend.cs.umd.edu (Brian Johnson) Newsgroups: comp.sys.mac.programmer Subject: Can't Print Double Precision Floats Message-ID: Date: 6 May 91 02:47:17 GMT Sender: news@mimsy.umd.edu Distribution: comp Organization: University of Maryland Computer Science Lines: 41 I'm trying to print a double precision floating point value to Think C's console window. The number (usually around 3.xxe10) shows up fine in the debugger, but I can't print it out. I've tried every combination of formatting options that I can think of. My other problem is getting the square root of this value. Can anyone let me know how? I've never used SANE, do I need to? If someone could send me a couple of lines of working code to do these things I'd be eternally grateful. These don't work: printf("SumSquared: %Le", (double) theData[0][LEAFNODE][SIZE].sumsquare); printf("SumSquared: %Le", (float) theData[0][LEAFNODE][SIZE].sumsquare); printf("SumSquared: %Lg", theData[0][LEAFNODE][SIZE].sumsquare); ---------------------------- Working code ------------------------------ typedef struct { short number; double sum; long average; double sumsquare; double sd; /* standard deviation */ long min; long max; } VARIABLES; printf("N:% d \t Sum:% ld \t Ave:% ld \t Min:% ld \t Max:% ld\n", theData[i][j][SIZE].number, (long) theData[i][j][k].sum, (long) theData[i][j][k].average, (long) theData[i][j][k].min, (long) theData[i][j][k].max); ---------------------------- Working code ------------------------------ -- Brian Johnson Computer Science Department brianj@cs.umd.edu University of Maryland (301) 405-2725 College Park, Md 20742