From: Christian Neukirchen Date: 2006-10-01T03:54:11+09:00 Subject: Re: Integer division with / - request explanation of behavior Jeremy Tregunna writes: > On 06-09-30, at 11:11, Eero Saynatkari wrote: > >> On 2006.09.30 18:25, Paul Lutus wrote: >>> Wes Gamble wrote: >>> >>>> Today I discovered the difference in the meaning of the / >>>> (arithmetic >>>> divide) method depending on whether it's caller is an integer or a >>>> float. >>> >>> Not exactly. The result is expressed in the type of the more >>> precise of the >>> two operands. >> >> Actually, integers are more precise than IEEE floating points >> since 2.2 - 1.2 != 1.0 :) s/precise/accurate ! > > Not on all platforms. For instance, in Ocaml, it's true: > > # 2. -. 1. = 1.;; > - : bool = true No, it doesnt. Darwin lilith 7.9.0 Objective Caml version 3.08.3 # 2.2 -. 1.2 = 1.0;; - : bool = false Due to how IEEE floats work, all operations on whole numbers will always be exact. > Jeremy Tregunna -- Christian Neukirchen http://chneukirchen.org