Result:
found more than 933 distributions - search limited to the first 2001 files matching your query ( run in 3.029 )


Data-Sah-Format

 view release on metacpan or  search on metacpan

lib/Data/Sah/Format/js/iso8601_date.pm  view on Meta::CPAN


    my $res = {};

    $res->{expr} = join(
        "",
        "$dt instanceof Date ? (isNaN($dt) ? d : $dt.toISOString().substring(0, 10)) : ",
        $attempt_parse ? "(function(pd) { pd = new Date($dt); return isNaN(pd) ? $dt : pd.toISOString().substring(0, 10) })()" : "$dt",
    );

    $res;
}

 view all matches for this distribution


Data-Sah-JS

 view release on metacpan or  search on metacpan

lib/Data/Sah/Compiler/js/TH/date.pm  view on Meta::CPAN


=back

But note that if the arguments are invalid, Date() will still return a Date
object, but if we try to do C<d.getMonth()> or C<d.getYear()> it will return
NaN. This can be used to check that a date is invalid: C<< isNaN(d.getYear()) >>
or simply C<<isNaN(d)>>.

To compare 2 Date object, we can use C<< d1 > d2 >>, C<< d1 < d2 >>, but for
anything involving equality check, we need to prefix using C<+>, C<+d1 === +d2>.

=for Pod::Coverage ^(clause_.+|superclause_.+|handle_.+|before_.+|after_.+)$

 view all matches for this distribution


Data-SecsPack

 view release on metacpan or  search on metacpan

lib/Docs/Site_SVD/Data_SecsPack.pm  view on Meta::CPAN

 #   Expected: 'U1[1] 80
 U1[2] 128 0
 '

The second group of failures the UUT C<unpack_float> subroutine
is always returning a NaN. This subroutine heavily uses the
native floating point for calcuations and it appears to
be limiting out with C<Not a Number> type error.

 # Test 27 got: '0' (t/Data/SecsPackStress.t at line 396 fail #2)
 #    Expected: '1' (got: NaN, expected: -10.5
 # actual tolerance: NaN, expected tolerance: 0.0001)

Check version of C<Math::BigInt> in the ActiveState Perl 5.06
distribution to those on CPAN. ActiveState C<Math::BigInt>
was 0.01 while CPAN was 1.70. The difference between the two
is night and day. Install C<Math::BigInt> 1.70.

lib/Docs/Site_SVD/Data_SecsPack.pm  view on Meta::CPAN

 #   Expected: 'U1[1] 80
 U1[2] 128 0
 '

The second group of failures the UUT C<unpack_float> subroutine
is always returning a NaN. This subroutine heavily uses the
native floating point for calcuations and it appears to
be limiting out with C<Not a Number> type error.

 # Test 27 got: '0' (t/Data/SecsPackStress.t at line 396 fail #2)
 #    Expected: '1' (got: NaN, expected: -10.5
 # actual tolerance: NaN, expected tolerance: 0.0001)

Check version of C<Math::BigInt> in the ActiveState Perl 5.06
distribution to those on CPAN. ActiveState C<Math::BigInt>
was 0.01 while CPAN was 1.70. The difference between the two
is night and day. Install C<Math::BigInt> 1.70.

 view all matches for this distribution


Data-Smile-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-SortedSet-Shared

 view release on metacpan or  search on metacpan

lib/Data/SortedSet/Shared.pm  view on Meta::CPAN

Multiple processes can map the same set and read and write it concurrently;
access is serialized by a write-preferring futex rwlock that recovers
automatically if a lock holder dies (see L</CRASH SAFETY>).

Members are 64-bit integers.  For B<string-keyed> sets, see L</String-keyed sets>
and L<Data::SortedSet::Shared::Strings> (bundled).  Scores must not be NaN.
B<Linux-only>.  Requires 64-bit Perl.

=head1 METHODS

=head2 Constructors

