1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-20 04:24:48 +00:00

Merge pull request #463 from mkilgore/fix-const-divide

Fix divide in CONST
This commit is contained in:
Matt Kilgore 2024-02-26 23:06:35 -05:00 committed by GitHub
commit 74cc70b0c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -600,13 +600,8 @@ FUNCTION Factor&(exp$, state AS ParserState)
ele$ = getnextelement$(exp$, state.index, state.strIndex)
IF Unary&(exp$, state) = 0 THEN FixupErrorMessage state, "/": EXIT FUNCTION
IF (num.typ AND ISFLOAT) OR (state.num.typ AND ISFLOAT) THEN
ParseNumSetF num, FLOATTYPE - ISPOINTER, num.f / state.num.f
ELSEIF (num.typ AND ISUNSIGNED) OR (state.num.typ AND ISUNSIGNED) THEN
ParseNumSetUI num, UINTEGER64TYPE - ISPOINTER, num.ui / state.num.ui
ELSE
ParseNumSetI num, INTEGER64TYPE - ISPOINTER, num.i / state.num.i
END IF
' Regular division is always done as floating-point
ParseNumSetF num, FLOATTYPE - ISPOINTER, num.f / state.num.f
ELSE
IF CONST_EVAL_DEBUG THEN _Echo "Factor done!"
state.num = num

View file

@ -47,6 +47,8 @@ CONST const__str4 = (const__str + (const__str2))
CONST const__unsignedint = 2~&& * 5~&&
CONST const__division_floating = 1& / 5&
PRINT const__OR
PRINT const__AND
PRINT const__NOT
@ -91,4 +93,6 @@ PRINT const__str4
PRINT const__unsignedint
PRINT const__division_floating
SYSTEM

View file

@ -34,3 +34,4 @@ foobarfoobar2
foobarfoobarfoobar2
foobarfoobarfoobar2
10
.2