mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
Changed .s files to .c files with gcc asm.
svn path=/trunk/; revision=300
This commit is contained in:
parent
ad037179b4
commit
98071efc7e
44 changed files with 564 additions and 529 deletions
|
@ -1,22 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.text
|
|
||||||
LC0:
|
|
||||||
.double 0d1.00000000000000000000e+00
|
|
||||||
|
|
||||||
.globl _acos
|
|
||||||
_acos:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fld1
|
|
||||||
fsubp %st(0),%st(1)
|
|
||||||
fsqrt
|
|
||||||
|
|
||||||
fldl 4(%esp)
|
|
||||||
fld1
|
|
||||||
faddp %st(0),%st(1)
|
|
||||||
fsqrt
|
|
||||||
|
|
||||||
fpatan
|
|
||||||
|
|
||||||
fld %st(0)
|
|
||||||
faddp
|
|
||||||
ret
|
|
26
reactos/lib/crtdll/math/acos.c
Normal file
26
reactos/lib/crtdll/math/acos.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
double acos (double __x)
|
||||||
|
{
|
||||||
|
return atan2 (sqrt (1.0 - __x * __x), __x);
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
double
|
|
||||||
acosh(double x)
|
|
||||||
{
|
|
||||||
return log(x + sqrt(x*x - 1));
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _asin
|
|
||||||
_asin:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fld %st(0)
|
|
||||||
fmulp
|
|
||||||
fld1
|
|
||||||
fsubp
|
|
||||||
fsqrt
|
|
||||||
fldl 4(%esp)
|
|
||||||
fxch %st(1)
|
|
||||||
fpatan
|
|
||||||
ret
|
|
||||||
|
|
26
reactos/lib/crtdll/math/asin.c
Normal file
26
reactos/lib/crtdll/math/asin.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
double asin (double __x)
|
||||||
|
{
|
||||||
|
return atan2 (__x, sqrt (1.0 - __x * __x));
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
double
|
|
||||||
asinh(double x)
|
|
||||||
{
|
|
||||||
return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _atan
|
|
||||||
_atan:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fld1
|
|
||||||
fpatan
|
|
||||||
ret
|
|
||||||
|
|
32
reactos/lib/crtdll/math/atan.c
Normal file
32
reactos/lib/crtdll/math/atan.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
double atan (double __x);
|
||||||
|
|
||||||
|
double atan (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fld1\n\t"
|
||||||
|
"fpatan"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,35 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
.align 2
|
|
||||||
nan:
|
|
||||||
.long 0xffffffff
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0xff
|
|
||||||
.byte 0x7f
|
|
||||||
|
|
||||||
.text
|
|
||||||
.globl _atan2
|
|
||||||
_atan2:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fldl 12(%esp)
|
|
||||||
ftst
|
|
||||||
fnstsw %ax
|
|
||||||
sahf
|
|
||||||
jne doit
|
|
||||||
fxch %st(1)
|
|
||||||
ftst
|
|
||||||
fnstsw %ax
|
|
||||||
sahf
|
|
||||||
je isanan
|
|
||||||
fxch %st(1)
|
|
||||||
doit:
|
|
||||||
fpatan
|
|
||||||
ret
|
|
||||||
isanan:
|
|
||||||
movl $1,_errno
|
|
||||||
fstp %st(0)
|
|
||||||
fstp %st(0)
|
|
||||||
fldl nan
|
|
||||||
ret
|
|
||||||
|
|
12
reactos/lib/crtdll/math/atan2.c
Normal file
12
reactos/lib/crtdll/math/atan2.c
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
double atan2 (double __y, double __x);
|
||||||
|
|
||||||
|
double atan2 (double __y, double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fpatan\n\t"
|
||||||
|
"fldl %%st(0)"
|
||||||
|
: "=t" (__value) : "0" (__x), "u" (__y));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
double
|
|
||||||
atanh(double x)
|
|
||||||
{
|
|
||||||
return log((1+x)/(1-x)) / 2.0;
|
|
||||||
}
|
|
10
reactos/lib/crtdll/math/cabs.c
Normal file
10
reactos/lib/crtdll/math/cabs.c
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
double _cabs( struct _complex z )
|
||||||
|
{
|
||||||
|
return hypot(z.x,z.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _ceil
|
|
||||||
_ceil:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp,%ebp
|
|
||||||
subl $8,%esp /* -4 = old CW, -2 = new CW */
|
|
||||||
|
|
||||||
fstcw -4(%ebp)
|
|
||||||
fwait
|
|
||||||
movw -4(%ebp),%ax
|
|
||||||
andw $0xf3ff,%ax
|
|
||||||
orw $0x0800,%ax
|
|
||||||
movw %ax,-2(%ebp)
|
|
||||||
fldcww -2(%ebp)
|
|
||||||
|
|
||||||
fldl 8(%ebp)
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcww -4(%ebp)
|
|
||||||
|
|
||||||
movl %ebp,%esp
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
15
reactos/lib/crtdll/math/ceil.c
Normal file
15
reactos/lib/crtdll/math/ceil.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
double ceil (double __x);
|
||||||
|
|
||||||
|
double ceil (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__volatile unsigned short int __cw, __cwtmp;
|
||||||
|
|
||||||
|
__asm __volatile ("fnstcw %0" : "=m" (__cw));
|
||||||
|
__cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */
|
||||||
|
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
|
||||||
|
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
|
||||||
|
__asm __volatile ("fldcw %0" : : "m" (__cw));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
L0:
|
|
||||||
.quad 0xffffffffffffffff
|
|
||||||
|
|
||||||
.globl _cos
|
|
||||||
_cos:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fcos
|
|
||||||
fstsw
|
|
||||||
sahf
|
|
||||||
jnp L1
|
|
||||||
fstp %st(0)
|
|
||||||
fldl L0
|
|
||||||
L1:
|
|
||||||
ret
|
|
||||||
|
|
11
reactos/lib/crtdll/math/cos.c
Normal file
11
reactos/lib/crtdll/math/cos.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
double cos (double __x);
|
||||||
|
|
||||||
|
double cos (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fcos"
|
||||||
|
: "=t" (__value): "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
double cosh(double x)
|
|
||||||
{
|
|
||||||
const double ebig = exp(fabs(x));
|
|
||||||
return (ebig + 1.0/ebig) / 2.0;
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
LCW1:
|
|
||||||
.word 0
|
|
||||||
LCW2:
|
|
||||||
.word 0
|
|
||||||
LC0:
|
|
||||||
.double 0d1.0e+00
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.globl _exp
|
|
||||||
_exp:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fldl2e
|
|
||||||
fmulp
|
|
||||||
fstcww LCW1
|
|
||||||
fstcww LCW2
|
|
||||||
fwait
|
|
||||||
andw $0xf3ff,LCW2
|
|
||||||
orw $0x0400,LCW2
|
|
||||||
fldcww LCW2
|
|
||||||
fldl %st(0)
|
|
||||||
frndint
|
|
||||||
fldcww LCW1
|
|
||||||
fxch %st(1)
|
|
||||||
fsub %st(1),%st
|
|
||||||
f2xm1
|
|
||||||
faddl LC0
|
|
||||||
fscale
|
|
||||||
fstp %st(1)
|
|
||||||
ret
|
|
42
reactos/lib/crtdll/math/exp.c
Normal file
42
reactos/lib/crtdll/math/exp.c
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double exp (double __x);
|
||||||
|
|
||||||
|
double exp (double __x)
|
||||||
|
{
|
||||||
|
register double __value, __exponent;
|
||||||
|
__asm __volatile__
|
||||||
|
("fldl2e # e^x = 2^(x * log2(e))\n\t"
|
||||||
|
"fmul %%st(1) # x * log2(e)\n\t"
|
||||||
|
"fstl %%st(1)\n\t"
|
||||||
|
"frndint # int(x * log2(e))\n\t"
|
||||||
|
"fxch\n\t"
|
||||||
|
"fsub %%st(1) # fract(x * log2(e))\n\t"
|
||||||
|
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
|
||||||
|
: "=t" (__value), "=u" (__exponent) : "0" (__x));
|
||||||
|
__value += 1.0;
|
||||||
|
__asm __volatile__
|
||||||
|
("fscale"
|
||||||
|
: "=t" (__value) : "0" (__value), "u" (__exponent));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _fabs
|
|
||||||
_fabs:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fabs
|
|
||||||
ret
|
|
32
reactos/lib/crtdll/math/fabs.c
Normal file
32
reactos/lib/crtdll/math/fabs.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double fabs (double __x);
|
||||||
|
|
||||||
|
double fabs (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fabs"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _floor
|
|
||||||
_floor:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp,%ebp
|
|
||||||
subl $8,%esp /* -4 = old CW, -2 = new CW */
|
|
||||||
|
|
||||||
fstcw -4(%ebp)
|
|
||||||
fwait
|
|
||||||
movw -4(%ebp),%ax
|
|
||||||
andw $0xf3ff,%ax
|
|
||||||
orw $0x0400,%ax
|
|
||||||
movw %ax,-2(%ebp)
|
|
||||||
fldcww -2(%ebp)
|
|
||||||
|
|
||||||
fldl 8(%ebp)
|
|
||||||
frndint
|
|
||||||
|
|
||||||
fldcww -4(%ebp)
|
|
||||||
|
|
||||||
movl %ebp,%esp
|
|
||||||
popl %ebp
|
|
||||||
ret
|
|
||||||
|
|
36
reactos/lib/crtdll/math/floor.c
Normal file
36
reactos/lib/crtdll/math/floor.c
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double floor (double __x);
|
||||||
|
|
||||||
|
double floor (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__volatile unsigned short int __cw, __cwtmp;
|
||||||
|
|
||||||
|
__asm __volatile ("fnstcw %0" : "=m" (__cw));
|
||||||
|
__cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */
|
||||||
|
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
|
||||||
|
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
|
||||||
|
__asm __volatile ("fldcw %0" : : "m" (__cw));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,29 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
LCW1:
|
|
||||||
.word 0
|
|
||||||
.align 4
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.globl _fmod
|
|
||||||
_fmod:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fldl 12(%esp)
|
|
||||||
ftst
|
|
||||||
fnstsw %ax
|
|
||||||
fxch %st(1)
|
|
||||||
sahf
|
|
||||||
jnz next
|
|
||||||
fstpl %st(0)
|
|
||||||
jmp out
|
|
||||||
next:
|
|
||||||
fpreml
|
|
||||||
fnstsw %ax
|
|
||||||
sahf
|
|
||||||
jpe next
|
|
||||||
fstpl %st(1)
|
|
||||||
out:
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
35
reactos/lib/crtdll/math/fmod.c
Normal file
35
reactos/lib/crtdll/math/fmod.c
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double fmod (double __x, double __y);
|
||||||
|
|
||||||
|
double fmod (double __x, double __y)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("1: fprem\n\t"
|
||||||
|
"fstsw %%ax\n\t"
|
||||||
|
"sahf\n\t"
|
||||||
|
"jp 1b"
|
||||||
|
: "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,32 +1,31 @@
|
||||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
/* Math functions for i387.
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
#include <math.h>
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
double
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
ldexp(double v, int e)
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
double ldexp (double __x, int __y);
|
||||||
|
|
||||||
|
double ldexp (double __x, int __y)
|
||||||
{
|
{
|
||||||
double two = 2.0;
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fscale"
|
||||||
|
: "=t" (__value) : "0" (__x), "u" ((double) __y));
|
||||||
|
|
||||||
if (e < 0)
|
return __value;
|
||||||
{
|
|
||||||
e = -e; /* This just might overflow on two-complement machines. */
|
|
||||||
if (e < 0) return 0.0;
|
|
||||||
while (e > 0)
|
|
||||||
{
|
|
||||||
if (e & 1) v /= two;
|
|
||||||
two *= two;
|
|
||||||
e >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (e > 0)
|
|
||||||
{
|
|
||||||
while (e > 0)
|
|
||||||
{
|
|
||||||
if (e & 1) v *= two;
|
|
||||||
two *= two;
|
|
||||||
e >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _log
|
|
||||||
_log:
|
|
||||||
fldln2
|
|
||||||
fldl 4(%esp)
|
|
||||||
fyl2x
|
|
||||||
ret
|
|
33
reactos/lib/crtdll/math/log.c
Normal file
33
reactos/lib/crtdll/math/log.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
double log (double __x);
|
||||||
|
|
||||||
|
double log (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fldln2\n\t"
|
||||||
|
"fxch\n\t"
|
||||||
|
"fyl2x"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,7 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _log10
|
|
||||||
_log10:
|
|
||||||
fldlg2
|
|
||||||
fldl 4(%esp)
|
|
||||||
fyl2x
|
|
||||||
ret
|
|
34
reactos/lib/crtdll/math/log10.c
Normal file
34
reactos/lib/crtdll/math/log10.c
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double log10 (double __x);
|
||||||
|
|
||||||
|
double log10 (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fldlg2\n\t"
|
||||||
|
"fxch\n\t"
|
||||||
|
"fyl2x"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,33 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.text
|
|
||||||
.globl _modf
|
|
||||||
_modf:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp,%ebp
|
|
||||||
subl $16,%esp
|
|
||||||
pushl %ebx
|
|
||||||
fnstcw -4(%ebp)
|
|
||||||
fwait
|
|
||||||
movw -4(%ebp),%ax
|
|
||||||
orw $0x0c3f,%ax
|
|
||||||
movw %ax,-8(%ebp)
|
|
||||||
fldcw -8(%ebp)
|
|
||||||
fwait
|
|
||||||
fldl 8(%ebp)
|
|
||||||
frndint
|
|
||||||
fstpl -16(%ebp)
|
|
||||||
fwait
|
|
||||||
movl -16(%ebp),%edx
|
|
||||||
movl -12(%ebp),%ecx
|
|
||||||
movl 16(%ebp),%ebx
|
|
||||||
movl %edx,(%ebx)
|
|
||||||
movl %ecx,4(%ebx)
|
|
||||||
fldl 8(%ebp)
|
|
||||||
fsubl -16(%ebp)
|
|
||||||
leal -20(%ebp),%esp
|
|
||||||
fclex
|
|
||||||
fldcw -4(%ebp)
|
|
||||||
fwait
|
|
||||||
popl %ebx
|
|
||||||
leave
|
|
||||||
ret
|
|
14
reactos/lib/crtdll/math/modf.c
Normal file
14
reactos/lib/crtdll/math/modf.c
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// from linux libc
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
/* Slooow version. */
|
||||||
|
|
||||||
|
double modf(double x,double *pint)
|
||||||
|
{
|
||||||
|
if (x >= 0)
|
||||||
|
*pint = floor(x);
|
||||||
|
else
|
||||||
|
*pint = ceil(x);
|
||||||
|
return x - *pint;
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.text
|
|
||||||
.globl ___modfl
|
|
||||||
___modfl:
|
|
||||||
pushl %ebp
|
|
||||||
movl %esp,%ebp
|
|
||||||
subl $4,%esp
|
|
||||||
fldt 8(%ebp)
|
|
||||||
movl 20(%ebp),%eax
|
|
||||||
fnstcw -2(%ebp)
|
|
||||||
movw -2(%ebp),%dx
|
|
||||||
orb $0x0c,%dh
|
|
||||||
movw %dx,-4(%ebp)
|
|
||||||
fldcw -4(%ebp)
|
|
||||||
fld %st(0)
|
|
||||||
frndint
|
|
||||||
fldcw -2(%ebp)
|
|
||||||
fld %st(0)
|
|
||||||
fstpt (%eax)
|
|
||||||
fsubrp %st,%st(1)
|
|
||||||
leave
|
|
||||||
ret
|
|
|
@ -1,86 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
yint:
|
|
||||||
.word 0,0
|
|
||||||
LCW1:
|
|
||||||
.word 0
|
|
||||||
LCW2:
|
|
||||||
.word 0
|
|
||||||
|
|
||||||
.text
|
|
||||||
LC0:
|
|
||||||
.double 0d1.0e+00
|
|
||||||
|
|
||||||
frac:
|
|
||||||
fstcww LCW1
|
|
||||||
fstcww LCW2
|
|
||||||
fwait
|
|
||||||
andw $0xf3ff,LCW2
|
|
||||||
orw $0x0400,LCW2
|
|
||||||
fldcww LCW2
|
|
||||||
fldl %st(0)
|
|
||||||
frndint
|
|
||||||
fldcww LCW1
|
|
||||||
fxch %st(1)
|
|
||||||
fsub %st(1),%st
|
|
||||||
ret
|
|
||||||
|
|
||||||
Lpow2:
|
|
||||||
call frac
|
|
||||||
f2xm1
|
|
||||||
faddl LC0
|
|
||||||
fscale
|
|
||||||
fstp %st(1)
|
|
||||||
ret
|
|
||||||
|
|
||||||
.globl _pow
|
|
||||||
_pow:
|
|
||||||
fldl 12(%esp)
|
|
||||||
fldl 4(%esp)
|
|
||||||
ftst
|
|
||||||
fnstsww %ax
|
|
||||||
sahf
|
|
||||||
jbe xltez
|
|
||||||
fyl2x
|
|
||||||
jmp Lpow2
|
|
||||||
xltez:
|
|
||||||
jb xltz
|
|
||||||
fstp %st(0)
|
|
||||||
ftst
|
|
||||||
fnstsww %ax
|
|
||||||
sahf
|
|
||||||
ja ygtz
|
|
||||||
jb error
|
|
||||||
fstp %st(0)
|
|
||||||
fld1l
|
|
||||||
fchs
|
|
||||||
error:
|
|
||||||
fsqrt
|
|
||||||
ret
|
|
||||||
ygtz:
|
|
||||||
fstp %st(0)
|
|
||||||
fldzl
|
|
||||||
ret
|
|
||||||
xltz:
|
|
||||||
fabs
|
|
||||||
fxch %st(1)
|
|
||||||
call frac
|
|
||||||
ftst
|
|
||||||
fnstsww %ax
|
|
||||||
fstp %st(0)
|
|
||||||
sahf
|
|
||||||
je yisint
|
|
||||||
fstp %st(0)
|
|
||||||
fchs
|
|
||||||
jmp error
|
|
||||||
yisint:
|
|
||||||
fistl yint
|
|
||||||
fxch %st(1)
|
|
||||||
fyl2x
|
|
||||||
call Lpow2
|
|
||||||
andl $1,yint
|
|
||||||
jz yeven
|
|
||||||
fchs
|
|
||||||
yeven:
|
|
||||||
ret
|
|
||||||
|
|
80
reactos/lib/crtdll/math/pow.c
Normal file
80
reactos/lib/crtdll/math/pow.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
double pow (double __x, double __y);
|
||||||
|
|
||||||
|
double __log2 (double __x);
|
||||||
|
|
||||||
|
double __log2 (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fld1\n\t"
|
||||||
|
"fxch\n\t"
|
||||||
|
"fyl2x"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double pow (double __x, double __y)
|
||||||
|
{
|
||||||
|
register double __value, __exponent;
|
||||||
|
long __p = (long) __y;
|
||||||
|
|
||||||
|
if (__x == 0.0 && __y > 0.0)
|
||||||
|
return 0.0;
|
||||||
|
if (__y == (double) __p)
|
||||||
|
{
|
||||||
|
double __r = 1.0;
|
||||||
|
if (__p == 0)
|
||||||
|
return 1.0;
|
||||||
|
if (__p < 0)
|
||||||
|
{
|
||||||
|
__p = -__p;
|
||||||
|
__x = 1.0 / __x;
|
||||||
|
}
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
if (__p & 1)
|
||||||
|
__r *= __x;
|
||||||
|
__p >>= 1;
|
||||||
|
if (__p == 0)
|
||||||
|
return __r;
|
||||||
|
__x *= __x;
|
||||||
|
}
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
__asm __volatile__
|
||||||
|
("fmul %%st(1) # y * log2(x)\n\t"
|
||||||
|
"fstl %%st(1)\n\t"
|
||||||
|
"frndint # int(y * log2(x))\n\t"
|
||||||
|
"fxch\n\t"
|
||||||
|
"fsub %%st(1) # fract(y * log2(x))\n\t"
|
||||||
|
"f2xm1 # 2^(fract(y * log2(x))) - 1\n\t"
|
||||||
|
: "=t" (__value), "=u" (__exponent) : "0" (__log2 (__x)), "1" (__y));
|
||||||
|
__value += 1.0;
|
||||||
|
__asm __volatile__
|
||||||
|
("fscale"
|
||||||
|
: "=t" (__value) : "0" (__value), "u" (__exponent));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
LCW1:
|
|
||||||
.word 0
|
|
||||||
LCW2:
|
|
||||||
.word 0
|
|
||||||
LC0:
|
|
||||||
.double 0d1.0e+00
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.globl ___pow10
|
|
||||||
___pow10:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fldl2t
|
|
||||||
fmulp
|
|
||||||
fstcww LCW1
|
|
||||||
fstcww LCW2
|
|
||||||
fwait
|
|
||||||
andw $0xf3ff,LCW2
|
|
||||||
orw $0x0400,LCW2
|
|
||||||
fldcww LCW2
|
|
||||||
fldl %st(0)
|
|
||||||
frndint
|
|
||||||
fldcww LCW1
|
|
||||||
fxch %st(1)
|
|
||||||
fsub %st(1),%st
|
|
||||||
f2xm1
|
|
||||||
faddl LC0
|
|
||||||
fscale
|
|
||||||
fstp %st(1)
|
|
||||||
ret
|
|
|
@ -1,30 +0,0 @@
|
||||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.data
|
|
||||||
LCW1:
|
|
||||||
.word 0
|
|
||||||
LCW2:
|
|
||||||
.word 0
|
|
||||||
LC0:
|
|
||||||
.double 0d1.0e+00
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
.globl ___pow2
|
|
||||||
___pow2:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fstcww LCW1
|
|
||||||
fstcww LCW2
|
|
||||||
fwait
|
|
||||||
andw $0xf3ff,LCW2
|
|
||||||
orw $0x0400,LCW2
|
|
||||||
fldcww LCW2
|
|
||||||
fldl %st(0)
|
|
||||||
frndint
|
|
||||||
fldcww LCW1
|
|
||||||
fxch %st(1)
|
|
||||||
fsub %st(1),%st
|
|
||||||
f2xm1
|
|
||||||
faddl LC0
|
|
||||||
fscale
|
|
||||||
fstp %st(1)
|
|
||||||
ret
|
|
|
@ -1,16 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
L0:
|
|
||||||
.quad 0xffffffffffffffff
|
|
||||||
|
|
||||||
.globl _sin
|
|
||||||
_sin:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fsin
|
|
||||||
fstsw
|
|
||||||
sahf
|
|
||||||
jnp L1
|
|
||||||
fstp %st(0)
|
|
||||||
fldl L0
|
|
||||||
L1:
|
|
||||||
ret
|
|
||||||
|
|
32
reactos/lib/crtdll/math/sin.c
Normal file
32
reactos/lib/crtdll/math/sin.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double sin (double __x);
|
||||||
|
|
||||||
|
double sin (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fsin"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,6 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
.globl _sqrt
|
|
||||||
_sqrt:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fsqrt
|
|
||||||
ret
|
|
32
reactos/lib/crtdll/math/sqrt.c
Normal file
32
reactos/lib/crtdll/math/sqrt.c
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double sqrt (double __x);
|
||||||
|
|
||||||
|
double sqrt (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
__asm __volatile__
|
||||||
|
("fsqrt"
|
||||||
|
: "=t" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
|
||||||
L0:
|
|
||||||
.quad 0xffffffffffffffff
|
|
||||||
|
|
||||||
.globl _tan
|
|
||||||
_tan:
|
|
||||||
fldl 4(%esp)
|
|
||||||
fptan
|
|
||||||
fstsw
|
|
||||||
fstp %st(0)
|
|
||||||
sahf
|
|
||||||
jnp L1
|
|
||||||
/* fstp %st(0) - if exception, there is nothing on the stack */
|
|
||||||
fldl L0
|
|
||||||
L1:
|
|
||||||
ret
|
|
||||||
|
|
33
reactos/lib/crtdll/math/tan.c
Normal file
33
reactos/lib/crtdll/math/tan.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* Math functions for i387.
|
||||||
|
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
|
||||||
|
|
||||||
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The GNU C Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
double tan (double __x);
|
||||||
|
|
||||||
|
double tan (double __x)
|
||||||
|
{
|
||||||
|
register double __value;
|
||||||
|
register double __value2 __attribute__ ((unused));
|
||||||
|
__asm __volatile__
|
||||||
|
("fptan"
|
||||||
|
: "=t" (__value2), "=u" (__value) : "0" (__x));
|
||||||
|
|
||||||
|
return __value;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue