FAQ

On Fri, 9 Feb 2007, Andy Dougherty wrote:

I'll send the metaconfig unit separately in a follow-up message.
Here's my proposed d_signbit.U unit.

?RCS: $Id$
?RCS:
?RCS: You may distribute under the terms of either the GNU General Public
?RCS: License or the Artistic License, as specified in the README file.
?RCS:
?MAKE:d_signbit: nvtype Compile Setvar cat run rm echo i_math i_sunmath
?MAKE: -pick add $@ %<
?S:d_signbit:
?S: This variable conditionally defines the HAS_SIGNBIT symbol, which
?S: indicates to the C program that the signbit() routine is available
?S: and safe to use with perl's intern NV type.
?S:.
?C:HAS_SIGNBIT:
?C: This symbol, if defined, indicates that the signbit routine is
?C: available to check if the given number has the sign bit set.
?C: This should include correct testing of -0.0. This will only be set
?C: if the signbit() routine is safe to use with the NV type used internally
?C: in perl. Users should call Perl_signbit(), which will be #defined to
?C: the system's signbit() function or macro if this symbol is defined.
?C:.
?H:#$d_signbit HAS_SIGNBIT /**/
?H:.
?LINT:set d_signbit d_use_signbit
: see if signbit exists
$echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
$cat >try.c <<EOCP
#$i_math I_MATH
#$i_sunmath I_SUNMATH
#ifdef I_MATH
# include <math.h>
#endif
#ifdef I_SUNMATH /* Solaris special math library */
# include <sunmath.h>
#endif
#define NV $nvtype
int main(int argc, char **argv)
{
NV x = 0.0;
NV y = -0.0;
if ((signbit(x) == 0) && (signbit(y) != 0))
return 0;
else
return 1;
}
EOCP
val="$undef"
set try
if eval $compile; then
if $run ./try; then
$echo "Yes." >&4
val="$define"
else
$echo "Signbit seems to be available, but doesn't work as I expected."
$echo "I won't use it." >&4
val="$undef"
fi
else
$echo "Nope." >&4
dflt="$undef"
fi
set d_signbit
eval $setvar
$rm -f try.* try


--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042

Search Discussions

  • H.Merijn Brand at Feb 10, 2007 at 4:44 pm

    On Fri, 9 Feb 2007 11:46:28 -0500 (EST), Andy Dougherty wrote:
    On Fri, 9 Feb 2007, Andy Dougherty wrote:

    I'll send the metaconfig unit separately in a follow-up message.
    Here's my proposed d_signbit.U unit.

    ?RCS: $Id$
    ?RCS:
    ?RCS: You may distribute under the terms of either the GNU General Public
    ?RCS: License or the Artistic License, as specified in the README file.
    ?RCS:
    ?MAKE:d_signbit: nvtype Compile Setvar cat run rm echo i_math i_sunmath
    ?MAKE:d_signbit: nvtype Compile Setvar cat run rm echo n c i_math i_sunmath

    Almost perfect :) You have not lost the touch yet.
    Thanks, applied in change #30190


    --
    H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
    using & porting perl 5.6.2, 5.8.x, 5.9.x on HP-UX 10.20, 11.00, 11.11,
    & 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and Cygwin. http://qa.perl.org
    http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
    http://www.goldmark.org/jeff/stupid-disclaimers/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupperl5-build @
categoriesperl
postedFeb 9, '07 at 4:50p
activeFeb 10, '07 at 4:44p
posts2
users2
websiteperl.org

2 users in discussion

H.Merijn Brand: 1 post Andy Dougherty: 1 post

People

Translate

site design / logo © 2019 Grokbase