[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-mes] ARM mes on wip-arm - Test failure: Division with negative oper
From: |
Danny Milosavljevic |
Subject: |
[bug-mes] ARM mes on wip-arm - Test failure: Division with negative operands |
Date: |
Mon, 11 Mar 2019 21:49:55 +0100 |
Hi,
there's one test failure (on "make check") left:
FAIL: tests/srfi-13.test
Detail:
test: number->string INT-MIN: fail
expected: "-2147483648"
actual: "-./,),(-*,("
: fail
That's because mes/module/mes/scm.mes defines:
(define (remainder x y)
(- x (* (quotient x y) y)))
But rounding of integer division in C is implementation-defined, see also
http://www.microhowto.info/howto/round_towards_minus_infinity_when_dividing_integers_in_c_or_c++.html
.
Currently, ldiv rounds towards zero (as does ISO C99).
That means for example (-1)/2 == 0 (no, seriously).
So (remainder -1 2) => (- -1 (* 0 2)) = -1. But other parts of the code assume
(and mainstream mathematics define) remainder >= 0.
Rounding quotient towards zero is kinda silly (better would be to always round
in the same direction :P) but the hardware industry seems to have standardized
on it.
In any case, we cannot have both at the same time, so what shall we do?
pgpGmWfcLAYZ6.pgp
Description: OpenPGP digital signature
- [bug-mes] ARM mes on wip-arm - Runtime setup, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Runtime setup, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Runtime setup, Jan Nieuwenhuizen, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Runtime setup, Danny Milosavljevic, 2019/03/11
- [bug-mes] ARM mes on wip-arm - Assertion failure, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Assertion failure, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Assertion failure, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Assertion failure, Jan Nieuwenhuizen, 2019/03/11
- [bug-mes] ARM mes on wip-arm - Test failure: Division with negative operands,
Danny Milosavljevic <=
- [bug-mes] ARM mes on wip-arm - Other test failures, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Other test failures, Danny Milosavljevic, 2019/03/11
- Re: [bug-mes] ARM mes on wip-arm - Other test failures, Jan Nieuwenhuizen, 2019/03/12
- Re: [bug-mes] ARM mes on wip-arm - Other test failures, Danny Milosavljevic, 2019/03/13
- [bug-mes] mes lib: signal() function; sigaction() function, Danny Milosavljevic, 2019/03/13
- Re: [bug-mes] mes lib: signal() function; sigaction() function, Jan Nieuwenhuizen, 2019/03/14
- Re: [bug-mes] mes lib: dtoab, Danny Milosavljevic, 2019/03/14
- Re: [bug-mes] mes lib: dtoab, Jan Nieuwenhuizen, 2019/03/14
- Re: [bug-mes] mes lib: abtod, Danny Milosavljevic, 2019/03/15
- Re: [bug-mes] ARM mes on wip-arm - Other test failures, Jan Nieuwenhuizen, 2019/03/14