aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.h
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-18 00:59:34 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-18 00:59:34 +0100
commit45ef41a78b8dd0564b9d704ce2c4ad3c1b983ae5 (patch)
tree903774e7beeb359c8afc848f97e9d57ae3515ca1 /src/parser.h
parent40b7968a3d7435a80678a169a1e811431ff7a7ad (diff)
more consistent integer and floating point arithmetics without undefined behaviormaster-fmsbw-ci
* `-1^*0` is 1, just like `1^*0` * Floating point arithmetics use inf and NaN instead of errors. In particular `1./0` and `1.^/0` no longer throw errors. We better stay with IEEE 754 semantics than striving for consistency with integer arithmetics. Lua does the same with its hybrid integer/float type system. The check for 0 was flawed anyway. * C has lots of undefined behavior with regard to shifts, so we normalize them just like Lua does: Negative displacements shift in the other direction. A displacement >= 64 is always 0. * Integers are allowed to overflow silently. The overflow behavior is undefined in C, but since we assume two's complement representation, they will actually be defined in practice. This is also what Lua does. Alternatively we could use checked additions, subtractions and multiplications to catch all overflows and throw errors. * There should be no undefined behavior in arithmetics in SciTECO.
Diffstat (limited to 'src/parser.h')
0 files changed, 0 insertions, 0 deletions