[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Math::BigFloat Question"



Yet again my cfm68k system doesn't give an expected response. I get:
This is $big: -1
This is $big: -1
This is $big: -1
This is $big: -1
This is $big: -1
The largest number is: 0. at position .

At 13:21 +0000 25/04/2000, Na'im Tyson wrote:
>#!/usr/local/bin/perl
># activ2vector.pl --> takes out activation patterns and returns them to
># their binary vector representations
>
>use Math::BigFloat;
>
>@target_output = ('0.0009', '0.5000', '0.2298', '0.7541', '0.7599');
>
>largest_float(*target_output);
># make_pattern(*target_vect);
>
>
>### finds largest number in array ###
>
>sub largest_float {
>
>          $lar_float = Math::BigFloat->new("0.0000");
>        # $lar_float = 0;
>
>
>
>        local *target_output = shift @_;
>
>        for ($eout = 0; $eout < @target_output; $eout++) {
>        #       if ($lar_float < $target_output[$eout]) {
>        #               $lar_float  = $target_output[$eout];
>        #               $pos = $eout;
>        #       }
>
>                           $out=Math::BigFloat->new("$target_output[$eout]");
>
>                $big = $out->fcmp("$lar_float");
>
>                print 'This is $big: ', "$big\n";
>
>        if ($big == 1) {  # i.e. if this float is larger
>                          # than the largest float value
>                $lar_float = Math::BigFloat->new("$out");
>$pos = $eout
>        }
>
>        }
>
>        print "The largest number is: ", "$lar_float", " at position $pos.\n";
>
>        # $target_vect[$pos] = 1;
>
>        # return @target_vect;
>
>}
>
>### end largest_float ###
>
>



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org