Anonymous | Login | Signup for a new account | 26-12-24 18:16 CET |
Main | My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||
ID | Project | Category | View Status | Date Submitted | Last Update | |
0002503 | SphereServer | executable - windows build | public | 27-04-15 21:28 | 10-05-15 17:31 | |
Reporter | babidi | |||||
Assigned To | Ben | |||||
Priority | normal | Severity | major | Reproducibility | always | |
Status | resolved | Resolution | fixed | |||
Platform | OS | OS Version | ||||
Product Version | 16-06-2013, 0.56b Prerelease | |||||
Target Version | Fixed in Version | 0.56c Nightly | ||||
Summary | 0002503: UVAL DON'T WORK | |||||
Description | UVAL DID NOT WORK. UVAL expression R Evaluates an expression and returns the result as an unsigned integer. | |||||
Steps To Reproduce | [FUNCTION FTUV] LOCAL.NEG = -1 LOCAL.NUMN = -5 LOCAL.NUMP = 5 LOCAL.FTUVA = <UVAL <LOCAL.NUMN>> LOCAL.FTUVB = <EVAL <LOCAL.NUMN>*<LOCAL.NEG>> LOCAL.FTUVC = <UVAL <LOCAL.NUMN>*<LOCAL.NUMP>> SERV.B <DLOCAL.FTUVA> <DLOCAL.FTUVB> <DLOCAL.FTUVC> // EXPECTED 5 5 25 RESULT -5 5 -25 | |||||
Tags | No tags attached. | |||||
Nightly Version | Automated (specify build number) | |||||
Experimental Flags | None | |||||
Option Flags | None | |||||
Internal Build Number | 2256 | |||||
Attached Files | ||||||
Notes | |
(0002771) Coruja (developer) 28-04-15 00:59 edited on: 28-04-15 01:03 |
I tried it here and it's really broken but note that converting a NEGATIVE signed number to unsigned will not simply keep the same number and just remove the signal. Unsigned numbers cant have negative values, so when it reach the minimum value (0) it will jump to the max value (2³² = 4294967296) instead just remove the signal from the number so unsigned -5 is 4294967291 (the same as 4294967296 - 5) and not 5 I will keep this thread open because UVAL is not really working (it just print the same value without change it to unsigned) but probably even after it got fixed, it wont work on your function as you expect maybe you can use another workaround that simply remove the signal if the value is negative instead change it to unsigned [FUNCTION RemoveSignal] IF (<ARGS> < 0) ARGS = <STRSUB 1 0 <dARGS>> ENDIF return <ARGS> so if you use <RemoveSignal -5> it will return 5. Or you can simply use an *-1 directly on your formula without need to create another function IF (<LOCAL.A> < 0) LOCAL.A *= -1 ENDIF if LOCAL.A = -5 this will change it to LOCAL.A = 5 |
(0002796) Ben (manager) 10-05-15 17:31 |
ok... tested, fix some issues, but really this worked as intended. The only issue I saw was that it was working with int32 while all storage variables use int64 now, so UVAL -5 = 18446744073709551611 now, not 4294967291. Now let me explain how it works. Locals, tags, vars... are signed int64 values. When you save -5 to a local, it's saved as -5. (it will display as 0fffffffffffffffb in hex) When you save 18446744073709551611, it saves as -5 (it will display as 0fffffffffffffffb in hex) If you wish to display an unsigned value, you must use UVAL when displaying since you can't save an unsigned value to any storage variables What you are looking for is a function called abs() which returns the number without the sign. I'll see about adding that in. |
Issue History | |||
Date Modified | Username | Field | Change |
27-04-15 21:28 | babidi | New Issue | |
28-04-15 00:59 | Coruja | Note Added: 0002771 | |
28-04-15 01:03 | Coruja | Note Edited: 0002771 | View Revisions |
10-05-15 17:31 | Ben | Note Added: 0002796 | |
10-05-15 17:31 | Ben | Status | new => resolved |
10-05-15 17:31 | Ben | Fixed in Version | => 0.56c Nightly |
10-05-15 17:31 | Ben | Resolution | open => fixed |
10-05-15 17:31 | Ben | Assigned To | => Ben |
Copyright © 2000 - 2010 MantisBT Group |