On Mon, Mar 1, 2010 at 6:32 PM, ik wrote:
>
> http://ik.homelinux.org/
>
>
> On Mon, Mar 1, 2010 at 23:20, Jerry wrote:
>>
>> Don't compare floating points. Ever. Now you see why.
>
> So if I need for example to compare currency or something that is floating
> point, how do I do that ?
>
Let me
In our previous episode, Jerry said:
> I'm not sure but maybe Hewlett-Packard calculators use BCD. (HP
> calculators are known for their excellent numerical accuracy.
Yes, at least the Saturn based ones do IIRC. They have 64-bit (16 digit)
copro registers as you can see here:
http://en.wikiped
ik wrote:
>
> So if I need for example to compare currency or something that is
> floating point, how do I do that ?
I think the Currency type is ok (special case with special handling), but
other floating types are not.
Alternatively, work with Integer types only, and then when you need to
di
On Mar 1, 2010, at 2:32 PM, ik wrote:
http://ik.homelinux.org/
On Mon, Mar 1, 2010 at 23:20, Jerry wrote:
Don't compare floating points. Ever. Now you see why.
So if I need for example to compare currency or something that is
floating point, how do I do that ?
Also, don't write loops
On 01 Mar 2010, at 22:32, ik wrote:
> So if I need for example to compare currency or something that is floating
> point, how do I do that ?
If it's currency, use the currency type. The currency type is fixed point, not
floating point, and that's exactly because floating point is inexact while
http://ik.homelinux.org/
On Mon, Mar 1, 2010 at 23:20, Jerry wrote:
> Don't compare floating points. Ever. Now you see why.
>
So if I need for example to compare currency or something that is floating
point, how do I do that ?
>
> Also, don't write loops that calculate a floating point numbe
Don't compare floating points. Ever. Now you see why.
Also, don't write loops that calculate a floating point number which
is then tested for equality to exit the loop. Also, it is a bad idea
to test for > or < for exiting unless you know in advance an
accidental equality result will not yi
On 26 Feb 2010, at 11:37, ik wrote:
I've made a small test:
if (0.1+0.2) = 0.3 then
The only compiler/interpator that actually tells that it equal is FPC.
Then you are very lucky that FPC says it is equal.
I've tested it using Javascript (in Firefox), Ruby, Python, C (gcc)
and
Perl.
T
In our previous episode, ik said:
> I've made a small test:
>
> if (0.1+0.2) = 0.3 then
>
> The only compiler/interpator that actually tells that it equal is FPC.
>
> I've tested it using Javascript (in Firefox), Ruby, Python, C (gcc) and
> Perl.
>
> Except FPC, everyone tells that 0.1+0.2 = 0.