GCC Middle and Back End API Reference
realmpfr.c File Reference

Functions

void mpfr_from_real ()
void real_from_mpfr ()

Function Documentation

void mpfr_from_real ( )
   Conversion routines from GCC internal float representation to MPFR.
   Copyright (C) 2010-2013 Free Software Foundation, Inc.

   This file is part of GCC.

   GCC is free software; you can redistribute it and/or modify it under
   the terms of the GNU General Public License as published by the Free
   Software Foundation; either version 3, or (at your option) any later
   version.

   GCC 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 General Public License
   for more details.

   You should have received a copy of the GNU General Public License
   along with GCC; see the file COPYING3.  If not see
   <http://www.gnu.org/licenses/>.  
   Convert from REAL_VALUE_TYPE to MPFR.  The caller is responsible
   for initializing and clearing the MPFR parameter.  
     We use a string as an intermediate type.  
     Take care of Infinity and NaN.  
     mpfr_set_str() parses hexadecimal floats from strings in the same
     format that GCC will output them.  Nothing extra is needed.  

Referenced by fold_builtin_sprintf_chk_1(), and fold_builtin_strncat_chk().

void real_from_mpfr ( )
   Convert from MPFR to REAL_VALUE_TYPE, for a given type TYPE and rounding
   mode RNDMODE.  TYPE is only relevant if M is a NaN.  
     We use a string as an intermediate type.  
     Take care of Infinity and NaN.  
     The additional 12 chars add space for the sprintf below.  This
     leaves 6 digits for the exponent which is supposedly enough.  
     REAL_VALUE_ATOF expects the exponent for mantissa * 2**exp,
     mpfr_get_str returns the exponent for mantissa * 16**exp, adjust
     for that.  

References real_inf(), and real_value_negate().

Referenced by decimal_from_integer().