Skip to content
This repository

Finding LCM #321

Open
wants to merge 9 commits into from

3 participants

Boopathi Rajaa Jeff Schroeder Matthijs van der Vleuten
Boopathi Rajaa

No description provided.

Jeff Schroeder
Collaborator
SEJeff commented May 06, 2013

Can you please run:

git remote add upstream git://github.com/graphite-project/graphite-web.git
git pull --rebase upstream master

It really ticks off my inner OCD seeing completely pointless merge commits.

Boopathi Rajaa

done .. !!

webapp/graphite/render/functions.py
((16 lines not shown))
123 124
 
124 125
 def normalize(seriesLists):
  126
+  print seriesLists
2
Matthijs van der Vleuten
zr40 added a note May 07, 2013

Might want to remove this print :)

Boopathi Rajaa
boopathi added a note May 07, 2013

;) .. did that in the next commit .. !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Jeff Schroeder
Collaborator
SEJeff commented May 09, 2013

@boopathi Would you mind if I rebase squashed these into 1 commit to remove the add/remove pointless commits and the merge commits?

Boopathi Rajaa

Nope!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 5 additions and 4 deletions. Show diff stats Hide diff stats

  1. 9  webapp/graphite/render/functions.py
9  webapp/graphite/render/functions.py
@@ -113,13 +113,14 @@ def safeAbs(value):
113 113
   if value is None: return None
114 114
   return abs(value)
115 115
 
  116
+def gcd(a,b):
  117
+  if b == 0: return a;
  118
+  return gcd(b, a%b);
  119
+
116 120
 def lcm(a,b):
117 121
   if a == b: return a
118 122
   if a < b: (a,b) = (b,a) #ensure a > b
119  
-  for i in xrange(1,a * b):
120  
-    if a % (b * i) == 0 or (b * i) % a == 0: #probably inefficient
121  
-      return max(a,b * i)
122  
-  return a * b
  123
+  return a / gcd(a,b) * b
123 124
 
124 125
 def normalize(seriesLists):
125 126
   seriesList = reduce(lambda L1,L2: L1+L2,seriesLists)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.