bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copysign on MSVC


From: Bruno Haible
Subject: Re: copysign on MSVC
Date: Sun, 9 Oct 2011 16:24:59 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

> 2011-10-09  Bruno Haible  <address@hidden>
> 
>       copysign: Provide replacement.

While at it, I also added modules for 'copysignf' and 'copysignl'.


2011-10-09  Bruno Haible  <address@hidden>

        New module 'copysignf'.
        * lib/math.in.h (copysignf): New declaration.
        * lib/copysignf.c: New file.
        * m4/copysignf.m4: New file.
        * m4/math_h.m4 (gl_MATH_H): Test whether copysignf is declared.
        (gl_MATH_H_DEFAULTS): Initialize GNULIB_COPYSIGNF, HAVE_COPYSIGNF.
        * modules/math (Makefile.am): Substitute GNULIB_COPYSIGNF,
        HAVE_COPYSIGNF.
        * modules/copysignf: New file.
        * tests/test-math-c++.cc: Check the declaration of copysignf.
        * doc/posix-functions/copysignf.texi: Mention the new module.

        New module 'copysignl'.
        * lib/math.in.h (copysignl): New declaration.
        * lib/copysignl.c: New file.
        * m4/copysignl.m4: New file.
        * m4/math_h.m4 (gl_MATH_H): Test whether copysignl is declared.
        (gl_MATH_H_DEFAULTS): Initialize GNULIB_COPYSIGNL, HAVE_COPYSIGNL.
        * modules/math (Makefile.am): Substitute GNULIB_COPYSIGNL,
        HAVE_COPYSIGNL.
        * modules/copysignl: New file.
        * tests/test-math-c++.cc: Check the declaration of copysignl.
        * modules/math-c++-tests (Makefile.am): Link test-math-c++ against
        $(COPYSIGNL_LIBM). Needed on IRIX 6.5 with cc.
        * doc/posix-functions/copysignl.texi: Mention the new module.

=============================== lib/copysignf.c ===============================
/* Copy sign into another 'float' number.
   Copyright (C) 2011 Free Software Foundation, Inc.

   This program 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 of the License, or
   (at your option) any later version.

   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include <config.h>

/* Specification.  */
#include <math.h>

float
copysignf (float x, float y)
{
  return (signbit (x) != signbit (y) ? - x : x);
}
=============================== lib/copysignl.c ===============================
/* Copy sign into another 'long double' number.
   Copyright (C) 2011 Free Software Foundation, Inc.

   This program 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 of the License, or
   (at your option) any later version.

   This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include <config.h>

/* Specification.  */
#include <math.h>

long double
copysignl (long double x, long double y)
{
  return (signbit (x) != signbit (y) ? - x : x);
}
===============================================================================


-- 
In memoriam Oskar Schindler <http://en.wikipedia.org/wiki/Oskar_Schindler>
<http://www.shoah.dk/Courage/Schindler.htm>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]