Jump to content

Talk:Continued fraction/Arithmetic/G(matrix ng, continued fraction n1, continued fraction n2): Difference between revisions

(→‎Non-unique solutions: One of the more recently standardized areas it seems)
Line 19:
 
:::: My point is that there is no guarantee that a sequence is actually unique. The fundamental issue is that there are two ways of solving the integer division problem when extending into producing negative results: one states that the sign is an indication of the sign of the inputs, and the other states that division is about partitioning the number line and indicating which partition. (Alternatively, one definition of integer division uses round-to-zero and the other uses round-down rules when converting from a non-integer intermediate result; I've never heard of a universally-accepted definition of which of those two is right.) As long as <math>a = b\times (a/b) + (a\%b)</math> is true, mathematical sanity is maintained. Different languages have different rounding rules. (BTW, [[C]] prior to C99 has implementation-defined rounding rules[http://stackoverflow.com/q/3602827/301832]. With [[C++]], I think C++11 is the first revision of the standard to define this clearly[http://stackoverflow.com/q/319880/301832].) –[[User:Dkf|Donal Fellows]] 15:24, 12 March 2013 (UTC)
 
::::: Is your point that you want the task defining so that it has a unique solution? I have shown that both are used in other places so it is dificult to say one is right. Interestingly that which [[User:Spoon!|Spoon!]] says above is true for Python2 but Python3 returns a floating point. So if I define Q/R as A remainder B where A=trunc(Q/R) and B=Q-A*R Python2 will produce your answer and Python3 will produce the better answer. How cool is that? UberKool or what? A killer reason to upgrade to Python3!!!--[[User:Nigel Galloway|Nigel Galloway]] 12:50, 13 March 2013 (UTC)
2,172

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.