From: Intransition Date: 2012-01-26T03:53:14+09:00 Subject: Re: Microrant on Ruy's Math Skills ------=_Part_2297_17483883.1327517590871 Content-Type: multipart/alternative; boundary="----=_Part_2298_15473299.1327517590872" ------=_Part_2298_15473299.1327517590872 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit I have tried this, but recently discovered the same issues arise. To review, instead of: (b-d) <= a && (b+d) >= a We use ratios: (a / b - 1).abs <= d But try 1.1, 1.0 and d=0.1 (1.1 / 1.0 - 1).abs <= 0.1 and it is false though it should be true b/c (1.1 / 1.0 - 1).abs #=> 0.10000000000000009 Which is exactly what instigated my micro-rant. Any advice? ------=_Part_2298_15473299.1327517590872 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit I have tried this, but recently discovered the same issues arise.

To review, instead of:

    (b-d) <= a && (b+d) >= a

We use ratios:

    (a / b - 1).abs <= d

But try 1.1, 1.0 and d=0.1

  (1.1 / 1.0 - 1).abs <= 0.1

and it is false though it should be true b/c

  (1.1 / 1.0 - 1).abs  #=> 0.10000000000000009

Which is exactly what instigated my micro-rant.

Any advice?

------=_Part_2298_15473299.1327517590872-- ------=_Part_2297_17483883.1327517590871--