-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for floating-point arithmetic added #6
Open
dannem1337
wants to merge
34
commits into
uuverifiers:master
Choose a base branch
from
dannem1337:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
ec57ad7
added benchmarks for floats
dannem1337 03516eb
added support for NAN and INF in parser
dannem1337 60b7fae
Began making some changes in the code, don't know how to endode Fract…
dannem1337 9f4dc9c
added double2fraction and float2fraction, float2fraction seems to wor…
dannem1337 51affeb
Fixed bug in 2fraction
dannem1337 ab4f4e1
Adds ADT encoding for floats and helper methods
zafer-esen 88eab10
Move everything that is floatADT related to FloatADT.
zafer-esen 35bcaee
added Rational operators, does not work yet, unsure why
dannem1337 5475616
added tests and answers
dannem1337 c59fbed
changed isFloat etc in floatADT
dannem1337 8b9c91a
merge
dannem1337 e46130c
Merge remote-tracking branch 'upstream/master'
dannem1337 ed81d88
bug sort is int
dannem1337 77ac572
Fixes some issues in encoding floats
zafer-esen 93c558b
fixed some bugs
dannem1337 64764d9
added a test and added small support for NaN
dannem1337 04da5b1
added some support for doubles and did some refactoring for them
dannem1337 579437f
added small changes and added some tests
dannem1337 d36885b
Bug in both long double and double
dannem1337 09f1bef
doubles shoudl be working, still issues with long doubles
dannem1337 7c873fc
Long doubles are now correcty parsed
dannem1337 18e79b5
added some more tests
dannem1337 3809d87
added more tests
dannem1337 0e9f1f7
branch for the presentation
dannem1337 e044b66
final changes
dannem1337 15266e5
Merge pull request #1 from dannem1337/presentation
dannem1337 66f7d67
final commit
dannem1337 28aa662
fixed tests
dannem1337 ec5ec8e
Merge pull request #2 from dannem1337/presentation
dannem1337 2e82b6e
Merge branch 'uuverifiers:master' into master
dannem1337 42d471b
all tests pass
dannem1337 057cdba
changes according to review
dannem1337 cddb648
Merge branch 'master' into dannem1337/master
zafer-esen 2b78b30
sync with main
jesper-amilon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please call |
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
Binary file not shown.
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,42 @@ | ||
|
||
add_1.c | ||
SAFE | ||
|
||
add_2.c | ||
UNSAFE | ||
|
||
add_3.c | ||
UNSAFE | ||
|
||
div_1.c | ||
SAFE | ||
|
||
div_2.c | ||
UNSAFE | ||
|
||
div_3.c | ||
SAFE | ||
|
||
init_1.c | ||
SAFE | ||
|
||
init_2.c | ||
SAFE | ||
|
||
mul_1.c | ||
SAFE | ||
|
||
mul_2.c | ||
UNSAFE | ||
|
||
loop_1.c | ||
SAFE | ||
|
||
loop_2.c | ||
UNSAFE | ||
|
||
sub_1.c | ||
SAFE | ||
|
||
sub_2.c | ||
UNSAFE |
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,7 @@ | ||
// SAFE | ||
int main () { | ||
double a = 0.22; | ||
double b = 0.1; | ||
assert(a+b== 0.32); | ||
return 0; | ||
} |
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,7 @@ | ||
//UNSAFE | ||
int main() { | ||
double a = 3.0; | ||
double b = 0.5; | ||
assert(a+b == 3.501); | ||
return 0; | ||
} |
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,6 @@ | ||
//UNSAFE | ||
int main() { | ||
double a = 2.0; | ||
double b = a + 0.5; | ||
assert(a + 0.4 == b); | ||
} |
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,7 @@ | ||
//SAFE | ||
int main () { | ||
double a = 4.0; | ||
double b = 0.5; | ||
assert(a/b== 8.0); | ||
return 0; | ||
} |
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,7 @@ | ||
//UNSAFE | ||
int main () { | ||
double a = 4.0; | ||
double b = 0.5; | ||
assert(a/b== 8.01); | ||
return 0; | ||
} |
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,7 @@ | ||
int main () { | ||
double a = 4.0; | ||
double b = 0.1; | ||
assert(a/b <= 40.00001); | ||
assert(a/b >= 39.99999); | ||
return 0; | ||
} |
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,7 @@ | ||
//SAFE | ||
int main() { | ||
double a = 0.0; | ||
assert(a == 0.0); | ||
return 0; | ||
|
||
} |
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,6 @@ | ||
//SAFE | ||
int main() { | ||
double a = 4.24242; | ||
assert(a == 4.24242); | ||
return 0; | ||
} |
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,7 @@ | ||
//UNSAFE | ||
int main() { | ||
double a = 4.24242; | ||
assert(a == 4.24241); | ||
return 0; | ||
|
||
} |
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,7 @@ | ||
//SAFE | ||
int main () { | ||
double a = 2.0; | ||
int b = 1; | ||
assert(a+b == 3.0); | ||
return 0; | ||
} |
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,6 @@ | ||
//SAFE | ||
int main() { | ||
double a = 2.3; | ||
double b = 2.25;; | ||
assert(b <= a); | ||
} |
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,12 @@ | ||
//SAFE | ||
void main(void) { | ||
int i = 0; | ||
double x = 0.5; | ||
double y = x; | ||
while (x < 3000.0) { | ||
x = x*2.0; | ||
y = x; | ||
++i; | ||
} | ||
assert(x==y); | ||
} |
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,15 @@ | ||
//UNSAFE | ||
int N = _; | ||
|
||
void main(void) { | ||
int i = 0; | ||
double x = 0.5; | ||
double y = x; | ||
while (i < N) { | ||
if(x == y) { | ||
x = x+2.25; | ||
} | ||
++i; | ||
} | ||
assert(x==y); | ||
} |
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,7 @@ | ||
//SAFE | ||
int main () { | ||
double a = 0.5; | ||
double b = 0.5; | ||
assert(a*b== 0.25); | ||
return 0; | ||
} |
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,6 @@ | ||
int main () { | ||
double a = 0.5; | ||
double b = 0.5; | ||
assert(a*b== 0.251); | ||
return 0; | ||
} |
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,8 @@ | ||
//UNSAFE IF NAN IS INCLUDED OTHERWISE SAFE | ||
int main() | ||
{ | ||
double x = _; | ||
|
||
assert(x==x); | ||
return 0; | ||
} |
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 @@ | ||
//UNSAFE | ||
int main() { | ||
double nan = 0/0; | ||
assert(nan == 2); | ||
} |
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,10 @@ | ||
// SAFE | ||
int main() { | ||
double x = _; | ||
|
||
if (x >= -0.00001 && x <= -0.00001) { | ||
assert(x==x); | ||
} | ||
return 0; | ||
} | ||
|
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,7 @@ | ||
// SAFE | ||
int main() { | ||
double x = _; | ||
double y = x + 1.0; | ||
assert(y>x); | ||
|
||
} |
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,6 @@ | ||
// UNSAFE | ||
int main() { | ||
double x = _; | ||
double y = x + 1.0; | ||
assert(y<x); | ||
} |
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,25 @@ | ||
#!/bin/sh | ||
|
||
LAZABS=../../tri | ||
|
||
TESTS="add_1.c \ | ||
add_2.c \ | ||
add_3.c \ | ||
div_1.c \ | ||
div_2.c \ | ||
div_3.c \ | ||
init_1.c \ | ||
init_2.c \ | ||
mul_1.c \ | ||
mul_2.c \ | ||
loop_1.c \ | ||
loop_2.c \ | ||
sub_1.c \ | ||
sub_2.c " | ||
|
||
for name in $TESTS; do | ||
echo | ||
echo $name | ||
$LAZABS "$@" $name 2>&1 | grep -v 'at ' | ||
done | ||
|
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,8 @@ | ||
//SAFE | ||
int main() { | ||
double a = 1.5; | ||
double b = 0.5; | ||
assert(a-b== 1.0); | ||
return 0; | ||
|
||
} |
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,7 @@ | ||
// UNSAFE | ||
int main() { | ||
double a = 0.22; | ||
double b = 0.1; | ||
assert(a-b == 0.1); | ||
return 0; | ||
} |
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,39 @@ | ||
|
||
add_1.c | ||
SAFE | ||
|
||
add_2.c | ||
SAFE | ||
|
||
add_3.c | ||
UNSAFE | ||
|
||
div_1.c | ||
SAFE | ||
|
||
div_2.c | ||
SAFE | ||
|
||
init_1.c | ||
SAFE | ||
|
||
init_2.c | ||
SAFE | ||
|
||
loop_1.c | ||
SAFE | ||
|
||
loop_2.c | ||
UNSAFE | ||
|
||
mul_1.c | ||
SAFE | ||
|
||
mul_2.c | ||
UNSAFE | ||
|
||
sub_1.c | ||
SAFE | ||
|
||
sub_2.c | ||
UNSAFE |
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,6 @@ | ||
int main () { | ||
float a = 0.5f; | ||
float b = 0.75f; | ||
assert(a+b== 1.25f); | ||
return 0; | ||
} |
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,6 @@ | ||
int main() { | ||
float a = 3.0f; | ||
float b = 0.5f; | ||
assert(a+b == 3.5f); | ||
return 0; | ||
} |
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 @@ | ||
int main() { | ||
float a = 2.0f; | ||
float b = a + 0.5f; | ||
assert(a + 0.4f == b); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be some empty files added by mistake.