Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Perlish Tension

by giulienk (Curate)
on May 17, 2002 at 23:53 UTC ( #167443=note: print w/ replies, xml ) Need Help??

in reply to Re: Re: Front Page with Negative Rep..
in thread Front Page with Negative Rep..

Here is a possible implementation of the <tension> parameter.

#!/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



Comment on Perlish Tension
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://167443]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-11-30 20:31 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (782 votes), past polls