File: main.c

package info (click to toggle)
cbmc 5.12-5
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 92,512 kB
  • sloc: cpp: 301,761; ansic: 51,699; java: 27,534; python: 5,113; yacc: 4,756; makefile: 3,184; lex: 2,749; sh: 1,347; perl: 555; xml: 404; pascal: 203; ada: 36
file content (50 lines) | stat: -rw-r--r-- 1,061 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <assert.h>

void multiply(void)
{
	   /*
	   ((f1 == 0x1.000000p-63f) && (f2 == 0x1.fffffep-64f)) ||
	   ((f1 == 0x1.084c64p-63f) && (f2 == 0x1.efec9ep-64f)) ||
	   ((f1 == 0x1.47e8c2p-63f) && (f2 == 0x1.8fb86cp-64f)) ||
	   ((f1 == 0x1.1fcf1cp-63f) && (f2 == 0x1.c769c0p-64f)) ||
	   ((f1 == 0x1.b1fffcp-63f) && (f2 == 0x1.2e025ep-64f)) ||
	   ((f1 == 0x1.000000p-62f) && (f2 == 0x1.fffffep-65f)) ||
	   ((f1 == 0x1.000000p-61f) && (f2 == 0x1.fffffep-66f)) ||
	   ((f1 == 0x1.000000p-50f) && (f2 == 0x1.fffffep-77f)) ||
	   ((f1 == 0x1.000000p-30f) && (f2 == 0x1.fffffep-97f)) ||
	   ((f1 == 0x1.000000p-10f) && (f2 == 0x1.fffffep-117f)) ||
	   */

  float f1=0x1.000000p-1f;
  float f2=0x1.fffffep-126f;

  float res = f1 * f2;

  assert(res == 0x1.0p-126f);
}

void divide(void)
{
  float f1=0x1.000000p+1f;
  float f2=0x1.fffffep-126f;

  float res = f2 / f1;

  assert(res == 0x1.0p-126f);
}

void cast(void)
{
  double d = 0x1.fffffep-127;

  float f = (float)d;

  assert(f == 0x1.0p-126f);
}

int main()
{
  multiply();
  divide();
  cast();
}