Last active
December 11, 2015 00:28
-
-
Save jasonelston/4516825 to your computer and use it in GitHub Desktop.
problem getting Math.acos working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# paste this into the console to see the results are sometimes good and then sometimes the error | |
# Math::DomainError: Numerical argument is out of domain - "acos" | |
# Error ref - http://www.ruby-doc.org/core-1.9.3/Math/DomainError.html | |
@loc1 = FactoryGirl.create(:location) | |
Location.all.each do |location| | |
location.nearby?(@loc1) | |
end | |
### some stuff to break down the algorithm | |
first_term = @loc1.term1 * @loc1.term2 | |
second_term = @loc1.term3 * @loc1.term4 | |
third_term = Math.cos(@loc1.term5 - @loc1.term6) | |
# result = first_term + second_term * third_term | |
# Math.acos(result) | |
Math.acos(first_term + second_term * third_term) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
some of the calibration terms are different on a committed record so when you reference the committed record it's different to the reference of the created record (for the same record id)