Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Calculating base difference of numbers

by pc88mxer (Vicar)
on May 31, 2008 at 17:01 UTC ( [id://689446]=note: print w/replies, xml ) Need Help??


in reply to Calculating base difference of numbers

Are we talking about basis points? Mathematically they are defined simply as 1/100-th of 1% or .0001.
  • Comment on Re: Calculating base difference of numbers

Replies are listed 'Best First'.
Re^2: Calculating base difference of numbers
by Anonymous Monk on May 31, 2008 at 22:02 UTC
    Yes...and I feel stupid that I can't work it out...should be a simple mathematical equation.
      my $diff = ($new*10000) - ($old*10000);
      Or if you want to round it,
      my $diff = 0 + sprintf '%.0f', ($new*10000) - ($old*10000);

      Update: The *10000 can be factored out: ($new-$old)*10000

        If you run the math that doesn't work.

        old => 100.25 new => 100.26

        diff = (100.26 * 10000) - (100.25 * 10000)
        = 100

        when in fact the basis point movement is 1

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-04-23 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found