forked from verificarlo/verificarlo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30dd0c9
commit 52ec3f0
Showing
9 changed files
with
405 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import numpy as np | ||
import sys | ||
with open(sys.argv[1]) as fi: | ||
x = [float.fromhex(l.strip()) for l in fi] | ||
print(int(len(set(x)) == 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
rm -Rf *~ test_* *.ll *.o .*.o *.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <stdint.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
#include "interflop/common/float_const.h" | ||
|
||
#ifndef REAL | ||
#warning "REAL is not defined, defaulting to double" | ||
#define REAL double | ||
#endif | ||
|
||
typedef union { | ||
double f64; | ||
int64_t s64; | ||
} binary64; | ||
|
||
typedef union { | ||
float f32; | ||
int32_t s32; | ||
} binary32; | ||
|
||
#define OPERATOR(a, b) \ | ||
switch (op) { \ | ||
case '+': \ | ||
return a + b; \ | ||
case '-': \ | ||
return a - b; \ | ||
case 'x': \ | ||
return a * b; \ | ||
case '/': \ | ||
return a / b; \ | ||
default: \ | ||
fprintf(stderr, "Error: unknown operation\n"); \ | ||
abort(); \ | ||
} | ||
|
||
__attribute__((noinline)) REAL operator(char op, REAL a, REAL b) { | ||
OPERATOR(a, b) | ||
} | ||
|
||
int main(int argc, const char *argv[]) { | ||
|
||
if (argc != 4) { | ||
fprintf(stderr, "usage: ./test <op> a b\n"); | ||
exit(1); | ||
} | ||
|
||
const char op = argv[1][0]; | ||
REAL a = atof(argv[2]); | ||
REAL b = atof(argv[3]); | ||
|
||
printf("%.13a\n", operator(op, a, b)); | ||
|
||
return EXIT_SUCCESS; | ||
} |
Oops, something went wrong.