view release on metacpan or search on metacpan
lib/Clay/UI/_validate.pm view on Meta::CPAN
sub _fail ($name, $message) {
croak_ui "Clay::UI: '$name' $message";
}
# A plain (non-reference) number that is neither NaN nor infinite.
sub is_finite_number ($value) {
return defined $value && !ref $value && looks_like_number($value)
&& $value == $value && $value != 9**9**9 && $value != -9**9**9;
}
lib/Clay/UI/_validate.pm view on Meta::CPAN
start with C<anon:>, user sizing-group ids must stay at or below
C<USER_GROUP_ID_MAX> (C<2**20 - 1>; L<Clay::UI::Grid> packs its own ids
above it), text must be a defined string, and C<border_width> may also
be a single number.
C<is_finite_number> is true for a plain number that is neither NaN nor
infinite. C<copy_value> deep-copies hashes and arrays (blessed ones
into plain data) and keeps scalars and objects with overloading as they
are.
This module is internal. The API is not part of the public contract.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ClickHouse/Encoder.pm view on Meta::CPAN
C<UInt32>, C<UInt64>.
=item *
Floats: C<Float32>, C<Float64>, C<BFloat16> (CH 24.x; 2-byte truncated
Float32). C<Inf>, C<-Inf>, and C<NaN> are preserved.
=item *
Strings: C<String> (length-prefixed bytes), C<FixedString(N)> (N bytes,
null-padded). Both pass the SV's bytes through unchanged: a UTF-8 string
lib/ClickHouse/Encoder.pm view on Meta::CPAN
Numeric SV with the float flag set (C<SvNOK>): non-integer value ->
C<Float64>; a NV that happens to equal an integer (e.g. C<1.0>)
collapses to C<Int64> on the wire, mirroring CH's own C<JSONEachRow>
inference. Round-trip then decodes back as an integer; to keep an
integer-valued float as C<Float64> use a dedicated C<Float64> column
or a C<<< Variant(Float64, ...) >>>. C<NaN> and C<Inf> stay C<Float64>.
=item *
Blessed scalarref into C<JSON::PP::Boolean>, C<JSON::XS::Boolean>,
C<Types::Serialiser::Boolean>, C<Cpanel::JSON::XS::Boolean>, or
view all matches for this distribution
view release on metacpan or search on metacpan
examples/jquery-1.6.2.min.js view on Meta::CPAN
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu Jun 30 14:16:56 2011 -0400
*/
(function(a,b){function cv(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cs(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("ifram...
shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\...
)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bi(a,d),e=bj(a),g=bj(d);for(h=0;e[h];++...
view all matches for this distribution
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
examples/helloworld/htdocs/dwarf/bootstrap/js/bootstrap.js view on Meta::CPAN
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
// $.fn.offset doesn't round pixel values
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cn/Bioinf.pm view on Meta::CPAN
my $c = uc $_[0];
$c =~ s/\ACHR//;
$Chrom_alias{$c} // $c;
}
# A decimal number, as an effect_weight must be. Infinity and NaN, which
# looks_like_number would take, are left out, as either would make every score
# the same non-number.
my $Number = qr/\A[-+]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+)(?:[eE][-+]?[0-9]+)?\z/;
# The rows of the option $what ("weights" for pgs_score, "model" for
lib/Cn/Bioinf.pm view on Meta::CPAN
# exp() of each of @$eta, divided by their sum: the probabilities a multinomial
# logistic regression gives its categories. The largest is taken out first, so
# that a linear predictor big enough to overflow exp() (about 710 on an IEEE
# double, and larger on a long-double or quadmath perl) gives 1 and the rest 0
# rather than inf/inf, which is NaN.
sub _softmax {
my ($eta) = @_;
my $max = $eta->[0];
foreach my $e (@{ $eta }) { $max = $e if $e > $max }
my @exp = map { exp($_ - $max) } @{ $eta };
lib/Cn/Bioinf.pm view on Meta::CPAN
C<pgs_score>'s must, and a gzipped file that ends early dies.
For each category the linear predictor is its intercept plus the sum of its
betas times the genotypes, and the probabilities are C<exp> of those over their
sum. The largest is taken out before C<exp>, so a linear predictor large enough
to overflow gives 1 rather than a NaN.
=head3 Arguments
=over
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Cn/Util.pm view on Meta::CPAN
# '%.0u' is the documented way to ask for a whole number, but sprintf
# prints nothing for it only when the hundredths are 0: 1234.56 came out
# "1,23456". So '%.0u' is recognised here, rounds half up to a whole
# number, and prints no fraction at all.
my $whole = $format eq '%.0u';
# Infinity and NaN are returned as perl prints them. Run through the
# arithmetic below they came out "Inf.NaN", "-Inf.NaN" and "NaN.NaN".
# $n - $n is NaN for exactly these, and NaN is the one value not equal to
# itself.
my $diff = $n - $n;
return "$n" if $diff != $diff;
my $neg = $n < 0;
my $abs = abs $n;
lib/Cn/Util.pm view on Meta::CPAN
die "$json_filename doesn't exist or isn't a file" unless -f $json_filename;
die "$json_filename has 0 size" if -s $json_filename == 0;
open my $fh, '<:raw', $json_filename or die "can't read $json_filename: $!";
my $json = do { local $/; <$fh> }; # slurp; $/ restored immediately
close $fh;
# Python/NumPy emit bare NaN / Infinity / -Infinity, which are not valid
# JSON. Rewrite them to null (-> undef) only when they sit in JSON value
# position (after '[', ',' or ':', or as the whole document, which Python
# writes for json.dumps(float('nan')) and which used to reach decode_json
# unchanged and die there). That test alone also matched text
# inside a string -- "values: [1, NaN, 2]" became "values: [1, null, 2]"
# -- so the first alternative matches each whole string literal and
# (*SKIP)(*FAIL) resumes the scan after its closing quote.
#
# That scan is slow: on a 43 MB file of 300,000 records it took 2.1 s, to
# decode_json's 0.30 s (Cpanel::JSON::XS), measured 2026-11-09. The two
# index() calls that rule it out took 4.5 ms there, so a file with neither
# word, which is most of them, is not scanned at all.
$json =~ s/"(?:[^"\\]++|\\.)*+"(*SKIP)(*FAIL)|(?:\A|[\[,:])\s*\K-?(?:NaN|Infinity)(?=\s*(?:[,\]}]|\z))/null/gs
if index($json, 'NaN') >= 0 || index($json, 'Infinity') >= 0;
require JSON::MaybeXS; # ~4.3 ms
return JSON::MaybeXS::decode_json($json);
}
# These return *some* key/value from the hash, not a random one -- whichever
lib/Cn/Util.pm view on Meta::CPAN
format_commas(1234567, '%.0u'); # '1,234,567'
format_commas(999999.999); # '1,000,000.00'
format_commas(-0.5); # '-0.50'
format_commas(1e20); # '100,000,000,000,000,000,000.00'
Puts a comma between each group of three digits of the integer part and appends the hundredths, rounded half up. The second argument is the C<sprintf> format the hundredths are printed with, C<'.%02d'> by default; C<'%.0u'> rounds half up to a whole...
What is rounded is the number perl holds, which is binary, not the decimal written in the source. Most decimal fractions have no exact binary form, so a value written as exactly half a cent is stored a little above or below it, and rounds accordingl...
=head2 json_file_to_ref
my $ref = json_file_to_ref('results.json');
Reads a JSON file and returns the decoded data, through C<JSON::MaybeXS>. Python's C<json> module and NumPy write C<NaN>, C<Infinity> and C<-Infinity> as bare words, which are not JSON; where one of those stands as a value, or is the whole document,...
=head2 ref_to_json_file
ref_to_json_file($data, 'results.json'); # prints "Wrote results.json"
view all matches for this distribution
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
src/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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
share/js/jquery-1.11.3.js view on Meta::CPAN
/* jshint eqeqeq: false */
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
},
isEmptyObject: function( obj ) {
share/js/jquery-1.11.3.js view on Meta::CPAN
while ( j < len ) {
first[ i++ ] = second[ j++ ];
}
// Support: IE<9
// Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
if ( len !== len ) {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
share/js/jquery-1.11.3.js view on Meta::CPAN
// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
share/js/jquery-1.11.3.js view on Meta::CPAN
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set. See: #7116
if ( value == null || value !== value ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
share/js/jquery-1.11.3.js view on Meta::CPAN
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
// Update tween properties
view all matches for this distribution
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
lib/Color/TupleEncode/2Way.pm view on Meta::CPAN
hzero 180 cyan 1
240 blue 1.5
270 violet 2
300 purple 3
315 purple 4
0 red INF, NaN (y=0)
=head2 Saturation
The saturation is calculated using the size of the 2-tuple, C<r = sqrt( x**2 + y**2 )>. Depending on the value of C<power>,
view all matches for this distribution
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
src/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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
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
view release on metacpan or search on metacpan
lib/Config/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