flat assembler
Message board for the users of flat assembler.
Index
> Main > Arithmetic Operators |
Author |
|
revolution 12 Sep 2023, 02:56
fasm uses the standard +, -, *, / for basic arithmetic.
Show the code that gave an error. Division definitely uses / Code: mov eax, 10 / 3 |
|||
12 Sep 2023, 02:56 |
|
LeftyG 12 Sep 2023, 03:22
I'm trying to make a wrapper for Raylib, its a WIP.
https://github.com/raysan5/raylib/blob/master/src/raylib.h Code: ;this works as well format PE GUI 4.0 include 'macro/struct.inc' include 'macro/import32.inc' include 'macro/export.inc' ;this works RAYLIB_VERSION_MAJOR = 4 RAYLIB_VERSION_MINOR = 5 RAYLIB_VERSION_PATCH = 0 RAYLIB_VERSION = "4.5" PI = 3.14159265358979323846f DEG2RAD = PI / 180.0f ;this produces a error RAD2DEG = 180.0f / PI ;same error ;this works too section '.idata' import data readable writeable library raylib, 'RAYLIB.DLL' import raylib,\ InitWindow,'InitWindow' |
|||
12 Sep 2023, 03:22 |
|
ProMiNick 12 Sep 2023, 03:55
fasm able only to define floating point constants, not produce operations over them.
All arithmetic operations operate only integers and they are only integer operations. so, applying integer operation over floating point constant cause error. That not mean thou have no ability to produce fp operations at all. Thou could define fp constant in virtual memory and emulate producing of such operations (split producing of mantissa and so on...). With much of time thour and preprocessor you both could do so. But more productable to calculate fp outside of fasm and define only fp results of such calculations. |
|||
12 Sep 2023, 03:55 |
|
revolution 12 Sep 2023, 04:10
For floats you need to precalculate.
Code: PI = 3.14159265358979323846264338327950288 DEG2RAD = 0.0174532925199432957692369076848861271 ; pi /180 RAD2DEG = 57.2957795130823208767981548141051703 ; 180 / pi |
|||
12 Sep 2023, 04:10 |
|
LeftyG 12 Sep 2023, 07:03
Thanks for the tips. This has come in handy.
|
|||
12 Sep 2023, 07:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.