The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use Test::More;
use PDL::LiteF;
BEGIN {
        eval " use PDL::Fit::Polynomial; ";
        plan skip_all => "PDL::Fit::Polynomial: $@" if $@;
}

kill INT,$$ if $ENV{UNDER_DEBUGGER}; # Useful for debugging.
plan tests => 1;

$x = sequence(20)-10;
$y = 30-2*$x+3*$x**2-2*$x**3;

# Random numbers, generated by  grandom($y)*100
# Hard-wired to avoid OS seed variations barfing test

$rand = pdl qw/65.735917 -40.510143 -122.07767 -19.591344 -139.76362  
106.44639 -0.30094068 -5.3129683  49.815455  97.247868 -9.3130775  
19.585472  8.5260268 -194.49596  73.822799  25.628967  133.36015 -2.6611465  
9.0335632 -0.82946383/;

$y += $rand;

#points $x,$y;

$yfit = fitpoly1d($x,$y,4);

#hold; line $x, $yfit;

ok(max(abs($y-$yfit)) < 220); # need to add 10 for windows