Re: Singles to Doubles

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


.



Relevant Pages

  • Re: Singles to Doubles
    ... Temp# = CDbl(Int(OldSingle! ... It took about 0.7s on the same test where the string conversion took 3.2s -- very respectable. ... 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... ...
    (microsoft.public.vb.general.discussion)
  • [WR]Copley, snow increasing
    ... Several decent showers with vis down to 200metres, temp -0C and snow ...
    (uk.sci.weather)
  • {WR} Haytor 27/5/08 (Fog and damp and cool)
    ... Fog all morning <50 metres most of time. ... Fog cleared in afternoon and now sunny intervals and 15km vis. ... Max temp. ...
    (uk.sci.weather)
  • Re: {WR} Haytor Fri 21/11/08 (Dry)
    ... Wind NW F4 ... Temp +7.7C ... Light rain and drizzle ... Vis 20Km ...
    (uk.sci.weather)
  • Re: {WR} Haytor 26/12/07 (Is this really winter?)
    ... SCT CuSC ... Vis 10Km ... Temp 9.8C rising ... BKN CuSc with sunshine ...
    (uk.sci.weather)