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] Problem with real division


  • Subject: [Frama-c-discuss] Problem with real division
  • From: Boris.Hollas at de.bosch.com (Hollas Boris (CR/AEY1))
  • Date: Mon, 3 Aug 2009 11:16:56 +0200
  • In-reply-to: <1248880889.4081.32.camel@guillaume-laptop>
  • References: <FC0686BB6178BC43B9DC035287A11A720DBAFF54A0@SI-MBX12.de.bosch.com> <BAB2FD70-AC55-477D-B475-62C7D7F9B75B@cea.fr> <FC0686BB6178BC43B9DC035287A11A720DBB0336D8@SI-MBX12.de.bosch.com> <1248880889.4081.32.camel@guillaume-laptop>

Hello Guillaume,

Do Jessie or Gappa also support an exact model for arithmetic in Q or R? This would be easier to handle for the engineer, but of course it couldn't detect overflow or underflow.

On the other hand, precision for real arithmetic varies in embedded systems. Many systems even use fixed point arithmetic. Thus, for embedded programming an adjustable precision would be useful.

Best regards,
Boris

        #pragma JessieFloatModel(strict)

        /*@ requires 0x1p-1000 <= R1 <= 0x1p1000 &&
                     0x1p-1000 <= R2 <= 0x1p1000;
            ensures \result > 0;
        */
        double R_ges(double R1, double R2) {
          return 1.0/( 1.0/R1 + 1.0/R2 );
        }

        int main(void) {
          double R;
          R = R_ges(100, 200);
          return 0;
        }