flat assembler
Message board for the users of flat assembler.

Index > Heap > fractional decimal <-> binary conversion

Author
Thread Post new topic Reply to topic
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,
Post 26 Oct 2007, 02:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


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

EDIT: updated


Description: test.exe writes 10^x values
test2.exe writes 10^-x values

Download
Filename: bignum.zip
Filesize: 8.65 KB
Downloaded: 94 Time(s)



Last edited by vid on 26 Oct 2007, 04:47; edited 1 time in total
Post 26 Oct 2007, 04:34
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
white_wight



Joined: 03 Feb 2006
Posts: 24
white_wight
Image
Post 26 Oct 2007, 04:43
View user's profile Send private message Reply with quote
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 Smile
Post 26 Oct 2007, 04:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
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.
Post 26 Oct 2007, 04:49
View user's profile Send private message Visit poster's website Reply with quote
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
Post 31 Oct 2007, 07:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.