🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Swami Sangit Jivano Tue, 15 Dec 1992 23:02
Floating point problems with SCI international supplement.
#1557
Author: Swami Sangit Jivano
Date: Tue, 15 Dec 1992 23:02
56 lines
2240 bytes
PROBLEM:

We encountered floating point problems when we tried to compile the gcc
version 2.3.1 in a German language environment. 'rcc' as well as 'gcc'
generated wrong floating point constants into C-programs compiled
in environments using the (German) decimal comma instead of the (English)
decimal point.

One of the symptoms is, that the initial compiler generation will
hang up in the stage1 test of the floating point min and max values
(./enquire will loop).

The problem is exemplified with the following little test program:

	#include <stdio.h>
	int main()
	{  float a = 10.0;
	   printf("a=%f a/10=%f\n",a,a/10.0);
	}

which should output "10.000 and 1.000" but with one compiler outputs
"1.000 1.000" and with the other "10.000 10.000".


WHAT I THINK HAD HAPPENED:

Floating point literals in the program got not generated correctly -
sometimes (depending on the source-context) 1.0 was generated instead
of the given values.

The cause of this is the usage of 'strtod()' within the compilers
rcc and gcc to convert the external floating point literals to their
internal reperesentation. And this routine (as well as any routines relying
on it - like 'scanf()' etc.) is dependent on the actual decimal point
at run-time. 


MY TEMP FIX:

To circumvent the problem, specify English during compilations, like

	export LANG=english_us.8859

instead of (eg.)

	export LANG=german_germany.8859

A final solution will probably be available with the GNU runtime
library, I think. (And then just don't use the compiler switch
'-scointl' when compiling the gcc itself).


REMARKS:

If you happen to know, whether and when I can get the latest GNU
runtime libs for SCO 3.2v4, please do me a favour and send me a message.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads