10 long double fabsl(
long double d)
223 #pragma CPROVER check push
224 #pragma CPROVER check disable "float-div-by-zero"
225 #pragma CPROVER check disable "float-overflow"
227 #pragma CPROVER check pop
234 #pragma CPROVER check push
235 #pragma CPROVER check disable "float-div-by-zero"
236 #pragma CPROVER check disable "float-overflow"
238 #pragma CPROVER check pop
245 #pragma CPROVER check push
246 #pragma CPROVER check disable "float-div-by-zero"
247 #pragma CPROVER check disable "float-overflow"
249 #pragma CPROVER check pop
291 #pragma CPROVER check push
292 #pragma CPROVER check disable "float-div-by-zero"
293 #pragma CPROVER check disable "float-overflow"
295 #pragma CPROVER check pop
302 #pragma CPROVER check push
303 #pragma CPROVER check disable "float-div-by-zero"
304 #pragma CPROVER check disable "float-overflow"
306 #pragma CPROVER check pop
313 #pragma CPROVER check push
314 #pragma CPROVER check disable "float-div-by-zero"
315 #pragma CPROVER check disable "float-overflow"
317 #pragma CPROVER check pop
373 #ifndef __CPROVER_MATH_H_INCLUDED
375 #define __CPROVER_MATH_H_INCLUDED
390 #ifndef __CPROVER_MATH_H_INCLUDED
392 #define __CPROVER_MATH_H_INCLUDED
407 #ifndef __CPROVER_MATH_H_INCLUDED
409 #define __CPROVER_MATH_H_INCLUDED
424 #ifndef __CPROVER_MATH_H_INCLUDED
426 #define __CPROVER_MATH_H_INCLUDED
433 FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d);
438 #ifndef __CPROVER_MATH_H_INCLUDED
440 #define __CPROVER_MATH_H_INCLUDED
447 FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, f);
452 #ifndef __CPROVER_MATH_H_INCLUDED
454 #define __CPROVER_MATH_H_INCLUDED
461 FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, f);
466 #ifndef __CPROVER_MATH_H_INCLUDED
468 #define __CPROVER_MATH_H_INCLUDED
479 FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d);
486 FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, d);
515 long double sinl(
long double x)
578 long double cosl(
long double x)
624 #pragma CPROVER check push
625 #pragma CPROVER check disable "float-div-by-zero"
627 #pragma CPROVER check pop
637 #pragma CPROVER check push
638 #pragma CPROVER check disable "float-div-by-zero"
640 #pragma CPROVER check pop
659 double nan(
const char *str) {
663 #pragma CPROVER check push
664 #pragma CPROVER check disable "float-div-by-zero"
666 #pragma CPROVER check pop
675 #pragma CPROVER check push
676 #pragma CPROVER check disable "float-div-by-zero"
678 #pragma CPROVER check pop
683 long double nanl(
const char *str) {
687 #pragma CPROVER check push
688 #pragma CPROVER check disable "float-div-by-zero"
690 #pragma CPROVER check pop
695 #ifndef __CPROVER_LIMITS_H_INCLUDED
697 #define __CPROVER_LIMITS_H_INCLUDED
710 __CPROVER_bitvector[CHAR_BIT *
sizeof(float)]
bv;
718 #pragma CPROVER check push
719 #pragma CPROVER check disable "float-div-by-zero"
721 #pragma CPROVER check pop
747 #ifndef __CPROVER_LIMITS_H_INCLUDED
749 #define __CPROVER_LIMITS_H_INCLUDED
762 __CPROVER_bitvector[CHAR_BIT *
sizeof(double)]
bv;
770 #pragma CPROVER check push
771 #pragma CPROVER check disable "float-div-by-zero"
773 #pragma CPROVER check pop
800 #ifndef __CPROVER_LIMITS_H_INCLUDED
802 #define __CPROVER_LIMITS_H_INCLUDED
813 __CPROVER_bitvector[CHAR_BIT *
sizeof(
long double)]
bv;
821 #pragma CPROVER check push
822 #pragma CPROVER check disable "float-div-by-zero"
824 #pragma CPROVER check pop
872 #ifndef __CPROVER_MATH_H_INCLUDED
874 #define __CPROVER_MATH_H_INCLUDED
877 #ifndef __CPROVER_FENV_H_INCLUDED
879 #define __CPROVER_FENV_H_INCLUDED
891 #pragma CPROVER check push
892 #pragma CPROVER check disable "float-div-by-zero"
894 #pragma CPROVER check pop
908 #pragma CPROVER check push
909 #pragma CPROVER check disable "float-overflow"
910 float lowerSquare = lower * lower;
914 float upperSquare = upper * upper;
915 #pragma CPROVER check pop
930 return (
f - lowerSquare < upperSquare -
f) ? lower : upper;
break;
932 return (
f - lowerSquare == 0.0f) ? lower : upper;
break;
935 return (
f - lowerSquare == 0.0f) ? lower : upper;
break;
965 #ifndef __CPROVER_MATH_H_INCLUDED
967 #define __CPROVER_MATH_H_INCLUDED
970 #ifndef __CPROVER_FENV_H_INCLUDED
972 #define __CPROVER_FENV_H_INCLUDED
984 #pragma CPROVER check push
985 #pragma CPROVER check disable "float-div-by-zero"
987 #pragma CPROVER check pop
998 #pragma CPROVER check push
999 #pragma CPROVER check disable "float-overflow"
1000 double lowerSquare = lower * lower;
1003 double upper =
nextUp(lower);
1004 double upperSquare = upper * upper;
1005 #pragma CPROVER check pop
1013 return (d - lowerSquare < upperSquare - d) ? lower : upper;
break;
1015 return (d - lowerSquare == 0.0f) ? lower : upper;
break;
1018 return (d - lowerSquare == 0.0) ? lower : upper;
break;
1042 #ifndef __CPROVER_MATH_H_INCLUDED
1044 #define __CPROVER_MATH_H_INCLUDED
1047 #ifndef __CPROVER_FENV_H_INCLUDED
1049 #define __CPROVER_FENV_H_INCLUDED
1052 long double nextUpl(
long double d);
1061 #pragma CPROVER check push
1062 #pragma CPROVER check disable "float-div-by-zero"
1064 #pragma CPROVER check pop
1075 #pragma CPROVER check push
1076 #pragma CPROVER check disable "float-overflow"
1077 long double lowerSquare = lower * lower;
1080 long double upper =
nextUpl(lower);
1081 long double upperSquare = upper * upper;
1082 #pragma CPROVER check pop
1090 return (d - lowerSquare < upperSquare - d) ? lower : upper;
break;
1092 return (d - lowerSquare == 0.0l) ? lower : upper;
break;
1095 return (d - lowerSquare == 0.0l) ? lower : upper;
break;
1138 #ifndef __CPROVER_MATH_H_INCLUDED
1140 #define __CPROVER_MATH_H_INCLUDED
1148 #ifndef __CPROVER_MATH_H_INCLUDED
1150 #define __CPROVER_MATH_H_INCLUDED
1158 #ifndef __CPROVER_MATH_H_INCLUDED
1160 #define __CPROVER_MATH_H_INCLUDED
1164 long double fmaxl(
long double f,
long double g) {
return ((
f >= g) ||
isnan(g)) ?
f : g; }
1181 #ifndef __CPROVER_MATH_H_INCLUDED
1183 #define __CPROVER_MATH_H_INCLUDED
1191 #ifndef __CPROVER_MATH_H_INCLUDED
1193 #define __CPROVER_MATH_H_INCLUDED
1201 #ifndef __CPROVER_MATH_H_INCLUDED
1203 #define __CPROVER_MATH_H_INCLUDED
1207 long double fminl(
long double f,
long double g) {
return ((
f <= g) ||
isnan(g)) ?
f : g; }
1220 #ifndef __CPROVER_MATH_H_INCLUDED
1222 #define __CPROVER_MATH_H_INCLUDED
1225 double fdim(
double f,
double g) {
return ((
f > g) ?
f - g : +0.0); }
1230 #ifndef __CPROVER_MATH_H_INCLUDED
1232 #define __CPROVER_MATH_H_INCLUDED
1235 float fdimf(
float f,
float g) {
return ((
f > g) ?
f - g : +0.0f); }
1240 #ifndef __CPROVER_MATH_H_INCLUDED
1242 #define __CPROVER_MATH_H_INCLUDED
1245 long double fdiml(
long double f,
long double g) {
return ((
f > g) ?
f - g : +0.0); }
1252 #ifndef __CPROVER_MATH_H_INCLUDED
1254 #define __CPROVER_MATH_H_INCLUDED
1257 #ifndef __CPROVER_FENV_H_INCLUDED
1259 #define __CPROVER_FENV_H_INCLUDED
1264 double magicConst = 0x1.0p+52;
1265 double return_value;
1269 if (
fabs(d) >= magicConst || d == 0.0)
1276 double tmp = d + magicConst;
1277 return_value = tmp - magicConst;
1279 double tmp = d - magicConst;
1280 return_value = tmp + magicConst;
1285 return return_value;
1291 #ifndef __CPROVER_MATH_H_INCLUDED
1293 #define __CPROVER_MATH_H_INCLUDED
1296 #ifndef __CPROVER_FENV_H_INCLUDED
1298 #define __CPROVER_FENV_H_INCLUDED
1303 float magicConst = 0x1.0p+23f;
1308 if (
fabsf(d) >= magicConst || d == 0.0)
1315 float tmp = d + magicConst;
1316 return_value = tmp - magicConst;
1318 float tmp = d - magicConst;
1319 return_value = tmp + magicConst;
1324 return return_value;
1331 #ifndef __CPROVER_MATH_H_INCLUDED
1333 #define __CPROVER_MATH_H_INCLUDED
1336 #ifndef __CPROVER_FENV_H_INCLUDED
1338 #define __CPROVER_FENV_H_INCLUDED
1343 long double magicConst = 0x1.0p+64;
1344 long double return_value;
1348 if (
fabsl(d) >= magicConst || d == 0.0)
1355 long double tmp = d + magicConst;
1356 return_value = tmp - magicConst;
1358 long double tmp = d - magicConst;
1359 return_value = tmp + magicConst;
1364 return return_value;
1375 #ifndef __CPROVER_MATH_H_INCLUDED
1377 #define __CPROVER_MATH_H_INCLUDED
1380 #ifndef __CPROVER_FENV_H_INCLUDED
1382 #define __CPROVER_FENV_H_INCLUDED
1394 #ifndef __CPROVER_MATH_H_INCLUDED
1396 #define __CPROVER_MATH_H_INCLUDED
1399 #ifndef __CPROVER_FENV_H_INCLUDED
1401 #define __CPROVER_FENV_H_INCLUDED
1414 #ifndef __CPROVER_MATH_H_INCLUDED
1416 #define __CPROVER_MATH_H_INCLUDED
1419 #ifndef __CPROVER_FENV_H_INCLUDED
1421 #define __CPROVER_FENV_H_INCLUDED
1439 #ifndef __CPROVER_MATH_H_INCLUDED
1441 #define __CPROVER_MATH_H_INCLUDED
1444 #ifndef __CPROVER_FENV_H_INCLUDED
1446 #define __CPROVER_FENV_H_INCLUDED
1458 #ifndef __CPROVER_MATH_H_INCLUDED
1460 #define __CPROVER_MATH_H_INCLUDED
1463 #ifndef __CPROVER_FENV_H_INCLUDED
1465 #define __CPROVER_FENV_H_INCLUDED
1478 #ifndef __CPROVER_MATH_H_INCLUDED
1480 #define __CPROVER_MATH_H_INCLUDED
1483 #ifndef __CPROVER_FENV_H_INCLUDED
1485 #define __CPROVER_FENV_H_INCLUDED
1504 #ifndef __CPROVER_MATH_H_INCLUDED
1506 #define __CPROVER_MATH_H_INCLUDED
1509 #ifndef __CPROVER_FENV_H_INCLUDED
1511 #define __CPROVER_FENV_H_INCLUDED
1523 #ifndef __CPROVER_MATH_H_INCLUDED
1525 #define __CPROVER_MATH_H_INCLUDED
1528 #ifndef __CPROVER_FENV_H_INCLUDED
1530 #define __CPROVER_FENV_H_INCLUDED
1543 #ifndef __CPROVER_MATH_H_INCLUDED
1545 #define __CPROVER_MATH_H_INCLUDED
1548 #ifndef __CPROVER_FENV_H_INCLUDED
1550 #define __CPROVER_FENV_H_INCLUDED
1569 #ifndef __CPROVER_MATH_H_INCLUDED
1571 #define __CPROVER_MATH_H_INCLUDED
1574 #ifndef __CPROVER_FENV_H_INCLUDED
1576 #define __CPROVER_FENV_H_INCLUDED
1592 }
else if (x < 0.0) {
1605 #ifndef __CPROVER_MATH_H_INCLUDED
1607 #define __CPROVER_MATH_H_INCLUDED
1610 #ifndef __CPROVER_FENV_H_INCLUDED
1612 #define __CPROVER_FENV_H_INCLUDED
1628 }
else if (x < 0.0f) {
1642 #ifndef __CPROVER_MATH_H_INCLUDED
1644 #define __CPROVER_MATH_H_INCLUDED
1647 #ifndef __CPROVER_FENV_H_INCLUDED
1649 #define __CPROVER_FENV_H_INCLUDED
1665 }
else if (x < 0.0) {
1687 #ifndef __CPROVER_MATH_H_INCLUDED
1689 #define __CPROVER_MATH_H_INCLUDED
1692 #ifndef __CPROVER_FENV_H_INCLUDED
1694 #define __CPROVER_FENV_H_INCLUDED
1706 #ifndef __CPROVER_MATH_H_INCLUDED
1708 #define __CPROVER_MATH_H_INCLUDED
1711 #ifndef __CPROVER_FENV_H_INCLUDED
1713 #define __CPROVER_FENV_H_INCLUDED
1726 #ifndef __CPROVER_MATH_H_INCLUDED
1728 #define __CPROVER_MATH_H_INCLUDED
1731 #ifndef __CPROVER_FENV_H_INCLUDED
1733 #define __CPROVER_FENV_H_INCLUDED
1754 #ifndef __CPROVER_MATH_H_INCLUDED
1756 #define __CPROVER_MATH_H_INCLUDED
1759 #ifndef __CPROVER_FENV_H_INCLUDED
1761 #define __CPROVER_FENV_H_INCLUDED
1773 #ifndef __CPROVER_MATH_H_INCLUDED
1775 #define __CPROVER_MATH_H_INCLUDED
1778 #ifndef __CPROVER_FENV_H_INCLUDED
1780 #define __CPROVER_FENV_H_INCLUDED
1792 #ifndef __CPROVER_MATH_H_INCLUDED
1794 #define __CPROVER_MATH_H_INCLUDED
1797 #ifndef __CPROVER_FENV_H_INCLUDED
1799 #define __CPROVER_FENV_H_INCLUDED
1822 #ifndef __CPROVER_MATH_H_INCLUDED
1824 #define __CPROVER_MATH_H_INCLUDED
1827 #ifndef __CPROVER_FENV_H_INCLUDED
1829 #define __CPROVER_FENV_H_INCLUDED
1839 return (
long int)rti;
1844 #ifndef __CPROVER_MATH_H_INCLUDED
1846 #define __CPROVER_MATH_H_INCLUDED
1849 #ifndef __CPROVER_FENV_H_INCLUDED
1851 #define __CPROVER_FENV_H_INCLUDED
1861 return (
long int)rti;
1867 #ifndef __CPROVER_MATH_H_INCLUDED
1869 #define __CPROVER_MATH_H_INCLUDED
1872 #ifndef __CPROVER_FENV_H_INCLUDED
1874 #define __CPROVER_FENV_H_INCLUDED
1884 return (
long int)rti;
1890 #ifndef __CPROVER_MATH_H_INCLUDED
1892 #define __CPROVER_MATH_H_INCLUDED
1895 #ifndef __CPROVER_FENV_H_INCLUDED
1897 #define __CPROVER_FENV_H_INCLUDED
1907 return (
long long int)rti;
1912 #ifndef __CPROVER_MATH_H_INCLUDED
1914 #define __CPROVER_MATH_H_INCLUDED
1917 #ifndef __CPROVER_FENV_H_INCLUDED
1919 #define __CPROVER_FENV_H_INCLUDED
1929 return (
long long int)rti;
1935 #ifndef __CPROVER_MATH_H_INCLUDED
1937 #define __CPROVER_MATH_H_INCLUDED
1940 #ifndef __CPROVER_FENV_H_INCLUDED
1942 #define __CPROVER_FENV_H_INCLUDED
1952 return (
long long int)rti;
1967 #ifndef __CPROVER_MATH_H_INCLUDED
1969 #define __CPROVER_MATH_H_INCLUDED
1972 #ifndef __CPROVER_FENV_H_INCLUDED
1974 #define __CPROVER_FENV_H_INCLUDED
1990 }
else if (x < 0.0) {
1999 return (
long int)rti;
2004 #ifndef __CPROVER_MATH_H_INCLUDED
2006 #define __CPROVER_MATH_H_INCLUDED
2009 #ifndef __CPROVER_FENV_H_INCLUDED
2011 #define __CPROVER_FENV_H_INCLUDED
2026 }
else if (x < 0.0f) {
2035 return (
long int)rti;
2041 #ifndef __CPROVER_MATH_H_INCLUDED
2043 #define __CPROVER_MATH_H_INCLUDED
2046 #ifndef __CPROVER_FENV_H_INCLUDED
2048 #define __CPROVER_FENV_H_INCLUDED
2063 }
else if (x < 0.0) {
2072 return (
long int)rti;
2078 #ifndef __CPROVER_MATH_H_INCLUDED
2080 #define __CPROVER_MATH_H_INCLUDED
2083 #ifndef __CPROVER_FENV_H_INCLUDED
2085 #define __CPROVER_FENV_H_INCLUDED
2100 }
else if (x < 0.0) {
2109 return (
long long int)rti;
2114 #ifndef __CPROVER_MATH_H_INCLUDED
2116 #define __CPROVER_MATH_H_INCLUDED
2119 #ifndef __CPROVER_FENV_H_INCLUDED
2121 #define __CPROVER_FENV_H_INCLUDED
2136 }
else if (x < 0.0f) {
2145 return (
long long int)rti;
2151 #ifndef __CPROVER_MATH_H_INCLUDED
2153 #define __CPROVER_MATH_H_INCLUDED
2156 #ifndef __CPROVER_FENV_H_INCLUDED
2158 #define __CPROVER_FENV_H_INCLUDED
2173 }
else if (x < 0.0) {
2182 return (
long long int)rti;
2196 #ifndef __CPROVER_MATH_H_INCLUDED
2198 #define __CPROVER_MATH_H_INCLUDED
2201 #ifndef __CPROVER_FENV_H_INCLUDED
2203 #define __CPROVER_FENV_H_INCLUDED
2208 double modf(
double x,
double *iptr)
2216 #ifndef __CPROVER_MATH_H_INCLUDED
2218 #define __CPROVER_MATH_H_INCLUDED
2221 #ifndef __CPROVER_FENV_H_INCLUDED
2223 #define __CPROVER_FENV_H_INCLUDED
2237 #ifndef __CPROVER_MATH_H_INCLUDED
2239 #define __CPROVER_MATH_H_INCLUDED
2242 #ifndef __CPROVER_FENV_H_INCLUDED
2244 #define __CPROVER_FENV_H_INCLUDED
2249 long double modfl(
long double x,
long double *iptr)
2267 long double div = x/y;
2269 long double res = (-y * n) + x;
2284 long double div = x/y;
2286 long double res = (-y * n) + x;
2301 long double div = x/y;
2303 long double res = (-y * n) + x;
2320 #ifndef __CPROVER_MATH_H_INCLUDED
2322 #define __CPROVER_MATH_H_INCLUDED
2325 #ifndef __CPROVER_FENV_H_INCLUDED
2327 #define __CPROVER_FENV_H_INCLUDED
2337 #ifndef __CPROVER_MATH_H_INCLUDED
2339 #define __CPROVER_MATH_H_INCLUDED
2342 #ifndef __CPROVER_FENV_H_INCLUDED
2344 #define __CPROVER_FENV_H_INCLUDED
2354 #ifndef __CPROVER_MATH_H_INCLUDED
2356 #define __CPROVER_MATH_H_INCLUDED
2359 #ifndef __CPROVER_FENV_H_INCLUDED
2361 #define __CPROVER_FENV_H_INCLUDED
2364 long double fmodl(
long double x,
long double y)
2384 #ifndef __CPROVER_MATH_H_INCLUDED
2386 #define __CPROVER_MATH_H_INCLUDED
2389 #ifndef __CPROVER_FENV_H_INCLUDED
2391 #define __CPROVER_FENV_H_INCLUDED
2401 #ifndef __CPROVER_MATH_H_INCLUDED
2403 #define __CPROVER_MATH_H_INCLUDED
2406 #ifndef __CPROVER_FENV_H_INCLUDED
2408 #define __CPROVER_FENV_H_INCLUDED
2418 #ifndef __CPROVER_MATH_H_INCLUDED
2420 #define __CPROVER_MATH_H_INCLUDED
2423 #ifndef __CPROVER_FENV_H_INCLUDED
2425 #define __CPROVER_FENV_H_INCLUDED
2445 #ifndef __CPROVER_MATH_H_INCLUDED
2447 #define __CPROVER_MATH_H_INCLUDED
2450 double fabs (
double d);
2460 #ifndef __CPROVER_MATH_H_INCLUDED
2462 #define __CPROVER_MATH_H_INCLUDED
2465 float fabsf (
float d);
2475 #ifndef __CPROVER_MATH_H_INCLUDED
2477 #define __CPROVER_MATH_H_INCLUDED
2480 long double fabsl (
long double d);
2490 #ifndef __CPROVER_MATH_H_INCLUDED
2492 # define __CPROVER_MATH_H_INCLUDED
2502 #ifndef __CPROVER_MATH_H_INCLUDED
2504 # define __CPROVER_MATH_H_INCLUDED
2509 return powf(2.0f, x);
2514 #ifndef __CPROVER_MATH_H_INCLUDED
2516 # define __CPROVER_MATH_H_INCLUDED
2521 return powl(2.0l, x);
2526 #ifndef __CPROVER_MATH_H_INCLUDED
2528 # define _USE_MATH_DEFINES
2531 # define __CPROVER_MATH_H_INCLUDED
2534 #ifndef __CPROVER_STDINT_H_INCLUDED
2535 # include <stdint.h>
2536 # define __CPROVER_STDINT_H_INCLUDED
2539 #ifndef __CPROVER_ERRNO_H_INCLUDED
2541 # define __CPROVER_ERRNO_H_INCLUDED
2553 else if(x < -1024.0 * M_LN2)
2558 else if(x > 1024.0 * M_LN2)
2561 #pragma CPROVER check push
2562 #pragma CPROVER check disable "float-overflow"
2564 #pragma CPROVER check pop
2571 int32_t bias = (1 << 20) * ((1 << 10) - 1);
2572 int32_t exp_a_x = (int32_t)(x / M_LN2 * (
double)(1 << 20)) + bias;
2575 int32_t lower = exp_a_x - 90253;
2576 int32_t upper = exp_a_x + 1;
2586 (
sizeof(double) == 2 *
sizeof(int32_t),
2587 "bit width of double is 2x bit width of int32_t");
2593 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
2594 union U u = {.i = {0, result}};
2596 union U u = {.i = {result, 0}};
2603 #ifndef __CPROVER_MATH_H_INCLUDED
2605 # define _USE_MATH_DEFINES
2608 # define __CPROVER_MATH_H_INCLUDED
2611 #ifndef __CPROVER_STDINT_H_INCLUDED
2612 # include <stdint.h>
2613 # define __CPROVER_STDINT_H_INCLUDED
2616 #ifndef __CPROVER_ERRNO_H_INCLUDED
2618 # define __CPROVER_ERRNO_H_INCLUDED
2630 else if(x < -128.0f * (
float)M_LN2)
2635 else if(x > 128.0f * (
float)M_LN2)
2638 #pragma CPROVER check push
2639 #pragma CPROVER check disable "float-overflow"
2641 #pragma CPROVER check pop
2645 int32_t bias = (1 << 23) * ((1 << 7) - 1);
2646 int32_t exp_a_x = (int32_t)(x / (
float)M_LN2 * (float)(1 << 23)) + bias;
2649 int32_t lower = exp_a_x - 722019;
2650 int32_t upper = exp_a_x + 1;
2660 (
sizeof(float) ==
sizeof(int32_t),
2661 "bit width of float and int32_t should match");
2667 union U u = {.i = result};
2673 #ifndef __CPROVER_MATH_H_INCLUDED
2675 # define _USE_MATH_DEFINES
2678 # define __CPROVER_MATH_H_INCLUDED
2681 #ifndef __CPROVER_FLOAT_H_INCLUDED
2683 # define __CPROVER_FLOAT_H_INCLUDED
2686 #ifndef __CPROVER_STDINT_H_INCLUDED
2687 # include <stdint.h>
2688 # define __CPROVER_STDINT_H_INCLUDED
2691 #ifndef __CPROVER_ERRNO_H_INCLUDED
2693 # define __CPROVER_ERRNO_H_INCLUDED
2705 #if LDBL_MAX_EXP == DBL_MAX_EXP
2709 if(x < -16384.0l * M_LN2)
2714 else if(x > 16384.0l * M_LN2)
2717 # pragma CPROVER check push
2718 # pragma CPROVER check disable "float-overflow"
2720 # pragma CPROVER check pop
2723 int32_t bias = (1 << 16) * ((1 << 14) - 1);
2724 int32_t exp_a_x = (int32_t)(x / M_LN2 * (
long double)(1 << 16)) + bias;
2727 int32_t lower = exp_a_x - 5641;
2728 int32_t upper = exp_a_x + 1;
2738 (
sizeof(
long double) %
sizeof(int32_t) == 0,
2739 "bit width of long double is a multiple of bit width of int32_t");
2743 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
2745 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
2746 u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] = result;
2756 #ifndef __CPROVER_MATH_H_INCLUDED
2758 # define _USE_MATH_DEFINES
2761 # define __CPROVER_MATH_H_INCLUDED
2764 #ifndef __CPROVER_STDINT_H_INCLUDED
2765 # include <stdint.h>
2766 # define __CPROVER_STDINT_H_INCLUDED
2769 #ifndef __CPROVER_ERRNO_H_INCLUDED
2771 # define __CPROVER_ERRNO_H_INCLUDED
2782 else if(fpclassify(x) == FP_ZERO)
2785 #pragma CPROVER check push
2786 #pragma CPROVER check disable "float-overflow"
2788 #pragma CPROVER check pop
2793 #pragma CPROVER check push
2794 #pragma CPROVER check disable "float-div-by-zero"
2796 #pragma CPROVER check pop
2804 (
sizeof(double) == 2 *
sizeof(int32_t),
2805 "bit width of double is 2x bit width of int32_t");
2812 int32_t bias = (1 << 20) * ((1 << 10) - 1);
2815 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
2816 return ((
double)u.i[1] - (
double)(bias + exp_c)) * M_LN2 / (double)(1 << 20);
2818 return ((
double)u.i[0] - (double)(bias + exp_c)) * M_LN2 / (
double)(1 << 20);
2824 #ifndef __CPROVER_MATH_H_INCLUDED
2826 # define _USE_MATH_DEFINES
2829 # define __CPROVER_MATH_H_INCLUDED
2832 #ifndef __CPROVER_STDINT_H_INCLUDED
2833 # include <stdint.h>
2834 # define __CPROVER_STDINT_H_INCLUDED
2837 #ifndef __CPROVER_ERRNO_H_INCLUDED
2839 # define __CPROVER_ERRNO_H_INCLUDED
2850 else if(fpclassify(x) == FP_ZERO)
2853 #pragma CPROVER check push
2854 #pragma CPROVER check disable "float-overflow"
2856 #pragma CPROVER check pop
2861 #pragma CPROVER check push
2862 #pragma CPROVER check disable "float-div-by-zero"
2864 #pragma CPROVER check pop
2872 (
sizeof(float) ==
sizeof(int32_t),
2873 "bit width of float and int32_t should match");
2880 int32_t bias = (1 << 23) * ((1 << 7) - 1);
2883 return ((
float)u.i - (
float)(bias + exp_c)) * (float)M_LN2 / (
float)(1 << 23);
2888 #ifndef __CPROVER_MATH_H_INCLUDED
2890 # define _USE_MATH_DEFINES
2893 # define __CPROVER_MATH_H_INCLUDED
2896 #ifndef __CPROVER_STDINT_H_INCLUDED
2897 # include <stdint.h>
2898 # define __CPROVER_STDINT_H_INCLUDED
2901 #ifndef __CPROVER_ERRNO_H_INCLUDED
2903 # define __CPROVER_ERRNO_H_INCLUDED
2906 #ifndef __CPROVER_FLOAT_H_INCLUDED
2908 # define __CPROVER_FLOAT_H_INCLUDED
2919 else if(fpclassify(x) == FP_ZERO)
2922 #pragma CPROVER check push
2923 #pragma CPROVER check disable "float-overflow"
2925 #pragma CPROVER check pop
2930 #pragma CPROVER check push
2931 #pragma CPROVER check disable "float-div-by-zero"
2933 #pragma CPROVER check pop
2936 #if LDBL_MAX_EXP == DBL_MAX_EXP
2944 (
sizeof(
long double) %
sizeof(int32_t) == 0,
2945 "bit width of long double is a multiple of bit width of int32_t");
2949 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
2951 int32_t bias = (1 << 16) * ((1 << 14) - 1);
2954 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
2955 return ((
long double)u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] -
2956 (
long double)(bias + exp_c)) *
2957 M_LN2 / (
long double)(1 << 16);
2959 return ((
long double)u.i[0] - (
long double)(bias + exp_c)) * M_LN2 /
2960 (
long double)(1 << 16);
2967 #ifndef __CPROVER_MATH_H_INCLUDED
2969 # define _USE_MATH_DEFINES
2972 # define __CPROVER_MATH_H_INCLUDED
2975 #ifndef __CPROVER_STDINT_H_INCLUDED
2976 # include <stdint.h>
2977 # define __CPROVER_STDINT_H_INCLUDED
2980 #ifndef __CPROVER_ERRNO_H_INCLUDED
2982 # define __CPROVER_ERRNO_H_INCLUDED
2993 else if(fpclassify(x) == FP_ZERO)
2996 #pragma CPROVER check push
2997 #pragma CPROVER check disable "float-overflow"
2999 #pragma CPROVER check pop
3004 #pragma CPROVER check push
3005 #pragma CPROVER check disable "float-div-by-zero"
3007 #pragma CPROVER check pop
3015 (
sizeof(double) == 2 *
sizeof(int32_t),
3016 "bit width of double is 2x bit width of int32_t");
3022 int32_t bias = (1 << 20) * ((1 << 10) - 1);
3025 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3026 return ((
double)u.i[1] - (
double)(bias + exp_c)) / (double)(1 << 20);
3028 return ((
double)u.i[0] - (double)(bias + exp_c)) / (
double)(1 << 20);
3034 #ifndef __CPROVER_MATH_H_INCLUDED
3036 # define _USE_MATH_DEFINES
3039 # define __CPROVER_MATH_H_INCLUDED
3042 #ifndef __CPROVER_STDINT_H_INCLUDED
3043 # include <stdint.h>
3044 # define __CPROVER_STDINT_H_INCLUDED
3047 #ifndef __CPROVER_ERRNO_H_INCLUDED
3049 # define __CPROVER_ERRNO_H_INCLUDED
3060 else if(fpclassify(x) == FP_ZERO)
3063 #pragma CPROVER check push
3064 #pragma CPROVER check disable "float-overflow"
3066 #pragma CPROVER check pop
3071 #pragma CPROVER check push
3072 #pragma CPROVER check disable "float-div-by-zero"
3074 #pragma CPROVER check pop
3082 (
sizeof(float) ==
sizeof(int32_t),
3083 "bit width of float and int32_t should match");
3089 int32_t bias = (1 << 23) * ((1 << 7) - 1);
3092 return ((
float)u.i - (
float)(bias + exp_c)) / (float)(1 << 23);
3097 #ifndef __CPROVER_MATH_H_INCLUDED
3099 # define _USE_MATH_DEFINES
3102 # define __CPROVER_MATH_H_INCLUDED
3105 #ifndef __CPROVER_STDINT_H_INCLUDED
3106 # include <stdint.h>
3107 # define __CPROVER_STDINT_H_INCLUDED
3110 #ifndef __CPROVER_ERRNO_H_INCLUDED
3112 # define __CPROVER_ERRNO_H_INCLUDED
3115 #ifndef __CPROVER_FLOAT_H_INCLUDED
3117 # define __CPROVER_FLOAT_H_INCLUDED
3128 else if(fpclassify(x) == FP_ZERO)
3131 #pragma CPROVER check push
3132 #pragma CPROVER check disable "float-overflow"
3134 #pragma CPROVER check pop
3139 #pragma CPROVER check push
3140 #pragma CPROVER check disable "float-div-by-zero"
3142 #pragma CPROVER check pop
3145 #if LDBL_MAX_EXP == DBL_MAX_EXP
3153 (
sizeof(
long double) %
sizeof(int32_t) == 0,
3154 "bit width of long double is a multiple of bit width of int32_t");
3158 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
3160 int32_t bias = (1 << 16) * ((1 << 14) - 1);
3163 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3164 return ((
long double)u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] -
3165 (
long double)(bias + exp_c)) /
3166 (
long double)(1 << 16);
3168 return ((
long double)u.i[0] - (
long double)(bias + exp_c)) /
3169 (
long double)(1 << 16);
3176 #ifndef __CPROVER_MATH_H_INCLUDED
3178 # define _USE_MATH_DEFINES
3181 # define __CPROVER_MATH_H_INCLUDED
3184 #ifndef __CPROVER_STDINT_H_INCLUDED
3185 # include <stdint.h>
3186 # define __CPROVER_STDINT_H_INCLUDED
3189 #ifndef __CPROVER_ERRNO_H_INCLUDED
3191 # define __CPROVER_ERRNO_H_INCLUDED
3202 else if(fpclassify(x) == FP_ZERO)
3205 #pragma CPROVER check push
3206 #pragma CPROVER check disable "float-overflow"
3208 #pragma CPROVER check pop
3213 #pragma CPROVER check push
3214 #pragma CPROVER check disable "float-div-by-zero"
3216 #pragma CPROVER check pop
3224 (
sizeof(double) == 2 *
sizeof(int32_t),
3225 "bit width of double is 2x bit width of int32_t");
3232 int32_t bias = (1 << 20) * ((1 << 10) - 1);
3235 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3236 return ((
double)u.i[1] - (
double)(bias + exp_c)) * (M_LN2 / M_LN10) /
3239 return ((
double)u.i[0] - (double)(bias + exp_c)) * (M_LN2 / M_LN10) /
3246 #ifndef __CPROVER_MATH_H_INCLUDED
3248 # define _USE_MATH_DEFINES
3251 # define __CPROVER_MATH_H_INCLUDED
3254 #ifndef __CPROVER_STDINT_H_INCLUDED
3255 # include <stdint.h>
3256 # define __CPROVER_STDINT_H_INCLUDED
3259 #ifndef __CPROVER_ERRNO_H_INCLUDED
3261 # define __CPROVER_ERRNO_H_INCLUDED
3272 else if(fpclassify(x) == FP_ZERO)
3275 #pragma CPROVER check push
3276 #pragma CPROVER check disable "float-overflow"
3278 #pragma CPROVER check pop
3283 #pragma CPROVER check push
3284 #pragma CPROVER check disable "float-div-by-zero"
3286 #pragma CPROVER check pop
3294 (
sizeof(float) ==
sizeof(int32_t),
3295 "bit width of float and int32_t should match");
3302 int32_t bias = (1 << 23) * ((1 << 7) - 1);
3305 return ((
float)u.i - (
float)(bias + exp_c)) * (float)(M_LN2 / M_LN10) /
3311 #ifndef __CPROVER_MATH_H_INCLUDED
3313 # define _USE_MATH_DEFINES
3316 # define __CPROVER_MATH_H_INCLUDED
3319 #ifndef __CPROVER_STDINT_H_INCLUDED
3320 # include <stdint.h>
3321 # define __CPROVER_STDINT_H_INCLUDED
3324 #ifndef __CPROVER_ERRNO_H_INCLUDED
3326 # define __CPROVER_ERRNO_H_INCLUDED
3329 #ifndef __CPROVER_FLOAT_H_INCLUDED
3331 # define __CPROVER_FLOAT_H_INCLUDED
3342 else if(fpclassify(x) == FP_ZERO)
3345 #pragma CPROVER check push
3346 #pragma CPROVER check disable "float-overflow"
3348 #pragma CPROVER check pop
3353 #pragma CPROVER check push
3354 #pragma CPROVER check disable "float-div-by-zero"
3356 #pragma CPROVER check pop
3359 #if LDBL_MAX_EXP == DBL_MAX_EXP
3367 (
sizeof(
long double) %
sizeof(int32_t) == 0,
3368 "bit width of long double is a multiple of bit width of int32_t");
3372 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
3374 int32_t bias = (1 << 16) * ((1 << 14) - 1);
3377 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3378 return ((
long double)u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] -
3379 (
long double)(bias + exp_c)) *
3380 (M_LN2 / M_LN10) / (
long double)(1 << 16);
3382 return ((
long double)u.i[0] - (
long double)(bias + exp_c)) *
3383 (M_LN2 / M_LN10) / (
long double)(1 << 16);
3390 #ifndef __CPROVER_MATH_H_INCLUDED
3392 # define __CPROVER_MATH_H_INCLUDED
3395 #ifndef __CPROVER_STDINT_H_INCLUDED
3396 # include <stdint.h>
3397 # define __CPROVER_STDINT_H_INCLUDED
3400 #ifndef __CPROVER_ERRNO_H_INCLUDED
3402 # define __CPROVER_ERRNO_H_INCLUDED
3409 double pow(
double x,
double y)
3417 #pragma CPROVER check push
3418 #pragma CPROVER check disable "float-div-by-zero"
3420 #pragma CPROVER check pop
3424 else if(fpclassify(y) == FP_ZERO)
3480 #pragma CPROVER check push
3481 #pragma CPROVER check disable "float-overflow"
3486 #pragma CPROVER check pop
3489 #pragma CPROVER check push
3490 #pragma CPROVER check disable "float-div-by-zero"
3492 #pragma CPROVER check pop
3499 (
sizeof(double) == 2 *
sizeof(int32_t),
3500 "bit width of double is 2x bit width of int32_t");
3507 int32_t bias = (1 << 20) * ((1 << 10) - 1);
3510 #pragma CPROVER check push
3511 #pragma CPROVER check disable "signed-overflow"
3512 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3513 double mult_result = y * (double)(u.i[1] - (bias + exp_c));
3515 double mult_result = y * (double)(u.i[0] - (bias + exp_c));
3517 #pragma CPROVER check pop
3518 if(
fabs(mult_result) > (double)(1 << 30))
3521 #pragma CPROVER check push
3522 #pragma CPROVER check disable "float-overflow"
3523 return y > 0.0 ? HUGE_VAL : 0.0;
3524 #pragma CPROVER check pop
3526 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3527 u.i[1] = (int32_t)mult_result + (bias + exp_c);
3530 u.i[0] = (int32_t)mult_result + (bias + exp_c);
3538 #ifndef __CPROVER_MATH_H_INCLUDED
3540 # define __CPROVER_MATH_H_INCLUDED
3543 #ifndef __CPROVER_STDINT_H_INCLUDED
3544 # include <stdint.h>
3545 # define __CPROVER_STDINT_H_INCLUDED
3548 #ifndef __CPROVER_ERRNO_H_INCLUDED
3550 # define __CPROVER_ERRNO_H_INCLUDED
3565 #pragma CPROVER check push
3566 #pragma CPROVER check disable "float-div-by-zero"
3568 #pragma CPROVER check pop
3572 else if(fpclassify(y) == FP_ZERO)
3628 #pragma CPROVER check push
3629 #pragma CPROVER check disable "float-overflow"
3637 #pragma CPROVER check pop
3640 #pragma CPROVER check push
3641 #pragma CPROVER check disable "float-div-by-zero"
3643 #pragma CPROVER check pop
3650 (
sizeof(float) ==
sizeof(int32_t),
3651 "bit width of float and int32_t should match");
3657 int32_t bias = (1 << 23) * ((1 << 7) - 1);
3660 #pragma CPROVER check push
3661 #pragma CPROVER check disable "signed-overflow"
3662 float mult_result = y * (float)(u.i - (bias + exp_c));
3663 #pragma CPROVER check pop
3664 if(
fabsf(mult_result) > (float)(1 << 30))
3667 #pragma CPROVER check push
3668 #pragma CPROVER check disable "float-overflow"
3669 return y > 0.0f ? HUGE_VALF : 0.0f;
3670 #pragma CPROVER check pop
3672 u.i = (int32_t)mult_result + (bias + exp_c);
3678 #ifndef __CPROVER_MATH_H_INCLUDED
3680 # define __CPROVER_MATH_H_INCLUDED
3683 #ifndef __CPROVER_FLOAT_H_INCLUDED
3685 # define __CPROVER_FLOAT_H_INCLUDED
3688 #ifndef __CPROVER_STDINT_H_INCLUDED
3689 # include <stdint.h>
3690 # define __CPROVER_STDINT_H_INCLUDED
3693 #ifndef __CPROVER_ERRNO_H_INCLUDED
3695 # define __CPROVER_ERRNO_H_INCLUDED
3702 long double powl(
long double x,
long double y)
3710 #pragma CPROVER check push
3711 #pragma CPROVER check disable "float-div-by-zero"
3713 #pragma CPROVER check pop
3717 else if(fpclassify(y) == FP_ZERO)
3773 #pragma CPROVER check push
3774 #pragma CPROVER check disable "float-overflow"
3783 #pragma CPROVER check pop
3786 #pragma CPROVER check push
3787 #pragma CPROVER check disable "float-div-by-zero"
3789 #pragma CPROVER check pop
3791 #if LDBL_MAX_EXP == DBL_MAX_EXP
3799 (
sizeof(
long double) %
sizeof(int32_t) == 0,
3800 "bit width of long double is a multiple of bit width of int32_t");
3804 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
3806 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3807 int32_t exponent = u.i[
sizeof(
long double) /
sizeof(int32_t) - 1];
3809 int32_t exponent = u.i[0];
3811 int32_t bias = (1 << 16) * ((1 << 14) - 1);
3814 # pragma CPROVER check push
3815 # pragma CPROVER check disable "signed-overflow"
3816 long double mult_result = y * (
long double)(exponent - (bias + exp_c));
3817 # pragma CPROVER check pop
3818 if(
fabsl(mult_result) > (
long double)(1 << 30))
3821 # pragma CPROVER check push
3822 # pragma CPROVER check disable "float-overflow"
3823 return y > 0.0l ? HUGE_VALL : 0.0l;
3824 # pragma CPROVER check pop
3826 int32_t result = (int32_t)mult_result + (bias + exp_c);
3827 union U result_u = {.i = {0}};
3828 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
3829 result_u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] = result;
3831 result_u.i[0] = result;
3839 #ifndef __CPROVER_MATH_H_INCLUDED
3841 # define __CPROVER_MATH_H_INCLUDED
3844 #ifndef __CPROVER_FENV_H_INCLUDED
3846 # define __CPROVER_FENV_H_INCLUDED
3851 double fma(
double x,
double y,
double z)
3854 #pragma CPROVER check push
3855 #pragma CPROVER check disable "float-div-by-zero"
3860 (fpclassify(x) == FP_ZERO || fpclassify(y) == FP_ZERO))
3868 #pragma CPROVER check disable "float-overflow"
3869 double x_times_y = x * y;
3877 #pragma CPROVER check pop
3879 if(
isinf(x_times_y))
3886 return x_times_y + z;
3891 #ifndef __CPROVER_MATH_H_INCLUDED
3893 # define __CPROVER_MATH_H_INCLUDED
3896 #ifndef __CPROVER_FENV_H_INCLUDED
3898 # define __CPROVER_FENV_H_INCLUDED
3903 float fmaf(
float x,
float y,
float z)
3906 #pragma CPROVER check push
3907 #pragma CPROVER check disable "float-div-by-zero"
3912 (fpclassify(x) == FP_ZERO || fpclassify(y) == FP_ZERO))
3920 #pragma CPROVER check disable "float-overflow"
3921 float x_times_y = x * y;
3929 #pragma CPROVER check pop
3938 return x_times_y + z;
3943 #ifndef __CPROVER_MATH_H_INCLUDED
3945 # define __CPROVER_MATH_H_INCLUDED
3948 #ifndef __CPROVER_FENV_H_INCLUDED
3950 # define __CPROVER_FENV_H_INCLUDED
3953 #ifndef __CPROVER_FLOAT_H_INCLUDED
3955 # define __CPROVER_FLOAT_H_INCLUDED
3960 long double fmal(
long double x,
long double y,
long double z)
3963 #pragma CPROVER check push
3964 #pragma CPROVER check disable "float-div-by-zero"
3969 (fpclassify(x) == FP_ZERO || fpclassify(y) == FP_ZERO))
3977 #pragma CPROVER check disable "float-overflow"
3978 long double x_times_y = x * y;
3986 #pragma CPROVER check pop
3988 #if LDBL_MAX_EXP == DBL_MAX_EXP
3989 return fma(x, y, z);
3998 return x_times_y + z;
4004 #ifndef __CPROVER_MATH_H_INCLUDED
4006 # define __CPROVER_MATH_H_INCLUDED
4009 #ifndef __CPROVER_STDINT_H_INCLUDED
4010 # include <stdint.h>
4011 # define __CPROVER_STDINT_H_INCLUDED
4014 #ifndef __CPROVER_ERRNO_H_INCLUDED
4016 # define __CPROVER_ERRNO_H_INCLUDED
4031 else if(fpclassify(x) == FP_ZERO && y > 0)
4062 else if(fpclassify(x) == FP_ZERO && y < 0)
4065 #pragma CPROVER check push
4066 #pragma CPROVER check disable "float-overflow"
4071 #pragma CPROVER check pop
4074 #pragma CPROVER check push
4075 #pragma CPROVER check disable "float-div-by-zero"
4077 #pragma CPROVER check pop
4084 (
sizeof(double) == 2 *
sizeof(int32_t),
4085 "bit width of double is 2x bit width of int32_t");
4092 int32_t bias = (1 << 20) * ((1 << 10) - 1);
4095 #pragma CPROVER check push
4096 #pragma CPROVER check disable "signed-overflow"
4097 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
4098 double mult_result = (double)(y) * (double)(u.i[1] - (bias + exp_c));
4100 double mult_result = (double)(y) * (double)(u.i[0] - (bias + exp_c));
4102 #pragma CPROVER check pop
4103 if(
fabs(mult_result) > (double)(1 << 30))
4106 #pragma CPROVER check push
4107 #pragma CPROVER check disable "float-overflow"
4108 return y > 0 ? HUGE_VAL : 0.0;
4109 #pragma CPROVER check pop
4111 #if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
4112 u.i[1] = (int32_t)mult_result + (bias + exp_c);
4115 u.i[0] = (int32_t)mult_result + (bias + exp_c);
4123 #ifndef __CPROVER_MATH_H_INCLUDED
4125 # define __CPROVER_MATH_H_INCLUDED
4128 #ifndef __CPROVER_STDINT_H_INCLUDED
4129 # include <stdint.h>
4130 # define __CPROVER_STDINT_H_INCLUDED
4133 #ifndef __CPROVER_ERRNO_H_INCLUDED
4135 # define __CPROVER_ERRNO_H_INCLUDED
4150 else if(fpclassify(x) == FP_ZERO && y > 0)
4181 else if(fpclassify(x) == FP_ZERO && y < 0)
4184 #pragma CPROVER check push
4185 #pragma CPROVER check disable "float-overflow"
4192 #pragma CPROVER check pop
4195 #pragma CPROVER check push
4196 #pragma CPROVER check disable "float-div-by-zero"
4198 #pragma CPROVER check pop
4205 (
sizeof(float) ==
sizeof(int32_t),
4206 "bit width of float and int32_t should match");
4212 int32_t bias = (1 << 23) * ((1 << 7) - 1);
4215 #pragma CPROVER check push
4216 #pragma CPROVER check disable "signed-overflow"
4217 float mult_result = (float)(y) * (float)(u.i - (bias + exp_c));
4218 #pragma CPROVER check pop
4219 if(
fabsf(mult_result) > (float)(1 << 30))
4222 #pragma CPROVER check push
4223 #pragma CPROVER check disable "float-overflow"
4224 return y > 0 ? HUGE_VALF : 0.0f;
4225 #pragma CPROVER check pop
4227 u.i = (int32_t)mult_result + (bias + exp_c);
4233 #ifndef __CPROVER_MATH_H_INCLUDED
4235 # define __CPROVER_MATH_H_INCLUDED
4238 #ifndef __CPROVER_FLOAT_H_INCLUDED
4240 # define __CPROVER_FLOAT_H_INCLUDED
4243 #ifndef __CPROVER_STDINT_H_INCLUDED
4244 # include <stdint.h>
4245 # define __CPROVER_STDINT_H_INCLUDED
4248 #ifndef __CPROVER_ERRNO_H_INCLUDED
4250 # define __CPROVER_ERRNO_H_INCLUDED
4266 else if(fpclassify(x) == FP_ZERO && y > 0)
4297 else if(fpclassify(x) == FP_ZERO && y < 0)
4300 #pragma CPROVER check push
4301 #pragma CPROVER check disable "float-overflow"
4308 #pragma CPROVER check pop
4311 #pragma CPROVER check push
4312 #pragma CPROVER check disable "float-div-by-zero"
4314 #pragma CPROVER check pop
4316 #if LDBL_MAX_EXP == DBL_MAX_EXP
4324 (
sizeof(
long double) %
sizeof(int32_t) == 0,
4325 "bit width of long double is a multiple of bit width of int32_t");
4329 int32_t i[
sizeof(
long double) /
sizeof(int32_t)];
4331 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
4332 int32_t exponent = u.i[
sizeof(
long double) /
sizeof(int32_t) - 1];
4334 int32_t exponent = u.i[0];
4336 int32_t bias = (1 << 16) * ((1 << 14) - 1);
4339 # pragma CPROVER check push
4340 # pragma CPROVER check disable "signed-overflow"
4341 long double mult_result =
4342 (
long double)y * (
long double)(exponent - (bias + exp_c));
4343 # pragma CPROVER check pop
4344 if(
fabsl(mult_result) > (
long double)(1 << 30))
4347 # pragma CPROVER check push
4348 # pragma CPROVER check disable "float-overflow"
4349 return y > 0 ? HUGE_VALL : 0.0l;
4350 # pragma CPROVER check pop
4352 int32_t result = (int32_t)mult_result + (bias + exp_c);
4353 union U result_u = {.i = {0}};
4354 # if !defined(__BYTE_ORDER__) || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
4355 result_u.i[
sizeof(
long double) /
sizeof(int32_t) - 1] = result;
4357 result_u.i[0] = result;
int fesetround(int rounding_mode)
int feraiseexcept(int excepts)
long int lroundf(float x)
int __fpclassifyl(long double f)
float __builtin_fabsf(float f)
float fminf(float f, float g)
float __VERIFIER_nondet_float(void)
double fmax(double f, double g)
long long int llrintl(long double x)
long double floorl(long double x)
long double __VERIFIER_nondet_long_double(void)
long double sqrtl(long double d)
double nan(const char *str)
long double powl(long double x, long double y)
long double fminl(long double f, long double g)
long long int llrintf(float x)
float __builtin_powif(float x, int y)
float remainderf(float x, float y)
int __CPROVER_islessf(float f, float g)
int isinfl(long double ld)
long long int llround(double x)
int __CPROVER_isgreaterd(double f, double g)
float fmaxf(float f, float g)
float __sort_of_CPROVER_remainderf(int rounding_mode, float x, float y)
long double exp2l(long double x)
int __fpclassifyf(float f)
long double nearbyintl(long double x)
int __builtin_isnan(double d)
double __builtin_powi(double x, int y)
float fdimf(float f, float g)
double __sort_of_CPROVER_remainder(int rounding_mode, double x, double y)
double fmod(double x, double y)
int __CPROVER_isgreaterequalf(float f, float g)
int __builtin_isinfl(long double ld)
long int lround(double x)
double __builtin_huge_val(void)
long double fmaxl(long double f, long double g)
double __builtin_nan(const char *str)
double nearbyint(double x)
long long int llrint(double x)
long double roundl(long double x)
long double cosl(long double x)
int32_t __VERIFIER_nondet_int32_t(void)
double __builtin_inf(void)
int __CPROVER_isunorderedd(double f, double g)
int __CPROVER_islessgreaterd(double f, double g)
int __isinfl(long double ld)
long long int llroundf(float x)
long long int llroundl(long double x)
int __CPROVER_islessgreaterf(float f, float g)
int __CPROVER_isgreaterequald(double f, double g)
int __CPROVER_islessd(double f, double g)
int __CPROVER_isgreaterf(float f, float g)
long double __sort_of_CPROVER_round_to_integrall(int rounding_mode, long double d)
long double truncl(long double x)
int __CPROVER_islessequald(double f, double g)
long double __sort_of_CPROVER_remainderl(int rounding_mode, long double x, long double y)
long double __builtin_fabsl(long double d)
float __builtin_inff(void)
long double log2l(long double x)
double pow(double x, double y)
float fmaf(float x, float y, float z)
int __CPROVER_islessequalf(float f, float g)
long double fmodl(long double x, long double y)
float __builtin_nanf(const char *str)
int isnanl(long double ld)
int __builtin_isinff(float f)
double fmin(double f, double g)
short _ldclass(long double ld)
float nearbyintf(float x)
long double modfl(long double x, long double *iptr)
int _ldsign(long double ld)
long double remainderl(long double x, long double y)
long double fabsl(long double d)
int __finitel(long double ld)
int __fpclassifyd(double d)
float powf(float x, float y)
long int lrintl(long double x)
double fma(double x, double y, double z)
double __VERIFIER_nondet_double(void)
float nanf(const char *str)
float modff(float x, float *iptr)
double copysign(double x, double y)
double __builtin_fabs(double d)
int __isnanl(long double ld)
long double nextUpl(long double d)
long double ceill(long double x)
int __fpclassify(double d)
long double fdiml(long double f, long double g)
long double copysignl(long double x, long double y)
long double log10l(long double x)
int __builtin_isinf(double d)
long double __builtin_powil(long double x, int y)
long double sinl(long double x)
float __builtin_huge_valf(void)
long double expl(long double x)
long double rintl(long double x)
float fmodf(float x, float y)
long double fmal(long double x, long double y, long double z)
int __CPROVER_isunorderedf(float f, float g)
float __sort_of_CPROVER_round_to_integralf(int rounding_mode, float d)
long double __builtin_huge_vall(void)
long double nanl(const char *str)
long double logl(long double x)
double remainder(double x, double y)
float copysignf(float x, float y)
long double __builtin_infl(void)
double __sort_of_CPROVER_round_to_integral(int rounding_mode, double d)
long int lroundl(long double x)
int __builtin_isnanf(float f)
double modf(double x, double *iptr)
double fdim(double f, double g)
__CPROVER_bitvector[CHAR_BIT *sizeof(double)] bv
__CPROVER_bitvector[CHAR_BIT *sizeof(float)] bv
__CPROVER_bitvector[CHAR_BIT *sizeof(long double)] bv