flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > about division 
Author 

Goplat 03 Mar 2007, 22:28
fasm uses signed 64 bit numbers, so if you type 18446744073709551615 you actually get 1. Divide that by 1844674407370955161 and you get zero.


03 Mar 2007, 22:28 

daluca 04 Mar 2007, 07:17
thanks Goplat I miss to think in that possibility.
I was making a macro to display values in decimal format and everything seemed to be right with 32bit numbers but wen I try to extend the macro to 64bit I get a "value out of range" error because I was considering the largest number a 20 digits one, but is in fact 19 digits so I modify the macro and seems to work ok: Code: macro disp number { a=number if a=0 display '0' else sign=(number) and 0x8000000000000000 if sign<>0 display '' a = a end if first0=0 base= 1000000000000000000 ;9223372036854775808 repeat 19 digit=a/base if digit=0 if first0=1 display '0' end if else digit=digit+'0' display digit first0=1 end if a=a mod base base=base/10 end repeat end if } alfa= 1000 repeat 2000 disp alfa display 13,10 alfa=alfa+1 end repeat display '9223372036854775808 mod 45613211 = ' disp 9223372036854775808 mod 45613211 just copy,paste and compile and get the display. it can be use to display some more complicated values like: Code: disp (alpha(alpha/3)) mod 45 

04 Mar 2007, 07:17 

< Last Thread  Next Thread > 
Forum Rules:

Copyright © 19992024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.