Talk:Price fraction: Difference between revisions

The task can and has been implemented
(1. It is not rounding. 2. It cannot be implemented anyway)
(The task can and has been implemented)
Line 98:
== The task cannot be implemented ==
Another issue with this task is that all provided implementations are broken. The problem is that some of the values from the table simply cannot be represented in the floating-point format based on either 2 or 16 radix. This covers basically all known modern machines. Since these values are non-existent the task cannot be implemented. The moral: don't use floating-point numbers in place of the fixed point ones. --[[User:Dmitry-kazakov|Dmitry-kazakov]] 18:22, 6 August 2010 (UTC)
 
: These values certainly can be implemented. If your language's floating point implementation does not include any provisions for representing decimal fractions using floating point you can multiply the numbers by 100 and use integers, internally, in your code. (Multiplying by 100 and rounding would be good practice, also, if you were performing sums on these numbers.) --[[User:Rdm|Rdm]] 18:28, 6 August 2010 (UTC)
6,962

edits