Boost logo

Boost :

From: Guillaume Melquiond (guillaume.melquiond_at_[hidden])
Date: 2003-12-12 12:04:55


Le ven 12/12/2003 à 17:08, Dan W. a écrit :
> > No need to go as far as using assembly language. There are C functions
> > that work just fine like nearbyint or rint (the second one is usually
> > faster). And if you are really looking for assembler, the frndint
> > instruction is available on x86 for exemple.
>
> Not familiar with those, but I just came up with something that should
> work...

[... snipped ...]

> -------------------------------------------------------------------
> (sorry if my syntax offends, I'm rusty in assembler these days)
>
> That should add up to just four integer instructions, with optims' ON.
> Not totally sure that the sign bit would always survive; would need to
> test it.
>
> Cheers!

Is this some kind of joke? What did you expect when you posted this
mail? Please refrain from going wild on a public-mailing list.

Most processors have an opcode to round a floating-point value to an
integer. For example, as I said, this instruction is called frndint on
x86 (how do you think floor, rint and ceil are coded?). Don't try to
emulate a floating-point unit by using a handful of integer operations.
First it will be completely wrong (it's not as easy as you seem to
believe), and second it will be slow.

Guillaume


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk