Hi all

Here is a demo of the control in spread sheet and grid mode.
I am struggeling to decide what number format to use. Packed BCD floating point or binary floating point.

Packed BCD vs Binary

Packed BCD Binary
Ascii to float Fast and simple Slow
Float to ascii Fast and simple Slow and complex
Formatting Simple, slow on sci Simple, fast on sci
Roundoff Simple and fast A total mess
Add Slow Fast using FPU
Sub Slow Fast using FPU
Mul Very slow Fast using FPU
Div Very slow Fast using FPU

There is not a lot of example code on floating point convertions. If you know of any code / tut on this subject or just some idea, let me know.

Comments, suggestions and bug reports welcome.

Posted on 2002-08-08 03:15:49 by KetilO
I thnk the FPU handles BCD number loading and storing. But perhaps with some good number conversion routines binary would be the better option.

Have you checked out the code supplied with masm32.lib, it contains number conversion routins, I think the files are dwtoa.asm, atodw.asm, fptoa(2).asm & atofp.asm.
Posted on 2002-08-08 06:29:49 by Eóin
Hi E?in

Yes, binary is the prefered format as it allows use of the FPU.
I am aware of the functions in masm32.lib, but they are not even close to what I need. I have had a look at ATOFP, it is very slow, there are better ways to do it. My concern is the float to ascii when I want a fixed number of decimals.
My idea so far is:

Lets say I want 2 decimals.

1. Multiply by 1000
2. Convert to packed BCD
3. Check if LSD>=5, if so add 0.01

This will work but is there a better way?

Posted on 2002-08-08 07:54:30 by KetilO