www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/01/13/15:52:37

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Kbwms AT aol DOT com
Message-ID: <c1.3b9ecc55.2d35b48c@aol.com>
Date: Tue, 13 Jan 2004 15:52:28 EST
Subject: Re: C99 Functions Under Development and Checkout
To: djgpp-workers AT delorie DOT com
MIME-Version: 1.0
X-Mailer: 8.0 for Windows sub 6021
Reply-To: djgpp-workers AT delorie DOT com

--part1_c1.3b9ecc55.2d35b48c_boundary
Content-Type: multipart/alternative;
	boundary="part1_c1.3b9ecc55.2d35b48c_alt_boundary"


--part1_c1.3b9ecc55.2d35b48c_alt_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

In a message dated 1/13/2004 3:01:40 PM Eastern Standard Time, 
eliz AT elta DOT co DOT il writes:

> Sounds okay to me, except that perhaps we should set errno to EDOM in
> all these cases.
> 

That sounds fine to me.  It satisfies Posix, which I like.

> Can somebody see what does glibc do in these situations?
> 

Attached.  

=================================================


--part1_c1.3b9ecc55.2d35b48c_alt_boundary
Content-Type: text/html; charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<HTML><FONT FACE=3Darial,helvetica><HTML><FONT  SIZE=3D3 PTSIZE=3D12 FAMILY=
=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">In a message dated 1/13/2004 3:01:40=20=
PM Eastern Standard Time, eliz AT elta DOT co DOT il writes:<BR>
<BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"></FONT><FONT  COLOR=3D"#000000"=
 BACK=3D"#ffffff" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=3D2 PTSIZE=3D10 F=
AMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0">Sounds okay to me, except that=
 perhaps we should set errno to EDOM in<BR>
all these cases.<BR>
</BLOCKQUOTE></FONT><FONT  COLOR=3D"#000000" BACK=3D"#ffffff" style=3D"BACKG=
ROUND-COLOR: #ffffff" SIZE=3D2 PTSIZE=3D10 FAMILY=3D"SANSSERIF" FACE=3D"Aria=
l" LANG=3D"0"><BR>
<BR>
</FONT><FONT  COLOR=3D"#000000" BACK=3D"#ffffff" style=3D"BACKGROUND-COLOR:=20=
#ffffff" SIZE=3D3 PTSIZE=3D12 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0">T=
hat sounds fine to me.&nbsp; It satisfies Posix, which I like.</FONT><FONT =20=
COLOR=3D"#000000" BACK=3D"#ffffff" style=3D"BACKGROUND-COLOR: #ffffff" SIZE=
=3D2 PTSIZE=3D10 FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0"><BR>
</FONT><FONT  COLOR=3D"#000000" BACK=3D"#ffffff" style=3D"BACKGROUND-COLOR:=20=
#ffffff" SIZE=3D2 PTSIZE=3D10 FAMILY=3D"SANSSERIF" FACE=3D"Arial" LANG=3D"0"=
><BR>
<BLOCKQUOTE TYPE=3DCITE style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT=
: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px">Can somebody see what does glib=
c do in these situations?<BR>
</BLOCKQUOTE><BR>
</FONT><FONT  COLOR=3D"#000000" BACK=3D"#ffffff" style=3D"BACKGROUND-COLOR:=20=
#ffffff" SIZE=3D3 PTSIZE=3D12 FAMILY=3D"SERIF" FACE=3D"Georgia" LANG=3D"0"><=
BR>
Attached.&nbsp; <BR>
<BR>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>
<BR>
</FONT></HTML>
--part1_c1.3b9ecc55.2d35b48c_alt_boundary--

--part1_c1.3b9ecc55.2d35b48c_boundary
Content-Type: text/plain; name="s_llrintl.c"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="s_llrintl.c"

/* Round argument to nearest integral value according to current rounding
   direction.
   Copyright (C) 1997 Free Software Foundation, Inc.
   This file is part of the GNU C Library.
   Contributed by Ulrich Drepper <drepper AT cygnus DOT com>, 1997.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <math.h>

#include "math_private.h"

static const long double two63[2] =3D
{
  9.223372036854775808000000e+18, /* 0x403E, 0x00000000, 0x00000000 */
 -9.223372036854775808000000e+18  /* 0xC03E, 0x00000000, 0x00000000 */
};


long long int
__llrintl (long double x)
{
  int32_t se,j0;
  u_int32_t i0, i1;
  long long int result;
  volatile long double w;
  long double t;
  int sx;

  GET_LDOUBLE_WORDS (se, i0, i1, x);

  sx =3D (se >> 15) & 1;
  j0 =3D (se & 0x7fff) - 0x3fff;

  if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
    {
      if (j0 < -1)
=09return 0;
      else if (j0 >=3D 63)
=09result =3D (((long long int) i0 << 32) | i1) << (j0 - 63);
      else
=09{
=09  w =3D two63[sx] + x;
=09  t =3D w - two63[sx];
=09  GET_LDOUBLE_WORDS (se, i0, i1, t);
=09  j0 =3D (se & 0x7fff) - 0x3fff;

=09  if (j0 < 31)
=09    result =3D i0 >> (31 - j0);
=09  else
=09    result =3D ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
=09}
    }
  else
    {
      /* The number is too large.  It is left implementation defined
=09 what happens.  */
      return (long long int) x;
    }

  return sx ? -result : result;
}

weak_alias (__llrintl, llrintl)

--part1_c1.3b9ecc55.2d35b48c_boundary--

- Raw text -


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