[comp.unix.microport] floating point under Microport

mike@cimcor.mn.org (Michael Grenier) (12/10/88)

OK, if this is a compiler bug, I might finally admit that
SCO is better (and it will hurt too!).

I'm trying to print a floating point number and it gives me the old
core dump problems people have mention here.

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


Does this work on anyone's 286?
I didn't look real hard but the assembly language was reasonable other
than the inefficient use of fwait. The sdb debugger was hopeless...why
can't it trap a floating exception instead of giving me a core dump
of the debugger?

Has anyone attempted to port GCC over to this brain dead 16 bit
architecture?

Better yet, can anyone recommend a cheap way to upgrade to a 80386
processor? Awhile back people were talking about using a 386SX with
a PAL on a small board which could be placed into the 286 socket...
Anyone know of such a thing?
I've seen motherboards now under $1000 which is tempting.

     -Mike Grenier
     mike@cimcor.mn.org
      uunet!rosevax!cimcor!mike
      {anybody whose anybody}!bungia!cimcor!mike

john@wa3wbu.UUCP (John Gayman) (12/10/88)

In article <612@cimcor.mn.org>, mike@cimcor.mn.org (Michael Grenier) writes:
> OK, if this is a compiler bug, I might finally admit that
> SCO is better (and it will hurt too!).
> 
> #include <stdio.h>
> main()
> {
> 	float a;
> 	a=2.0;
> 	printf("%f\n",a);
> }
> 
> 
> Does this work on anyone's 286?


     I'm not a C-guru so don't flame me but what is this code supposed to
do if it works properly ?  I compiled this code two different ways on my
Sys V/AT 2.3U system.

	1. cc -o test test.c -lm
	2. cc -o test test.c

     When I run test, it just returns the cursor. No error, no nothing.
Is this correct ?  I've tried supplying an argument to "test" and it
still just returns the cursor. I might add that my machine has a 80287
installed.


					John



-- 
John Gayman, WA3WBU              |           UUCP: uunet!wa3wbu!john
1869 Valley Rd.                  |           ARPA: john@wa3wbu.uu.net 
Marysville, PA 17053             |           Packet: WA3WBU @ AK3P 

debra@alice.UUCP (Paul De Bra) (12/11/88)

In article <711@wa3wbu.UUCP> john@wa3wbu.UUCP (John Gayman) writes:
]In article <612@cimcor.mn.org>, mike@cimcor.mn.org (Michael Grenier) writes:
]> [correct c-program deleted]
]
]     I'm not a C-guru so don't flame me but what is this code supposed to
]do if it works properly ?  I compiled this code two different ways on my
]Sys V/AT 2.3U system.
]
]	1. cc -o test test.c -lm
]	2. cc -o test test.c
]
]     When I run test, it just returns the cursor. No error, no nothing.
]Is this correct ?  I've tried supplying an argument to "test" and it
]still just returns the cursor. I might add that my machine has a 80287
]installed.
]
OK, here is lessen 1 in C-programming on Unix:

Never call your program "test".

test is a shell built-in and also a program in /bin (for shells which
might not have test as a built in...

So please try again with another name. This program should really work.

Paul.
-- 
------------------------------------------------------
|debra@research.att.com   | uunet!research!debra     |
------------------------------------------------------

wietse@wzv.UUCP (Wietse Z. Venema) (12/11/88)

In article <612@cimcor.mn.org|, mike@cimcor.mn.org (Michael Grenier) writes:
| OK, if this is a compiler bug, I might finally admit that
| SCO is better (and it will hurt too!).
| 
| #include <stdio.h>
| main()
| {
| 	float a;
| 	a=2.0;
| 	printf("%f\n",a);
| }
| 
| 
| Does this work on anyone's 286?

On an AT clone, no 80287, running Uport 2.3 the program prints 2.000000
as it should. 
-- 
work:	wswietse@eutrc3.uucp	| Eindhoven University of Technology
work:	wswietse@heitue5.bitnet	| Mathematics and Computing Science
home:	wietse@wzv.uucp		| 5600 MB Eindhoven, The Netherlands

phile@lgnp1.LS.COM (Phil Eschallier) (12/12/88)

In article <612@cimcor.mn.org>, mike@cimcor.mn.org (Michael Grenier) writes:
> OK, if this is a compiler bug, I might finally admit that
> SCO is better (and it will hurt too!).

	well i am an ex-uport user and now a sco xenix user
	but i will talk to you anyway.

> I'm trying to print a floating point number and it gives me the old
> core dump problems people have mention here.
> 
> #include <stdio.h>
> main()
> {
> 	float a;
> 	a=2.0;
> 	printf("%f\n",a);
> }
> 
> Does this work on anyone's 286?

	i typed this in (as new.c) on a uport sys v/at system
	which lives down the street from me and it worked fine.
	(i believe it is release 2.3).
	i used:
		cc -o new new.c


	phil eschallier

phile@lgnp1.LS.COM (Phil Eschallier) (12/12/88)

In article <711@wa3wbu.UUCP>, john@wa3wbu.UUCP (John Gayman) writes:
> In article <612@cimcor.mn.org>, mike@cimcor.mn.org (Michael Grenier) writes:
> > #include <stdio.h>
> > main()
> > {
> > 	float a;
> > 	a=2.0;
> > 	printf("%f\n",a);
> > }
> > Does this work on anyone's 286?
>      I'm not a C-guru so don't flame me but what is this code supposed to
> do if it works properly ?  I compiled this code two different ways on my
> Sys V/AT 2.3U system.
> 	1. cc -o test test.c -lm
> 	2. cc -o test test.c
>      When I run test, it just returns the cursor. No error, no nothing.
> Is this correct ?


	no this is not correct!

	you should note that "test" is a built in shell function
	so when you enter "test" at the shell prompt, that is what
	you are using.  you may either use "./test" or name the
	little program just about anything else.


--
	phil eschallier


				sorry, but no fancy .signature

john@wa3wbu.UUCP (John Gayman) (12/12/88)

In article <612@cimcor.mn.org>, mike@cimcor.mn.org (Michael Grenier) writes:
> OK, if this is a compiler bug, I might finally admit that
> SCO is better (and it will hurt too!).
> 
> #include <stdio.h>
> main()
> {
> 	float a;
> 	a=2.0;
> 	printf("%f\n",a);
> }
> 
> 
> Does this work on anyone's 286?


       I had previously reported that I compiled this code and the resultant
code ran but just returned the $ prompt. Well unfortunately I compiled
this as "test" and someone was kind enough to point out that I was
unknowingly running the Unix "test" utility. (Can you say DUMB?) :-)

       In any event, recognizing the errors of my ways I have correctly
named this file something obscure and re-ran the tests. Compiling the
code both with SMALL and LARGE models yeilds the results "2.000000". 
No hangs, no core dumps. I am running 2.3U on an 8 Mhz machine and
I do have a 80287 installed. 

       I ran the compile with each model because someone had suggested
that the problem only turned up in the Large memory model. I don't
know what to say, it works here.


						John



-- 
John Gayman, WA3WBU              |           UUCP: uunet!wa3wbu!john
1869 Valley Rd.                  |           ARPA: john@wa3wbu.uu.net 
Marysville, PA 17053             |           Packet: WA3WBU @ AK3P 

bill@bilver.UUCP (bill vermillion) (12/13/88)

In article <711@wa3wbu.UUCP< john@wa3wbu.UUCP (John Gayman) writes:
<
<
<     I'm not a C-guru so don't flame me but what is this code supposed to
<do if it works properly ?  I compiled this code two different ways on my
<Sys V/AT 2.3U system.
<
<	1. cc -o test test.c -lm
<	2. cc -o test test.c
<
<     When I run test, it just returns the cursor. No error, no nothing.
<Is this correct ?  I've tried supplying an argument to "test" and it
<still just returns the cursor. I might add that my machine has a 80287
<installed.
<
Test is a shell command.  When you type test, you are getting the shell
program with no arguments passed to it, and thus you get your prompt back.
Try compiling your program with another name other than test and it will
probably work just fine.  I did this too the first time I ever got into a
Unix environment.

Try cc -o foo test.c
then
$ foo


-- 
Bill Vermillion - UUCP: {uiucuxc,hoptoad,petsd}!peora!rtmvax!bilver!bill
                      : bill@bilver.UUCP

mjy@sdti.SDTI.COM (Michael J. Young) (12/13/88)

In article <612@cimcor.mn.org> mike@cimcor.mn.org (Michael Grenier) writes:
>OK, if this is a compiler bug, I might finally admit that
>SCO is better (and it will hurt too!).
> ...
>
>Does this work on anyone's 286?
>I didn't look real hard but the assembly language was reasonable other
>than the inefficient use of fwait. The sdb debugger was hopeless...why
>can't it trap a floating exception instead of giving me a core dump
>of the debugger?

% cc -o tst1 tst1.c
% tst1
2.000000
% cc -Ml -o tst1 tst1.c
% tst1
2.000000
% 

Rest easy.  Don't hurt yourself.

I'm using the version 2.4, by the way.

>Better yet, can anyone recommend a cheap way to upgrade to a 80386
>processor? Awhile back people were talking about using a 386SX with
>a PAL on a small board which could be placed into the 286 socket...
>Anyone know of such a thing?

I've seen an announcement about a company called Aox that's developing
a 386SX daughter board for under $500.  It even has a small memory cache
on board to increase the speed.  It is supposed to deliver about 90% of
the throughput of a 16-MHz 386.

Unfortunately, it won't be available till sometime next year.  Plenty
of time for them to hike the price a few times :-(.
-- 
Mike Young
Software Development Technologies, Inc., Sudbury MA       Tel: +1 508 443 5779
Internet: mjy@sdti.sdti.com                 UUCP: {harvard,mit-eddie}!sdti!mjy

terry@eecea.eece.ksu.edu (Terry Hull) (12/14/88)

In article <330@bilver.UUCP> bill@bilver.UUCP (bill vermillion) writes:
>In article <711@wa3wbu.UUCP< john@wa3wbu.UUCP (John Gayman) writes:
    [Stuff Deleted]
><
><	1. cc -o test test.c -lm
><	2. cc -o test test.c

><     When I run test, it just returns the cursor. No error, no nothing.
><Is this correct ?  I've tried supplying an argument to "test" and it
><still just returns the cursor. I might add that my machine has a 80287
><installed.

>Test is a shell command.  When you type test, you are getting the shell
>program with no arguments passed to it, and thus you get your prompt back.

  [Good Solution deleted]

Yes, I too did this the first time I tried compiling a test progrm on
a UNIX system.  Unfortunately, there was not one around to help me.
I have since converted to exp for my "experiments" to avoid the
problem, but before I did that I discovered if you have an executable
in your current directory named test you can execute it using the
command 

$ ./test

Good Luck.

-- 
Terry Hull                    Department of Electrical and Computer Engineering
                                           Kansas State University
INTERNET: terry@eecea.eece.ksu.edu          Manhattan, KS  66502 
UUCP: rutgers!ksuvax1!eecea!terry