integer division with float result

Matti Niemenmaa see_signature at for.real.address
Tue Nov 20 09:51:20 PST 2007


0ffh wrote:
> Even if fdiv takes as many cycles as idiv, you'll still
> have to add the time needed for the necessary casts.

True, there's some setup involved. I didn't check the code generated to get the
exact values, but on the Pentium 4, for instance, the FDIV instruction actually
takes some 5-10 cycles _less_ than the DIV/IDIV instruction. (If anybody wants
to research, see http://www.agner.org/optimize/instruction_tables.pdf )

Just pointing something out. Lars's point about accuracy is more relevant than
efficiency, anyway.

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list