ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ldexp.c
Go to the documentation of this file.
00001 /* Math functions for i387.
00002    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include <precomp.h>
00023 #include <math.h>
00024 #include <float.h>
00025 
00026 double ldexp (double value, int exp)
00027 {
00028     register double result;
00029 #ifndef __GNUC__
00030     register double __dy = (double)exp;
00031 #endif
00032 
00033     /* Check for value correctness
00034      * and set errno if required
00035      */
00036     if (_isnan(value))
00037     {
00038         errno = EDOM;
00039     }
00040 
00041 #ifdef __GNUC__
00042 #if defined(__clang__)
00043     asm ("fild %[exp]\n"
00044          "fscale\n"
00045          "fstp %%st(1)\n"
00046          : [result] "=t" (result)
00047          : [value] "0" (value), [exp] "m" (exp));
00048 #else
00049     asm ("fscale"
00050          : "=t" (result)
00051          : "0" (value), "u" ((double)exp)
00052          : "1");
00053 #endif
00054 #else /* !__GNUC__ */
00055     __asm
00056     {
00057         fld __dy
00058         fld value
00059         fscale
00060         fstp result
00061     }
00062 #endif /* !__GNUC__ */
00063     return result;
00064 }
00065 

Generated on Fri May 25 2012 04:34:54 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.