Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question On Floating Point In Gcc For Solaris Sparc

2 views
Skip to first unread message

Thomas Dineen

unread,
Sep 25, 2007, 2:13:57 PM9/25/07
to
Gentle people:

A question: in Gcc for Solaris Sparc is there any initialization
required previous to the execution of Floating Point Instructions
in a program?

Inspection of the _start function implies that there is! Can anybody
explain the details?

Thanks for the help.
Thomas Dineen

Dave (from the UK)

unread,
Sep 26, 2007, 2:41:10 AM9/26/07
to

What do you mean by 'initialization'? Here's a program that does a bit
of floating point maths. Nothing more/less than one would have in any
other C program. I must be missing the point somewhere.

sparrow /export/home/drkirkby % cat test.c

#include <stdio.h>
#include <math.h>
main() {
printf("The sine of 45 degrees is %lf\n",sin(45*M_PI/180));
}

sparrow /export/home/drkirkby % gcc -lm test.c
sparrow /export/home/drkirkby % ./a.out
The sine of 45 degrees is 0.707107


--
Dave (from the UK)

Please note my email address changes periodically to avoid spam.
It is always of the form: month...@althorne.org
Hitting reply will work for a few months only - later set it manually.

http://chessdb.sourceforge.net/ - a Free open-source Chess Database

Paul Floyd

unread,
Sep 26, 2007, 3:29:33 PM9/26/07
to
["Followup-To:" header set to comp.unix.solaris.]

On Tue, 25 Sep 2007 11:13:57 -0700, Thomas Dineen <tjjd...@comcast.net> wrote:
> Gentle people:
>
> A question: in Gcc for Solaris Sparc is there any initialization
> required previous to the execution of Floating Point Instructions
> in a program?
>
> Inspection of the _start function implies that there is! Can anybody
> explain the details?

Much depends on which "instructions" you are going to be using.
I'm not sure where your "_start" function comes from. Please explain
further.

In general, I wouldn't be surprised if mathematical libraries (including
libm) require some initialization. But that should be all taken care of
under the covers. For everyday maths, you shouldn't need to do anything.

A bientot
Paul
--
Paul Floyd http://paulf.free.fr

0 new messages