lib/Data/SortedSet/Shared.pm  view on Meta::CPAN

    my $n = $z->add_many([ [$m1,$s1], [$m2,$s2], ... ]);   # bulk; returns count of new
    $z->clear;

C<add> inserts a new member or updates an existing member's score, returning 1 or
0 respectively, or C<undef> if the pool is full and the member is new.  C<$score>
may be any finite or infinite value but B<not NaN> (croaks).  C<incr> creates an
absent member at C<$delta> (like Redis ZINCRBY) and croaks if the result would be
NaN, or if the pool is full and the member is new.

C<add_many> applies a whole batch under a single lock; each row is an
C<[member, score]> arrayref, malformed or NaN-scored rows are skipped, and it
stops at C<$max>.  It returns the number of members B<newly inserted>, which can
be fewer than the number of new rows if the pool fills mid-batch.

=head2 Lookup and count

 view all matches for this distribution


Data-SpatialHash-Shared

 view release on metacpan or  search on metacpan

sphash.h  view on Meta::CPAN

 * center +/- g over a span already capped at SPH_MAX_QUERY_CELLS -- can never
 * overflow int64. 2^62 is far beyond any coordinate a double represents exactly
 * (2^53), so nothing reachable is lost. */
#define SPH_CELL_LIMIT ((int64_t)1 << 62)

/* Floor one coordinate to its integer cell. Defined for every double: NaN/Inf
 * map to cell 0, and the result is clamped to +/-SPH_CELL_LIMIT, both to avoid
 * the UB of converting an out-of-range double to int64_t and to bound the
 * query loops (see SPH_CELL_LIMIT). */
