www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/01/06:31:11

From: billlanam AT california DOT com (Bill Lanam)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: square root
Date: Fri, 31 Jan 1997 22:43:06 GMT
Message-ID: <32f27394.47510@seashell.california.com>
References: <N DOT 013197 DOT 201829 DOT 12 AT hrv2-5 DOT worldaccess DOT nl>
NNTP-Posting-Host: 140.174.210.157
Lines: 42
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Fri, 31 Jan 97 19:18:29 GMT, frabb AT worldaccess DOT nl wrote:

>I am trying to compiloe this program:
>
>/* find out about sqrt */
>#include <stdio.h>
#include <math.h>

>
>main()
>{
>long double dest, srce = 2.0;
>dest = sqrt(srce);
>printf("%.18Lf\n",dest);
>asm ("fsqrt %1,%0" : "=f" (dest) :  "f" (srce));
change asm line to following
asm (
"fldt %1\n\t"
"fsqrt\n\t"
"fstpt %0"
: "=m" (dest)
: "m" (srce));

>printf("%.18Lf\n",dest);
>}
>
>
>There is an error in the asm line, but I can't find it. And yes, I did try to 
>find it in Info, and in the faq.
>
>The purpose of the program is to see if there is a difference in the two ways 
>to do sqrt. A call to sqrt() gives a double result. Using the hardware FPP 
>instruction fsqrt directly should produce a long double. 
>Maybe I should download the library sources, but 20:15 hours is a very bad time 
>to do so...
>
>frank abbing.
>
I wasn't able to get the compiler to store the destination using a register
constraint so I used the memory constraint with explicit load and stores.

    Bill Lanam

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019