#!/usr/bin/perl
use strict;
my $plus = shift;
my $minus = shift;
my $sum = $plus + $minus;
my $rep = $plus - $minus;
my $mean = $rep / $sum;
#ALERT: semi-empirical formulae ahead
my $tension = (1 - $mean ** 2) * $sum * 2 / (2 - 1 / (1 + abs $rep));
$tension = log (1 + $tension) - 2;
my $literal;
for ($tension) {
$_ <= 0 and $literal = 'no', last;
$_ <= 1 and $literal = 'low', last;
$_ <= 2 and $literal = 'medium', last;
$literal = 'high';
}
printf <<"EOF", $plus, $minus, $rep, $tension, $literal;
Plus = %3d
Minus = %3d
Reputation = %3d
Tension = %.3f
There is %s tension on this post.
EOF