On Tue, Jun 12, 2012 at 4:11 PM, William Stein <wst...@gmail.com> wrote: > On Tue, Jun 12, 2012 at 3:54 PM, rych <rych...@gmail.com> wrote: >> Interval arithmetics also gives False, >> >> sage: from mpmath import iv >> sage: # iv.prec = 24 >> sage: # iv.prec = 53 # for double precision >> sage: x = 0.1 >> sage: iv.prec = x.prec() # precision of Sage Real numbers, 53 >> sage: iv.pretty = True >> sage: iv.mpf('10.44') >> [10.439999999999999503, 10.440000000000001279] >> sage: iv.mpf('10.44')-iv.mpf('10.30') >> [0.13999999999999879208, 0.14000000000000234479] >> sage: iv.mpf('0.14') >> [0.13999999999999998557, 0.14000000000000001332] >> sage: iv.mpf('10.44')-iv.mpf('10.30') == iv.mpf('0.14') >> False >> sage: iv.mpf('10.44')==iv.mpf('10.44') >> True > > Another approach to interval arithmetic: > > sage: RIF > Real Interval Field with 53 bits of precision > sage: RIF('10.44') - RIF('10.30') > 0.14000000000000? > sage: RIF('10.44') - RIF('10.30') == RIF('0.14') > False > sage: a = RIF('10.44') - RIF('10.30'); b = RIF('0.14') > sage: a in b > False > sage: b in a > True
sage: a.intersection(b) 0.1400000000000000? sage: 0 in (a-b) True -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org