Re: What is the fastest way of getting the fraction part of a floating point number?
- From: "robertwessel2@xxxxxxxxx" <spamtrap@xxxxxxxxxx>
- Date: 2 Feb 2006 23:32:42 -0800
\\\o///annabee wrote:
På Thu, 2 Feb 2006 15:29:06 -0800 (PST), skrev Phil Carmody
<spamtrap@xxxxxxxxxx>:
<<<
What is the fastest way of getting the fraction part of a floating point
number?
So, if I have a float 10.3 what is the fastest way of getting a float
with
the value 0.3?
Add 2^0, subtract 2^0, what's the difference between what you now have
and your
original number?
Add 2^1, subtract 2^1, what's the difference ...
...
...
eventually, you will find the answer.
(hint - start at about 2^50 to save 50 iterations)
Phil "why don't they teach this stuff anymore" Carmody
Is it faster then 9 cycles?
I tried this :
fld D§fpu_test32
and D§fpu_test32_2 FractionFlag ;clears fraction bits
fld D§fpu_test32
fsubp ST1 ST0
fstp D§fpu_test32
9 cycles.
Assuming I've guessed the contents of "FractionFlag" correctly
(0xff800000), that basically subtracts the largest power of two smaller
than the input number from the input, which is not what the OP asked
about. For an input of 10.3, the OP wanted the result .3, not 2.3.
.
- Follow-Ups:
- Re: What is the fastest way of getting the fraction part of a floating point number?
- From: \\\\\\o///annabee
- Re: What is the fastest way of getting the fraction part of a floating point number?
- References:
- Re: What is the fastest way of getting the fraction part of a floating point number?
- From: Phil Carmody
- Re: What is the fastest way of getting the fraction part of a floating point number?
- From: \\\\\\o///annabee
- Re: What is the fastest way of getting the fraction part of a floating point number?
- Prev by Date: Re: Pulling bitFields efficiently from a byte stream
- Next by Date: Re: What is the use of PREFETCHNTA?
- Previous by thread: Re: What is the fastest way of getting the fraction part of a floating point number?
- Next by thread: Re: What is the fastest way of getting the fraction part of a floating point number?
- Index(es):
Relevant Pages
|