Forum Discussion
mchaas
Nimbostratus
Jan 09, 2009perl - negative value on "low"
Hi!
Hope that this post doesn't appear twice now, I had issues with my browser. If so - my apologies.
I'm having similar problems in perl, where I got the hint at Joe's weblog page:
http://devcentral.f5.com/weblogs/Joe/archive/2005/06/06/553.aspx
But it seems that Math::BigInt in perl doesn't deal with negative low-values either, does it?
Or maybe I am missing something?
Following situation when collecting Virtual Server Statistics, bytesout in this case:
(Code-snip)
$low = $Statsarray[1]->{"value"}->{"low"};
$high = $Statsarray[1]->{"value"}->{"high"};
$bytesout = Math::BigInt->new($high)->blsft(32)->bxor($low);
print "\nLow: " . $low . "\nHigh: ". $high . "\n => " . $bytesout . "\n";
(/Code-snip)
(output)
Low: -2094819476
High: 200411
=> -860760785578132
(/output)
How can I proceed with the low value when it is negative?
Did I get that right: The inverted sign in the low value signals, that high is not 0.
Is it valid to just turn the negative sign into a positive for further calculations?
Thanks in advance and best regards,
Matt
- mchaas
Nimbostratus
Hi again, - hwidjaja_37598
Altostratus
Try this out:Math::BigInt->new(sprintf("%u",$high))->blsft(32)->bior(sprintf("%u", $low));
- mchaas
Nimbostratus
Hi again!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects