Re: Singles to Doubles
- From: "Karl E. Peterson" <karl@xxxxxxxx>
- Date: Tue, 17 Jul 2007 09:07:11 -0700
dpb <none@xxxxxxx> wrote:
Karl E. Peterson wrote:
Jim Mack <jmack@xxxxxxxxxxxxxxx> wrote:
And now that I think of it...
Temp# = CDbl(Int(OldSingle! * 1.0E+07!))
NewDouble# = Temp# / 1.0D+07#
How fast is that? How accurate?
I lied. That was really easy to plug in. It took about 0.7s on the same test
where the string conversion took 3.2s -- very respectable. Accuracy was
identical to the CCur route, but then I didn't have anything that was using the
low-end digits. ...
Can you use a mixed-language solution, or does it have to be 100% VB?
I'd definitely like to keep it all in VB, yeah. Since it's doable, even if this
step takes a couple seconds, it's not worth introducing more layers.
I'm pretty sure I can beat the time and reduce the difference
simultaneously vis a vis the string difference w/ a Fortran DLL if you
could use it -- pass it a SP array and get the DP one back...
I've not done any timing to make sure about that, but I did a concept
test on the rounding and it'll probably reduce the difference to nearly
zero and I think will not be susceptible to the potential underflow
(although I've not finished testing on that, awaiting whether you could
use it)...
I am curious on the approach, though.
--
..NET: It's About Trust!
http://vfred.mvps.org
.
- Follow-Ups:
- Re: Singles to Doubles
- From: dpb
- Re: Singles to Doubles
- References:
- Singles to Doubles
- From: Karl E. Peterson
- Re: Singles to Doubles
- From: Bob Butler
- Re: Singles to Doubles
- From: Karl E. Peterson
- Re: Singles to Doubles
- From: Jim Mack
- Re: Singles to Doubles
- From: Karl E. Peterson
- Re: Singles to Doubles
- From: Jim Mack
- Re: Singles to Doubles
- From: Karl E. Peterson
- Re: Singles to Doubles
- From: dpb
- Singles to Doubles
- Prev by Date: Re: Singles to Doubles
- Next by Date: Re: Singles to Doubles
- Previous by thread: Re: Singles to Doubles
- Next by thread: Re: Singles to Doubles
- Index(es):
Relevant Pages
|