static inline int64_t sph_floor_cell(double v, double cs) {
    double d = floor(v / cs);

sphash.h  view on Meta::CPAN

    if (ax >= ay && ax >= az) { mag = ax; face = (x >= 0) ? 0 : 1; s = y / mag; t = z / mag; }
    else if (ay >= az)        { mag = ay; face = (y >= 0) ? 2 : 3; s = x / mag; t = z / mag; }
    else                      { mag = az; face = (z >= 0) ? 4 : 5; s = x / mag; t = y / mag; }
    double u = atan(s) / SPH_PI_4;          /* equal-angle warp to [-1,1] */
    double v = atan(t) / SPH_PI_4;
    if (!isfinite(u)) u = 0.0;              /* dir==0 -> s,t NaN; keep defined */
    if (!isfinite(v)) v = 0.0;
    int64_t N = (int64_t)1 << level;
    int64_t i = (int64_t)floor((u + 1.0) * 0.5 * (double)N);
    int64_t j = (int64_t)floor((v + 1.0) * 0.5 * (double)N);
    if (i < 0) i = 0; else if (i >= N) i = N - 1;

sphash.h  view on Meta::CPAN

        if (!sph_is_live(h, a)) continue;
        const double *pa = h->entries[a].pos;
        double ra = h->entries[a].radius;
        double reach_d = ceil((collide ? (ra + maxr) : fixed_r) / cs);
        /* defensive: the API validates radii, but a corrupt stored radius could make this
           NaN, which would slip past the cap check below (NaN >= X is false) into the cast */
        if (!(reach_d >= 0)) reach_d = 0;
        if (reach_d >= (double)SPH_MAX_QUERY_CELLS) return SPH_Q_TOOBIG;  /* avoid int64 overflow */
        int64_t reach = (int64_t)reach_d;
        int64_t ac[3]; sph_cell_raw(h, pa, ac);
        int64_t cnt[3] = { 1, 1, 1 };

 view all matches for this distribution


Data-Stack-Shared

 view release on metacpan or  search on metacpan

xt/timeout_validation.t  view on Meta::CPAN

use Time::HiRes qw(time);
use Data::Stack::Shared;

plan skip_all => 'AUTHOR_TESTING not set' unless $ENV{AUTHOR_TESTING};

# Boundary timeouts: negative, +Inf, NaN. None should crash; results
# should match documented behavior or croak cleanly.

my $h = Data::Stack::Shared::Int->new(undef, 4);

# Run each timeout in a child to detect signal-death.

xt/timeout_validation.t  view on Meta::CPAN

my $r2 = run_child('inf timeout',
    sub { local $SIG{ALRM} = sub { _exit(0) }; alarm 1; $h->pop_wait("Inf"+0) });
isnt $r2, 'signal_11', "inf timeout: no SIGSEGV (got $r2)";
isnt $r2, 'signal_6',  "inf timeout: no SIGABRT (got $r2)";

# NaN: implementation-defined, must not crash
my $r3 = run_child('nan timeout',
    sub { local $SIG{ALRM} = sub { _exit(0) }; alarm 1; $h->pop_wait("NaN"+0) });
isnt $r3, 'signal_11', "NaN timeout: no SIGSEGV (got $r3)";
isnt $r3, 'signal_6',  "NaN timeout: no SIGABRT (got $r3)";

done_testing;

 view all matches for this distribution


Data-StreamDeserializer

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-StreamSerializer

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-TOON

 view release on metacpan or  search on metacpan

t/05_security.t  view on Meta::CPAN

    my $encoder = Data::TOON::Encoder->new(max_depth => 10);  # Low limit to catch circular ref
    my $encoded = eval { $encoder->encode($data) };
    like($@ // '', qr/circular|reference|depth/i, 'encode detects circular references or depth limit');
}

# Test 10: NaN and Infinity are strings, not numbers
{
    my $toon_text = <<'TOON';
value1: NaN
value2: Infinity
TOON
    
    my $data = Data::TOON->decode($toon_text);
    is($data->{value1}, 'NaN', 'NaN decoded as string');
    is($data->{value2}, 'Infinity', 'Infinity decoded as string');
}

# Test 11: Shell injection-like patterns (data escaping)
{

 view all matches for this distribution


Data-TxnBuffer

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-ULID-XS

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-UUID-LibUUID

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-Undump

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Data-Util

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    - remove "original" property from subroutine_modifier(), which seems
        a waste of memory
    - internal cleanup

0.42 Wed Dec 10 13:42:50 2008
    - fix is_number()/is_integer() to refuse Infinity and NaN correctly
    - fix a possible segfault on install_subrouitne()
    - internal cleanup

0.41 Man Dec  8 11:36:38 2008
    - change get_stash() to be able to take an object reference

 view all matches for this distribution


Data-Validate-CSV

 view release on metacpan or  search on metacpan

lib/Data/Validate/CSV/Column.pm  view on Meta::CPAN

	my ($value, $pattern, $decimal_char, $group_char) = @_;
	$decimal_char //= '.';
	$group_char   //= ',';
	$pattern =~ s/;+$//;
	
	return  'NaN' if lc($value) eq  'nan';
	return  'INF' if lc($value) eq  'inf';
	return '-INF' if lc($value) eq '-inf';
	
	my $regexp;
	if (defined $pattern) {

 view all matches for this distribution


Database-Async-SQLite

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


Date-Lectionary

 view release on metacpan or  search on metacpan

lib/Date/Lectionary/Day.pm  view on Meta::CPAN


enum 'DayType',        [qw(fixedFeast moveableFeast Sunday noLect)];
enum 'LectionaryType', [qw(acna rcl)];
enum 'MultiLect',      [qw(yes no)];
enum 'IncludeFeasts',  [qw(yes no)];
enum 'XianSeason',     [qw(Advent Christmas Epiphany Ordinary Lent Easter Pentecost NaN)];
no Moose::Util::TypeConstraints;

=head1 SUBROUTINES/METHODS/ATTRIBUTES

=head2 ATTRIBUTES

lib/Date/Lectionary/Day.pm  view on Meta::CPAN


The liturgical season the day falls within.

Valid values are 'Advent', 'Christmas', 'Epiphany', 'Ordinary', 'Lent', 'Easter', or 'Pentecost'.

If a date is given that is not a Sunday nor a pricipal holy day 'NaN' will be given for the season.

=cut

has 'date' => (
    is       => 'ro',

lib/Date/Lectionary/Day.pm  view on Meta::CPAN


    if ($yesterdayName) {
        return (
            commonName => $yesterdayName,
            type       => 'moveableFeast',
            season     => 'NaN'
        );
    }

    my $fixedDayName = _buildFixedDays( $date, $lectionary );
    if ($fixedDayName) {

lib/Date/Lectionary/Day.pm  view on Meta::CPAN

    my $moveableDayName = _buildMoveableDays( $date, $lectionary );
    if ( $moveableDayName && $date->wday != 1 ) {
        return (
            commonName => $moveableDayName,
            type       => 'moveableFeast',
            season     => 'NaN'
        );
    }

    return ( commonName => undef, type => undef, season => 'NaN' );
}

=head2 _buildMoveableDays

Private method that takes the Time::Piece date given at construction and determines if the date is one of many moveable feasts in the liturgical calendar.  Feasts are taken from the Anglican Church in North America's revision of the revised common le...

lib/Date/Lectionary/Day.pm  view on Meta::CPAN

    #then there are no readings for that day.
    if ( $date->wday != 1 ) {
        return (
            commonName => $date->fullday . ', ' . $date->fullmonth . ' ' . $date->mday . ', ' . $date->year,
            type       => 'noLect',
            season     => 'NaN'
        );
    }

    #Sundays of the Liturgical Year
    if ( $date < $ashWednesday ) {

 view all matches for this distribution


Date-LibICal

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


DateTime-Fiction-JRRTolkien-Shire

 view release on metacpan or  search on metacpan

lib/DateTime/Fiction/JRRTolkien/Shire.pm  view on Meta::CPAN

	    and return $self;

        my %delta = $dur->deltas();

	# This bit isn't quite right since DateTime::Infinite::Future -
	# infinite duration should NaN (cribbed shamelessly from
	# DateTime)
        foreach my $val ( values %delta ) {
            my $inf;
            if ( $val == DateTime->INFINITY ) {
                $inf = DateTime::Infinite::Future->new;

 view all matches for this distribution


DateTime-Format-Lite

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


DateTime-Lite

 view release on metacpan or  search on metacpan

lib/DateTime/Lite.pm  view on Meta::CPAN

    my $class = $dt->duration_class;  # 'DateTime::Lite::Duration'

    # Constants
    DateTime::Lite::INFINITY();        # +Inf
    DateTime::Lite::NEG_INFINITY();    # -Inf
    DateTime::Lite::NAN();             # NaN
    DateTime::Lite::MAX_NANOSECONDS(); # 1_000_000_000
    DateTime::Lite::SECONDS_PER_DAY(); # 86400

    # Error handling
    my $dt2 = DateTime::Lite->new( %bad_args ) ||

 view all matches for this distribution


DateTime-Locale-FromCLDR

 view release on metacpan or  search on metacpan

lib/DateTime/Locale/FromCLDR.pm  view on Meta::CPAN

    #     exponential => "E",
    #     group => ",",
    #     infinity => "∞",
    #     list => ";",
    #     minus => "-",
    #     nan => "NaN",
    #     per_mille => "‰",
    #     percent => "%",
    #     plus => "+",
    #     superscript => "\xD7",
    #     time_separator => ":",

lib/DateTime/Locale/FromCLDR.pm  view on Meta::CPAN


Note that, in the CLDR data, although it is always a visually identical representation, the character itself used varies, depending on the locale used. For example: C<-> (C<\x{2D}>) vs C<-> (C<\x{D8}\x{9C}\x{2D}>)

=item * C<nan>

The NaN sign. Corresponds to the IEEE NaN bit pattern.

For example C<NaN>, C<не число>

=item * C<per_mille>

"Symbol used to indicate a per-mille (1/1000th) amount."

 view all matches for this distribution


DateTime-Precise

 view release on metacpan or  search on metacpan

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

#
# number format
#   canonical strings have the form /[+-]\d+E[+-]\d+/
#   Input values can have inbedded whitespace
# Error returns
#   'NaN'           An input parameter was "Not a Number" or 
#                       divide by zero or sqrt of negative number
# Division is computed to 
#   max($div_scale,length(dividend)+length(divisor)) 
#   digits by default.
# Also used for default sqrt scale

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

# Convert a number to canonical string form.
#   Takes something that looks like a number and converts it to
#   the form /^[+-]\d+E[+-]\d+$/.
sub DateTime::Math::fnorm { #(string) return fnum_str
    local($_) = @_;
    defined($_) or return 'NaN';
    s/\s+//g;                               # strip white space
    if (/^([+-]?)(\d*)(\.(\d*))?([Ee]([+-]?\d+))?$/ &&
	($2 ne '' || defined($4))) {
	my $x = defined($4) ? $4 : '';
	my $y = defined($6) ? $6 : 0;
	&norm(($1 ? "$1$2$x" : "+$2$x"), (($x ne '') ? $y-length($x) : $y));
    } else {
	'NaN';
    }
}

# normalize number -- for internal use
sub norm { #(mantissa, exponent) return fnum_str
    my ($mantissa, $exp) = @_;
    defined($exp) or $exp = 0;
    if ($mantissa eq 'NaN') {
	'NaN';
    } else {
	# strip leading zeros
	$mantissa =~ s/^([+-])0+/$1/;
	if (length($mantissa) == 1) {
	    '+0E+0';

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

}

# multiplication
sub DateTime::Math::fmul { #(fnum_str, fnum_str) return fnum_str
    my ($x,$y) = (&DateTime::Math::fnorm($_[0]),&DateTime::Math::fnorm($_[1]));
    if ($x eq 'NaN' || $y eq 'NaN') {
	'NaN';
    } else {
	my ($xm,$xe) = split('E',$x);
	my ($ym,$ye) = split('E',$y);
	&norm(&DateTime::Math::bmul($xm,$ym),$xe+$ye);
    }
}

# addition
sub DateTime::Math::fadd { #(fnum_str, fnum_str) return fnum_str
    my ($x,$y) = (&DateTime::Math::fnorm($_[0]),&DateTime::Math::fnorm($_[1]));
    if ($x eq 'NaN' || $y eq 'NaN') {
	'NaN';
    } else {
	my ($xm,$xe) = split('E',$x);
	my ($ym,$ye) = split('E',$y);
	($xm,$xe,$ym,$ye) = ($ym,$ye,$xm,$xe) if ($xe < $ye);
	&norm(&DateTime::Math::badd($ym,$xm.('0' x ($xe-$ye))),$ye);

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

#   args are dividend, divisor, scale (optional)
#   result has at most max(scale, length(dividend), length(divisor)) digits
sub DateTime::Math::fdiv #(fnum_str, fnum_str[,scale]) return fnum_str
{
    my ($x,$y,$scale) = (&DateTime::Math::fnorm($_[0]),&DateTime::Math::fnorm($_[1]),$_[2]);
    if ($x eq 'NaN' || $y eq 'NaN' || $y eq '+0E+0') {
	'NaN';
    } else {
	my ($xm,$xe) = split('E',$x);
	my ($ym,$ye) = split('E',$y);
	$scale = $div_scale if (!$scale);
	$scale = length($xm)-1 if (length($xm)-1 > $scale);

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

}

# round int $q based on fraction $r/$base using $rnd_mode
sub round { #(int_str, int_str, int_str) return int_str
    my ($q,$r,$base) = @_;
    if ($q eq 'NaN' || $r eq 'NaN') {
	'NaN';
    } elsif ($rnd_mode eq 'trunc') {
	$q;                         # just truncate
    } else {
	my $cmp = &DateTime::Math::bcmp(&DateTime::Math::bmul($r,'+2'),$base);
	if ( $cmp < 0 ||

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

}

# round the mantissa of $x to $scale digits
sub DateTime::Math::fround { #(fnum_str, scale) return fnum_str
    my ($x,$scale) = (&DateTime::Math::fnorm($_[0]),$_[1]);
    if ($x eq 'NaN' || $scale <= 0) {
	$x;
    } else {
	my ($xm,$xe) = split('E',$x);
	if (length($xm)-1 <= $scale) {
	    $x;

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

}

# round $x at the 10 to the $scale digit place
sub DateTime::Math::ffround { #(fnum_str, scale) return fnum_str
    my ($x,$scale) = (&DateTime::Math::fnorm($_[0]),$_[1]);
    if ($x eq 'NaN') {
	'NaN';
    } else {
	my ($xm,$xe) = split('E',$x);
	if ($xe >= $scale) {
	    $x;
	} else {

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

# compare 2 values returns one of undef, <0, =0, >0
#   returns undef if either or both input value are not numbers
sub DateTime::Math::fcmp #(fnum_str, fnum_str) return cond_code
{
    my ($x, $y) = (&DateTime::Math::fnorm($_[0]),&DateTime::Math::fnorm($_[1]));
    if ($x eq "NaN" || $y eq "NaN") {
	return;
    } else {
	# Compare signs between the two numbers.
	my $ret = (ord($y) <=> ord($x));
	$ret and return $ret;

lib/DateTime/Math/bigfloat.pl  view on Meta::CPAN

}

# square root by Newtons method.
sub DateTime::Math::fsqrt { #(fnum_str[, scale]) return fnum_str
    my ($x, $scale) = (&DateTime::Math::fnorm($_[0]), $_[1]);
    if ($x eq 'NaN' || $x =~ /^-/) {
	'NaN';
    } elsif ($x eq '+0E+0') {
	'+0E+0';
    } else {
	my ($xm, $xe) = split('E',$x);
	$scale = $div_scale if (!$scale);

 view all matches for this distribution


DateTime

 view release on metacpan or  search on metacpan

lib/DateTime.pm  view on Meta::CPAN

        return $self if $dur->is_zero;

        my %deltas = $dur->deltas;

        # This bit isn't quite right since DateTime::Infinite::Future -
        # infinite duration should NaN
        for my $val ( values %deltas ) {
            my $inf;
            if ( $val == INFINITY ) {
                $inf = DateTime::Infinite::Future->new;
            }

lib/DateTime.pm  view on Meta::CPAN


=head1 KNOWN BUGS

The tests in F<20infinite.t> seem to fail on some machines, particularly on
Win32. This appears to be related to Perl's internal handling of IEEE infinity
and NaN, and seems to be highly platform/compiler/phase of moon dependent.

If you don't plan to use infinite datetimes you can probably ignore this. This
will be fixed (perhaps) in future versions.

=head1 SEE ALSO

 view all matches for this distribution


DateTimeX-Lite

 view release on metacpan or  search on metacpan

lib/DateTimeX/Lite/Arithmetic.pm  view on Meta::CPAN

        return $self if $dur->is_zero;

        my %deltas = $dur->deltas;

        # This bit isn't quite right since DateTimeX::Lite::Infinite::Future -
        # infinite duration should NaN
        foreach my $val ( values %deltas )
        {
            my $inf;
            if ( $val == &DateTimeX::Lite::INFINITY )
            {

 view all matches for this distribution


DateTimeX-Moment

 view release on metacpan or  search on metacpan

t/20infinite.t  view on Meta::CPAN

    my $dur     = $pos - $pos;
    my %deltas  = $dur->deltas;
    my @compare = qw( days seconds nanoseconds );
    foreach (@compare) {

        # NaN != NaN (but should stringify the same)
        is(
            $deltas{$_} . '', $nan_string,
            "infinity - infinity = nan ($_)"
        );
    }

 view all matches for this distribution


Datify

 view release on metacpan or  search on metacpan

t/01-basic.t  view on Meta::CPAN

);

# 9e9999 should be infinity.
my @list = (
    9e9999 / 9e9999,
    "NaN",
    9e9999,
    "Infinity",
    "INF",
    123_456_789,
    -23_456_789.01,

t/01-basic.t  view on Meta::CPAN

        "Banana",
        "CHERRY",
        9e9999,             # Can be inf, 1.#INF, or some other values
        "INF",
        "Infinity",
        "NaN",
        9e9999 / 9e9999,    # Can be nan, -nan, 1.#IND, or some other values
    ),
);
is( \@sorted, \@expected, 'List sorts sensibly' )
    or do {

 view all matches for this distribution


Debian-Apt-PM

 view release on metacpan or  search on metacpan

examples/web/jquery-1.5.2.js  view on Meta::CPAN

	// A crude way of determining if an object is a window
	isWindow: function( obj ) {
		return obj && typeof obj === "object" && "setInterval" in obj;
	},

	isNaN: function( obj ) {
		return obj == null || !rdigit.test( obj ) || isNaN( obj );
	},

	type: function( obj ) {
		return obj == null ?
			String( obj ) :

examples/web/jquery-1.5.2.js  view on Meta::CPAN

		if ( typeof data === "string" ) {
			try {
				data = data === "true" ? true :
				data === "false" ? false :
				data === "null" ? null :
				!jQuery.isNaN( data ) ? parseFloat( data ) :
					rbrace.test( data ) ? jQuery.parseJSON( data ) :
					data;
			} catch( e ) {}

			// Make sure we set the data so it isn't changed later

examples/web/jquery-1.5.2.js  view on Meta::CPAN


		name = jQuery.cssProps[ origName ] || origName;

		// Check if we're setting a value
		if ( value !== undefined ) {
			// Make sure that NaN and null values aren't set. See: #7116
			if ( typeof value === "number" && isNaN( value ) || value == null ) {
				return;
			}

			// If a number was passed in, add 'px' to the (except for certain CSS properties)
			if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) {

examples/web/jquery-1.5.2.js  view on Meta::CPAN

			// IE has trouble with opacity if it does not have layout
			// Force it by setting the zoom level
			style.zoom = 1;

			// Set the alpha filter to set the opacity
			var opacity = jQuery.isNaN(value) ?
				"" :
				"alpha(opacity=" + value * 100 + ")",
				filter = style.filter || "";

			style.filter = ralpha.test(filter) ?

examples/web/jquery-1.5.2.js  view on Meta::CPAN

		var parsed,
			r = jQuery.css( this.elem, this.prop );
		// Empty strings, null, undefined and "auto" are converted to 0,
		// complex values such as "rotate(1rad)" are returned as is,
		// simple values such as "10px" are parsed to Float.
		return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
	},

	// Start an animation from one number to another
	custom: function( from, to, unit ) {
		var self = this,

examples/web/jquery-1.5.2.js  view on Meta::CPAN

		// Get or set width or height on the element
		} else if ( size === undefined ) {
			var orig = jQuery.css( elem, type ),
				ret = parseFloat( orig );

			return jQuery.isNaN( ret ) ? orig : ret;

		// Set the width or height on the element (default to pixels if value is unitless)
		} else {
			return this.css( type, typeof size === "string" ? size : size + "px" );
		}

 view all matches for this distribution


Debug-Flags

 view release on metacpan or  search on metacpan

ppport.h  view on Meta::CPAN

      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else

 view all matches for this distribution


( run in 3.029 seconds using v1.01-cache-2.11-cpan-9581c071862 )