in reply to solving for x

my $percentage = 12.7; my $wanted_to_charge = 100; my $need_to_charge = $wanted_to_charge * ( 1+ $percentage/100);

Replies are listed 'Best First'.
Re^2: solving for x
by Roy Johnson (Monsignor) on Nov 18, 2004 at 21:43 UTC
    That is right if the percentage is calculated relative to the net. Usually, it's done as a percentage of the total charge. Example:
    My company bills the client $60/hour, and takes 20% of that, leaving me 80% of $60, or $48 per hour. If I want the net to me to be $60, the equation is:
    .8 * X = 60 ...solving for X... X = 60 / .8 = 75 ... or more generally: Gross_Charge = Net_Pay / (100 - percentage)%

    No Perl code was harmed -- or even used -- in the production of this post.