Skip to content

Conversation

@thatguyintech
Copy link
Owner

please comment, critique, and discuss! The more you explain your thoughts, the faster I can update / discuss / and learn :)

Thanks!

YdigitsAfterDecimal = ySplit[1]


digitsAfterDecimal = max(len(XdigitsAfterDecimal), len(YdigitsAfterDecimal))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of doing all this work, why not use the problem description where it says "It is guaranteed that both x and y will have at most 5 digits after the decimal point."

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true


r = -1
while r != 0:
r = round(a % b, 6) * 1.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to do floating point math here? since you multiplied x and y by a power of 10 to make them effectively integers, can't you just run gcd in its integer form?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need the rounding but not the float coercion actually

@thatguyintech thatguyintech merged commit a797ab8 into master May 4, 2017
@thatguyintech thatguyintech deleted the day21 branch May 4, 2017 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants