Skip to content

C library: whitespace fix to make fmaxf, fmaxl available #6904

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

Merged
merged 1 commit into from
Jun 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions regression/cbmc-library/fmax-01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

int main()
{
fmax();
assert(0);
double d1, d2;
__CPROVER_assume(!isnan(d1) || !isnan(d2));
double r = fmax(d1, d2);
assert(!isnan(d1) || r == d2);
assert(!isnan(d2) || r == d1);
assert(isnan(d1) || isnan(d2) || (d1 > d2 ? r == d1 : r == d2));
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/fmax-01/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
13 changes: 13 additions & 0 deletions regression/cbmc-library/fmaxf-01/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>
#include <math.h>

int main()
{
float f1, f2;
__CPROVER_assume(!isnan(f1) || !isnan(f2));
float r = fmaxf(f1, f2);
assert(!isnan(f1) || r == f2);
assert(!isnan(f2) || r == f1);
assert(isnan(f1) || isnan(f2) || (f1 > f2 ? r == f1 : r == f2));
return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc-library/fmaxf-01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
13 changes: 13 additions & 0 deletions regression/cbmc-library/fmaxl-01/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>
#include <math.h>

int main()
{
long double d1, d2;
__CPROVER_assume(!isnan(d1) || !isnan(d2));
long double r = fmaxl(d1, d2);
assert(!isnan(d1) || r == d2);
assert(!isnan(d2) || r == d1);
assert(isnan(d1) || isnan(d2) || (d1 > d2 ? r == d1 : r == d2));
return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc-library/fmaxl-01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
8 changes: 6 additions & 2 deletions regression/cbmc-library/fmin-01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

int main()
{
fmin();
assert(0);
double d1, d2;
__CPROVER_assume(!isnan(d1) || !isnan(d2));
double r = fmin(d1, d2);
assert(!isnan(d1) || r == d2);
assert(!isnan(d2) || r == d1);
assert(isnan(d1) || isnan(d2) || (d1 < d2 ? r == d1 : r == d2));
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/fmin-01/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
8 changes: 6 additions & 2 deletions regression/cbmc-library/fminf-01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

int main()
{
fminf();
assert(0);
float f1, f2;
__CPROVER_assume(!isnan(f1) || !isnan(f2));
float r = fminf(f1, f2);
assert(!isnan(f1) || r == f2);
assert(!isnan(f2) || r == f1);
assert(isnan(f1) || isnan(f2) || (f1 < f2 ? r == f1 : r == f2));
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/fminf-01/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
8 changes: 6 additions & 2 deletions regression/cbmc-library/fminl-01/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

int main()
{
fminl();
assert(0);
long double d1, d2;
__CPROVER_assume(!isnan(d1) || !isnan(d2));
long double r = fminl(d1, d2);
assert(!isnan(d1) || r == d2);
assert(!isnan(d2) || r == d1);
assert(isnan(d1) || isnan(d2) || (d1 < d2 ? r == d1 : r == d2));
return 0;
}
4 changes: 2 additions & 2 deletions regression/cbmc-library/fminl-01/test.desc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
KNOWNBUG
CORE
main.c
--pointer-check --bounds-check
--pointer-check --bounds-check --nan-check
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
Expand Down
5 changes: 2 additions & 3 deletions src/ansi-c/library/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ long double sqrtl(long double d)
// TODO : Should call a __CPROVER_function so that it can be converted to SMT-LIB
double fmax(double f, double g) { return ((f >= g) || isnan(g)) ? f : g; }

/* FUNCTION : fmaxf */
/* FUNCTION: fmaxf */

#ifndef __CPROVER_MATH_H_INCLUDED
#include <math.h>
Expand All @@ -965,8 +965,7 @@ double fmax(double f, double g) { return ((f >= g) || isnan(g)) ? f : g; }
// TODO : Should call a __CPROVER_function so that it can be converted to SMT-LIB
float fmaxf(float f, float g) { return ((f >= g) || isnan(g)) ? f : g; }


/* FUNCTION : fmaxl */
/* FUNCTION: fmaxl */

#ifndef __CPROVER_MATH_H_INCLUDED
#include <math.h>
Expand Down