flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > x dd 10^9

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 29 Apr 2011, 22:15

Programmer's Manual
1.2.4 Numerical expressions

It would be useful to have an "exponent" operateur too.
Code:
toto dd 10^9 ; or 10e9

;much more readable than "dd 1000000000"
;and get sore eyes to count the zeros to be sure Smile

my_float dq 10^9F

glop db 2^4
    


_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 29 Apr 2011, 22:15
View user's profile Send private message Send e-mail Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 02 May 2011, 18:49
+1
Post 02 May 2011, 18:49
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 676
Location: Mar del Plata
Enko 02 May 2011, 20:21
As I see it, overriding the DD instruction with a macro will be enough.
Post 02 May 2011, 20:21
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 02 May 2011, 21:15
10e9 works fine for me
Post 02 May 2011, 21:15
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 May 2011, 07:49
How about a workaround:
Code:
dd 1'000'000'000 ; 10^9
dd 10e9 ; 1.0*10^9 - float only
dd 2 shl 3 ; 2^4
    

Sorry, a typo!


Last edited by Madis731 on 03 May 2011, 11:34; edited 1 time in total
Post 03 May 2011, 07:49
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 May 2011, 10:29
Code:
dq 1000000000 ;does compile

;but it has nothing to do with

dq 10e9 ; does compile    

to define a "float", the "dot" is enough.
The "e" are available to add an "exponent" operator.
And do not tell me to use a macro, this is not a real solution.
"Just a plaster on a wooden leg" ... like we say in French.

(2^4 = 2 shl 3 Wink )

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 May 2011, 10:29
View user's profile Send private message Send e-mail Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 May 2011, 11:46
A lot of things are macros in FASM. Take a look at the include\macro folder.
There are good and bad macros even some *elegant* ones Smile but you cannot say that a macro is not a solution. Macros are meant to make life easier.
You want your reading experience to be easier, but FASM provides all the functionality. This is something that is best fitted job for macros.

Smile not everything must be in "The Kernel"
Post 03 May 2011, 11:46
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 May 2011, 12:07
So in your first post, you was trying to store 1e10 integer in a dword? Razz
Post 03 May 2011, 12:07
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 May 2011, 13:53
I think it fits, doesn't it!? Don't confuse me Very Happy

1e9 = 1*10^9 = 1000000000 = 1 billion
signed max is 2147483647
unsigned 4294967295

1e10 does NOT fit! Razz
Post 03 May 2011, 13:53
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 May 2011, 14:03
Quote:
Macros are meant to make life easier.
not everything must be in "The Kernel"
Yes, in fact, you're right

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 May 2011, 14:03
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 03 May 2011, 14:20
Madis731 wrote:
I think it fits, doesn't it!? Don't confuse me Very Happy

1e9 = 1*10^9 = 1000000000 = 1 billion
signed max is 2147483647
unsigned 4294967295

1e10 does NOT fit! Razz

Carefully reread first post of the topic Wink Razz
He wrote "dd 10e9", that's why I thought he must mean float, not integer.
Post 03 May 2011, 14:20
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 03 May 2011, 14:30

it was just an example... if fasm had included a exponent operator.
dd 10^9 == dd 10e9 == 1'000'000'000 ;0x3B9ACA00

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 May 2011, 14:30
View user's profile Send private message Send e-mail Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4352
Location: Now
edfed 10 May 2011, 11:41
be able to do that is more interresting than just 10^9 in my opinion:

Code:
value = 4.543
integer =43245
dd 1.0*0.0032/value+56-integer 
    

mix int and float values in numerical expressions and let use multiple floats in expressions, if a float is in, then, result is in float.
this feature i think cannot be implemented easy just with a macro, i think it can be simpler to implement it in the "kernel", fasm2.x?


but exponent ^ too can be a very good feature, as i can see, 10e9 is accepted, but not 10^9. it is not very important, but can be very cool.

about numerical expressions, implement cos, sin, tan, sqrt, ², etc can be very cool too. but not needed for now.
Post 10 May 2011, 11:41
View user's profile Send private message Visit poster's website 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 cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.