GCC-Builtins

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        Created benchmarks comparing clz() XS vs PP.
        Enhanced documentation.

0.04    2024/03/20 - 22:00
        There are now 36 GCC Builtins functions exported and readily available to Perl.

0.05    2024/04/12 - 13:00
        Changed the test files > 666-*.t so that it attempts to detect if expected result is a number. If it is, then expected and returned results are checked on their abs difference being less than a small number, instead of comparing their equalit...

0.06    2024/08/26 - 20:00
        In some systems (e.g. perl 5.12.5) expected 'Inf' or 'NaN' return values from a GCC builtin yield lower-case 'inf' and 'nan', failing the test. So, test files comparing expected and yielded values lower-case the "comparees" before the compari...
	Added to the documentation.


sbin/build-gcc-builtins-package.pl  view on Meta::CPAN

	'ffsll' => '2',
	'huge_val' => 'Inf',
	'huge_valf' => 'Inf',
	'huge_vall' => 'Inf',
	'inf' => 'Inf',
	'infd32' => 'Inf',
	'infd64' => 'Inf',
	'infd128' => 'Inf',
	'inff' => 'Inf',
	'infl' => 'Inf',
	'nan' => 'NaN',
	'nanl' => 'NaN',
	'nanf' => 'NaN',
	'parity' => '1',
	'parityl' => '1',
	'parityll' => '1',
	'popcount' => '1',
	'popcountl' => '1',
	'popcountll' => '1',
	'powi' => '6.5536',
	'powil' => '4',
	'powif' => '6.55359983444214',
);

t/690-nan.t  view on Meta::CPAN

use 5.006;
use strict;
use warnings;
use Test::More;

our $VERSION = '0.06';

use GCC::Builtins qw/:all/;

my $res = nan('some string');
my $expected = "NaN";
if( $expected =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ){
	my $dif = abs($res-$expected);
	ok($dif<1e-09, "called nan('some string') returned ($res) and expected ($expected) values differ ($dif) by less than 1e-09.");
} else {
	is(lc($res), lc($expected), "called nan('some string') returned ($res) and expected ($expected) values are identical.");
}
diag("copy-this-expected-value 'nan' => '$res',");

done_testing();

t/691-nanf.t  view on Meta::CPAN

use 5.006;
use strict;
use warnings;
use Test::More;

our $VERSION = '0.06';

use GCC::Builtins qw/:all/;

my $res = nanf('some string');
my $expected = "NaN";
if( $expected =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ){
	my $dif = abs($res-$expected);
	ok($dif<1e-09, "called nanf('some string') returned ($res) and expected ($expected) values differ ($dif) by less than 1e-09.");
} else {
	is(lc($res), lc($expected), "called nanf('some string') returned ($res) and expected ($expected) values are identical.");
}
diag("copy-this-expected-value 'nanf' => '$res',");

done_testing();

t/692-nanl.t  view on Meta::CPAN

use 5.006;
use strict;
use warnings;
use Test::More;

our $VERSION = '0.06';

use GCC::Builtins qw/:all/;

my $res = nanl('some string');
my $expected = "NaN";
if( $expected =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ ){
	my $dif = abs($res-$expected);
	ok($dif<1e-09, "called nanl('some string') returned ($res) and expected ($expected) values differ ($dif) by less than 1e-09.");
} else {
	is(lc($res), lc($expected), "called nanl('some string') returned ($res) and expected ($expected) values are identical.");
}
diag("copy-this-expected-value 'nanl' => '$res',");

done_testing();



( run in 1.185 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )