Skip to content

Commit

Permalink
Merge pull request #89 from diagrams/issue88
Browse files Browse the repository at this point in the history
bug fix: add special case for b==0 to quadform solver
  • Loading branch information
fryguybob committed Jul 2, 2013
2 parents 42df0f6 + 104ee98 commit e814f33
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Diagrams/Solve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ module Diagrams.Solve
, cubForm
) where

import Data.List (maximumBy)
import Data.Ord (comparing)
import Data.List (maximumBy)
import Data.Ord (comparing)

import Diagrams.Util (tau)
import Diagrams.Util (tau)

------------------------------------------------------------
-- Quadratic formula
Expand All @@ -31,7 +31,7 @@ quadForm a b c
-- so arbitrarily return 0
| a == 0 && b == 0 && c == 0 = [0]

-- c = 0
-- c /= 0
| a == 0 && b == 0 = []

-- linear
Expand All @@ -40,6 +40,9 @@ quadForm a b c
-- no real solutions
| d < 0 = []

-- ax^2 + c = 0
| b == 0 = [sqrt (-c/a), -sqrt (-c/a)]

-- multiplicity 2 solution
| d == 0 = [-b/(2*a)]

Expand Down

0 comments on commit e814f33

Please sign in to comment.