Talk:Arithmetic/Rational: Difference between revisions

Line 23:
 
::Huh, technically, numbers in all computer languages I know are rational. Integer, fixed- and floating-point numbers of any natural radix are rational. Well, ideals NaN and +/-Inf of IEEE 754 aren't rational, though this does not count, because the rest is rational. I remotely remember some implementations of numbers based on Pi or e radix. Those are not rational. Complex numbers are not rational, of course. IMO the task name is quite misleading. It is looks more like a certain representation of rational numbers to be used in order to implement a certain subset of [http://en.wikipedia.org/wiki/Rational_number Q]. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 14:10, 14 February 2009 (UTC)
:::Of course. Looking at the implementation, what the task-writer means is a way of storing rational numbers explicitly as fractions of integers (numerators and denominators), and defining operators acting on these rather than on the whole rational number stored directly (as floating point). The languages that ''already implement rational numbers'' are those languages that treat rational numbers expressed explicitly as fraction of integers in a "natural" way, allowing to grab numerators and denominators, and doing automatic simplification (from 314/100 to 157/50 e.g.), and other operations avoiding computer floating point arithmetic --[[User:ShinTakezou|ShinTakezou]] 21:05, 14 February 2009 (UTC)
 
IMHO It certainly should be noted if a language already has Rational