in reply to Re: Strange math issue with Net::SFTP (Pari)
in thread Strange math issue with Net::SFTP

So if the root of my problem is caused by Math::Pari then I should be able to convert it to a number and then calculate the percentage. I had trying messing with Math::Pari some the other day but had no such luck... I will keep trying.

  • Comment on Re^2: Strange math issue with Net::SFTP (Pari)

Replies are listed 'Best First'.
Re^3: Strange math issue with Net::SFTP (Pari)
by vendion (Scribe) on May 29, 2012 at 17:40 UTC

    Ok so after changing my callback sub to this

    sub callback { my ( $sftp, $data, $offset, $size ) = @_; use Math::Pari qw( :DEFAULT PARI pari2num ); print 'offset is a: '; print ref $offset; print "\n"; $offset = pari2num($offset); print 'now offset is a: '; print ref $offset; print "\n"; print 'size is a: '; print ref $size; print "\n"; $size = pari2num($size); print 'now size is a: '; print ref $size; print "\n"; my $percent = ($offset/$size) * 100; print "percent=$percent\n"; return; }

    Things now start to make sense to me in the output:
    offset is a: now offset is a: offset=0 size is a: Math::Pari size is a: size=666974 percent=0 offset is a: now offset is a: offset=8192 size is a: Math::Pari size is a: size=666974 percent=1.22823378422547 offset is a: now offset is a: offset=16384 size is a: Math::Pari size is a: size=666974 percent=2.45646756845094