-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINUS operator at uint8 #314
Comments
Addition and subtraction on integers (both signed and unsigned) are modulo 2^nr_of_bits, which is 256 for uint8; I could start checking for overflow and underflow, and provide alternative function names (circular_addition and circular_subtraction) to access the current behaviour. We should first check how much impact this would have on existing projects. |
Zou een error moeten geven |
https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes#1770--visual-studio-2022-version-177 |
Wat we willen verbeteren is overflow en underflow detectie bij optellen, aftrekken, en vermenigvuldigen (en delen van de laagste signed int door -1) voor alle integer types: uint2, uint4, uint8, int8, uint16, int16, uint32, int32, uint64, int64, en gerelateerde operaties met WPoint, SPoint, UPoint, en IPoint. We zullen eerst als optie alle overflow en underflow gaan detecteren en dan betreffende en alle afgeleide items rood kleuren met een data error fail reason een vermelding van (tenminste) het eerste voorkomen van een overflow/underflow. Issue is dat een reken-resultaat definieren als: Er zijn geen efficiënte standaard c++ functies om carry of overlow vlaggen te gebruiken, maar wel compiler intrinsics (welke?) en inefficiënte standaard c++ implementatiestrategieën |
…32/64, resulting in 'null' for those results that are not representable.
…d cov; and indirectly: sd, corr, mean.
…sulting in a data error when any operand has a 'null' value. The other four compare operators: >, <, >=, <= still result in such error when any operand has a 'null' value.
…ation give an error and aggregation of undefined values are skipped again and order comparison (a<b, etc.) result in false without error.
Overflow detectie voor add, sub, mul en aggregatie operatoren is geïmplementeerd in 14.1.0: Item en afgeleide items worden rood met data error. |
II don't know if this is actually a bug but I've seen this behavior already before,
With a MINUS operator on a uint8 value type I get a positive value for "negative numbers" (which is not possible according to this value type)
So in the example below
attribute GridData; // values 1 and 101 occur
attribute Build:=GridData - 100b;// returns for 101-->1 and for 1-->157
So I have a grid with values 1 and 101 of the unit8 type, I subtract 100 from that and the value 1 then becomes 157.
It looks like something is being done like (256+1)-100.
It doesn't make sense to me one way or another.
Actually, I expected error.
The text was updated successfully, but these errors were encountered: