Frama-C-discuss mailing list archives
This page gathers the archives of the old Frama-C-discuss archives, that was hosted by Inria's gforge before its demise at the end of 2020. To search for mails newer than September 2020, please visit the page of the new mailing list on Renater.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Frama-c-discuss] Axiomatic Definition of Rounding Function
- Subject: [Frama-c-discuss] Axiomatic Definition of Rounding Function
- From: frank at dordowsky.de (Frank Dordowsky)
- Date: Thu, 19 Jun 2014 17:47:33 +0200 (CEST)
- In-reply-to: <CAOH62Jh78V2ja1fHAOY7Hmy1q+NCOkMHzD_Zd6f6HhRroDDAdA@mail.gmail.com>
- References: <alpine.LNX.2.03.1406190917260.1273@dordowsky.de> <CAOH62Jh78V2ja1fHAOY7Hmy1q+NCOkMHzD_Zd6f6HhRroDDAdA@mail.gmail.com>
Thanks for the hints and the link. The blog is very impressive and was surprising to me, but I must admit that I did not yet delve too much into floating point analysis. Weakening the post-conditions leaves an ambiguity: if x == 3.5 for example, both 3 and 4 satisfy the predicate. I nevertheless modified my definition of lround, and also added another axiom that claims the existence of a function value: /*@ axiomatic Rounding { @ logic integer lround(real x); @ axiom exists_value: @ \forall real x; \exists integer n; lround(x) == n; @ axiom rounded_value: @ \forall real x ; -0.5 <= (x - lround(x)) <= 0.5; @ } @*/ I have also tried one of the implementation examples of the blog, and added some trivial assertions: // file: round.c #include "round.h" int roundit(float x) { //@ assert lround(3.0) == 3; //@ assert lround(3.1) == 3; //@ assert lround(3.5) == 4; //@ assert lround(3.9) == 4; if (x >= 0x1.0p23) return x; return (int)(x+0.49999997f); } I still cannot prove the post condition, but even the assertions are not proved, which surprises me, and I have no explanation for it. Frank
- Follow-Ups:
- [Frama-c-discuss] Axiomatic Definition of Rounding Function
- From: Claude.Marche at inria.fr (Claude Marché)
- [Frama-c-discuss] Axiomatic Definition of Rounding Function
- References:
- [Frama-c-discuss] Axiomatic Definition of Rounding Function
- From: frank at dordowsky.de (Frank Dordowsky)
- [Frama-c-discuss] Axiomatic Definition of Rounding Function
- From: pascal.cuoq at gmail.com (Pascal Cuoq)
- [Frama-c-discuss] Axiomatic Definition of Rounding Function
- Prev by Date: [Frama-c-discuss] Aggregate Logic Types
- Next by Date: [Frama-c-discuss] Axiomatic Definition of Rounding Function
- Previous by thread: [Frama-c-discuss] Axiomatic Definition of Rounding Function
- Next by thread: [Frama-c-discuss] Axiomatic Definition of Rounding Function
- Index(es):