flat assembler
Message board for the users of flat assembler.

 Index > Heap > fractional decimal <-> binary conversion
Author
vid
Verbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
don't you know any tool that can convert fractional decimal to fractional binary number, ideally with very high precision?

for example:
0.125 decimal = 0.001 binary
7.5e-2 decimal = 1e-4 binary

would be good if it could work with very high precision,
26 Oct 2007, 02:54
vid
Verbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
nevermind... wrote ones myself

EDIT: updated

Last edited by vid on 26 Oct 2007, 04:47; edited 1 time in total
26 Oct 2007, 04:34
white_wight

Joined: 03 Feb 2006
Posts: 24
white_wight
26 Oct 2007, 04:43
vid
Verbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
nice... unfortunatelly i don't have that app, nor i know how to use it.
i wish i had learnt it
26 Oct 2007, 04:47
bitRAKE

Joined: 21 Jul 2003
Posts: 2913
Location: [RSP+8*5]
bitRAKE
Just wrote this up for you, maybe you got something similar?
Code:
```      lea edi,[BigInt+YouDecide*4]
mov ebx,10
chr:  movzx edx,byte[esi]
inc esi
sub edx,'0'
mov ecx,-YouDecide
jc x
; EDX:EDI[ECX*4] / 10
@@:    mov eax,[edi+ecx*4]
div ebx
mov [edi+ecx*4],eax
inc ecx
jne @B

; might want to round up
; based on EDX?

jmp chr

BigInt rd YouDecide

x:            ```
It isn't fast, but it might work - haven't ran the code, yet.
26 Oct 2007, 04:49
cmdtower

Joined: 22 Sep 2007
Posts: 30
Location: San Diego, CA
cmdtower
vid wrote:
don't you know any tool that can convert fractional decimal to fractional binary number, ideally with very high precision?

Now see, that wasn't so hard?!

CMD

_________________
~cmdtower
31 Oct 2007, 07:55
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsCompiler InternalsIDE DevelopmentOS ConstructionNon-x86 architecturesHigh Level LanguagesProgramming Language DesignProjects and IdeasExamples and Tutorials Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou can attach files in this forumYou can download files in this forum