in reply to Re: Re: Float values from MS SQL Server.
in thread Float values from MS SQL Server.

I have converted the 422420.0 value to an INT and removed the problem of '422420.0'. But the error messages stay the same. So I guess Perl can handle '422420.0' without any problems. There must be a problem with the equations. The equations take the form:
my $numerator_L = 2*($SUM_ni-$SUM_xi); + my $denominator_L = 2*$SUM_xi; + my $numerator_U = 2*($SUM_xi+2); + my $denominator_U = 2*($SUM_ni-$SUM_xi);

Replies are listed 'Best First'.
Re: Re: Re: Re: Float values from MS SQL Server.
by matija (Priest) on Mar 04, 2004 at 10:22 UTC
    Can you print $SUM_ni and $SUM_xi just before that equation? Never mind what you think is in there, let's see what is realy in there.

    Then we can determine if the actual problem is realy the format of the numbers or something else...

Re: Re: Re: Re: Float values from MS SQL Server.
by Win (Novice) on Mar 04, 2004 at 10:28 UTC
    In summary. This bit of code gives:
    while ( my @col_col = $sthZK_Update_extract->fetchrow() ) { my $Key_m = $col_col[0]; my $Cause = $col_col[1]; my $Aggregated_area = $col_col[2]; my $SUM_wixi = $col_col[3]; my $SUM_wi = $col_col[4]; my $SUM_xi = $col_col[5]; my $SUM_ni = $col_col[6]; my $Sum_wi2xi = $col_col[7]; print "\n^^^^^^\n$Key_m, $Aggregated_area, $Cause, $SUM_wixi, $S +UM_wi, $SUM_xi, $SUM_ni, $Sum_wi2xi\n"; } my $numerator_L = 2*($SUM_ni-$SUM_xi); my $denominator_L = 2*$SUM_xi; my $numerator_U = 2*($SUM_xi+2); my $denominator_U = 2*($SUM_ni-$SUM_xi);
    Gives:
    ^^^^^^ 1, All, Circulatory_Disease, 2.1323785396701751E-4, 4.4283294159368431 +E-6, 1376, 4224420, 3.3947194253425559E-11 Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1210. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1210. Use of uninitialized value in multiplication (*) at Creating_table_ZZI +_Paul.pl l ine 1211. Use of uninitialized value in addition (+) at Creating_table_ZZI_Paul. +pl line 12 16. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1217. Use of uninitialized value in subtraction (-) at Creating_table_ZZI_Pa +ul.pl line 1217. Invalid n: 0
      Hi,

      Your problem is a scoping issues. You declare the variables as my variables in the while loop. After this loop, the variables will be gone. The solution is to declare these variables above the while loop.

      ALWAYS put use strict; use warnings; at the top of your Perl programs.

      Regards,

      Marcel