From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-03-07 00:20:12
On Thu, Mar 06, 2003 at 02:58:28PM -0800, Shawn Jefferson wrote: > Wouldn't/Couldn't it be possible to implement some standard routines for > floating point math that the compiler knows about, but could either be > implemented with machine specific calls (the Atari has floating point routines > in ROM and I guess from what you guys have been saying the C64 does too.) That would be... * ...ineffective. For example checking the sign of a fp variable is quite easy, so generating a call to a subroutine is overkill. However, the compiler needs to know the format used. * ...difficult and messy. How should the compiler generate floating point data if the format is not known? One solution would be to implement several fp formats in the compiler and switch them with the -t option, but this means that each target platform needs changes in the compiler. * ...standard violating. The standard requires that the compiler uses the same rules as the target platform when calculating floating point results. The result of double a = 1.0 / 3.0; /* Evaluated at compile time */ must be the same as double a = 1.0; double b = 3.0; ... double c = a / b; /* Evaluated at runtime */ So either the compiler would reimplement all ROM routines for all existing platforms or it would violate the standard. > That > would cut down on the amount of code required to support floating point, but > those targets without ROM routines would have to have their own code. As I see it, it would effectively require a lot more code, both in the compiler and in the library. There are machines without floating point, so floating point library subroutines are needed anyway. In addition, platforms with fp support in ROM need wrappers. And, much more code in the compiler is needed (see above). More problems: * Binary data cannot be exchanged between the platforms if it contains floats. * On several platforms, the ROMs containing the fp routines are banked out (examples are the C64 and the Plus/4). A lot of additional effort is needed when calling fp routines in these systems. So you're writing much more code for this solution, and it is not even a better one. Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-03-07 00:20:21 CET