shahriar@island.COM (Shahriar Vaghar) (04/16/91)
/*
cc -mc68881 -elems881 -mc68020 unsigned.c
Link -w -c 'MPS ' -t 'MPST' unsigned.c.o 6
-sn STDIO=Main 6
-sn INTENV=Main 6
-sn %A5Init=Main 6
"{Libraries}"Stubs.o 6
"{CLibraries}"CLib881.o 6
"{CLibraries}"CRuntime.o 6
"{CLibraries}"StdCLib.o 6
"{CLibraries}"CInterface.o 6
"{CLibraries}"Math881.o 6
"{CLibraries}"CSANElib881.o 6
"{Libraries}"Interface.o 6
-o unsigned
The following program produces correct result when compiled with
MPW C 3.1. But produces wrong output when compiled with MPW C 3.2b1.
Mac IIfx running 6.05.
*/
#include <stdio.h>
unsigned char red[10];
unsigned char green[10];
main()
{
int v;
for (v = 0; v < 10; v++) {
double val;
val = ((double)v / 255.);
red[v] = (int) (255. * val); /* ???? */
green[v] = 255. * val; /* ???? */
fprintf(stderr,"red[%d] = %d", v, red[v]);
fprintf(stderr, " ");
fprintf(stderr,"green[%d] = %d", v, green[v]);
fprintf(stderr, "\n");
}
}
/* Output:
red[0] = 0 green[0] = 0
red[1] = 0 green[1] = 0
red[2] = 0 green[2] = 1
red[3] = 0 green[3] = 2
red[4] = 0 green[4] = 3
red[5] = 0 green[5] = 4
red[6] = 0 green[6] = 5
red[7] = 0 green[7] = 6
red[8] = 0 green[8] = 7
red[9] = 0 green[9] = 8
*/kevinh@cmi.com (Kevin Hegg) (04/17/91)
In 3.2 {CLibraries}CRuntime.o goes away and you just have
{Libraries}Runtime.o. Also, {CLibraries}CInterface.o goes away and you
just have {Libraries}Interface.o. This is all discussed in the 3.2 release
notes.
Kevin Hegg, EDS Corp - Center for Machine Intelligence
2001 Commonwealth Blvd., Ann Arbor, Michigan 48105
Phone: (313) 995-0900 Internet: kevinh@cmi.com Applelink: D5990mitch@Apple.COM (Mitch Adler) (04/24/91)
In article <3923@island.COM> shahriar@island.COM (Shahriar Vaghar) writes:
[ An example of a bad floating point conversions]
All version of MPW C 3.2 released to date have a bug in them with
regards to floating point conversion.
It has been fixed in the final version (you can get it Real Soon Now)
and will be on the next ETO CD.
--
Mitch Adler mitch@apple.com
Development Systems
Apple Computer, Inc. AppleLink: M.Adler
Claimer: These are MY opinions, not Darin's, not Apple's! MINE!