Skip to content

Commit 673dffd

Browse files
committed
implementation of increment and decrement
1 parent 6a77dd9 commit 673dffd

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

include/universal/blas/blas_l1.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
88
#include <cmath>
9-
#include <universal/math/math> // injection of native IEEE-754 math library functions into sw::universal namespace
9+
#include <universal/math/mathlib_shim.hpp> // injection of native IEEE-754 math library functions into sw::universal namespace
1010
#include <universal/blas/vector.hpp>
1111

1212
namespace sw { namespace universal { namespace blas {

include/universal/blas/scaling.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// This file is part of the universal numbers project, which is released under an MIT Open Source license.
88
#include <cmath>
9-
#include <universal/math/math> // injection of native IEEE-754 math library functions into sw::universal namespace
9+
#include <universal/math/mathlib_shim.hpp> // injection of native IEEE-754 math library functions into sw::universal namespace
1010

1111
namespace sw { namespace universal { namespace blas {
1212

include/universal/number/dd/dd_impl.hpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ class dd {
280280
// move into or through the subnormal range of the high limb
281281
hi = std::nextafter(hi, +INFINITY);
282282
}
283-
else if (isfinite(hi)) {
283+
else if (std::isfinite(hi)) {
284284
int highScale = sw::universal::scale(hi);
285285
if (lo == 0.0) {
286286
// the second limb cannot be a denorm, so we need to jump to the first normal value
@@ -292,7 +292,7 @@ class dd {
292292
lo = std::nextafter(lo, +INFINITY);
293293
int newLowScale = sw::universal::scale(lo);
294294
// check for overflow: could be transitioning into the next binade, or INF in last binade
295-
if (lowScale < newLowScale || isinf(lo)) {
295+
if (lowScale < newLowScale || std::isinf(lo)) {
296296
lo = 0.0;
297297
hi = std::nextafter(hi, +INFINITY);
298298
}
@@ -313,8 +313,7 @@ class dd {
313313
// move into or through the subnormal range of the high limb
314314
hi = std::nextafter(hi, -INFINITY);
315315
}
316-
else if (isfinite(hi)) {
317-
int highScale = sw::universal::scale(hi);
316+
else if (std::isfinite(hi)) {
318317
if (lo == 0.0) {
319318
// we need to drop into a lower binade, thus we need to update the high limb first
320319
hi = std::nextafter(hi, -INFINITY);
@@ -327,7 +326,7 @@ class dd {
327326
lo = std::nextafter(lo, -INFINITY);
328327
int newLowScale = sw::universal::scale(lo);
329328
// check for overflow
330-
if (lowScale < newLowScale || isinf(lo)) {
329+
if (lowScale < newLowScale || std::isinf(lo)) {
331330
lo = 0.0;
332331
hi = std::nextafter(hi, -INFINITY);
333332
}
@@ -599,7 +598,7 @@ class dd {
599598
}
600599
else {
601600
hi = static_cast<double>(v);
602-
lo = static_cast<double>(v - static_cast<int64_t>(hi));
601+
lo = 0.0;
603602
}
604603
return *this;
605604
}
@@ -610,7 +609,7 @@ class dd {
610609
}
611610
else {
612611
hi = static_cast<double>(v);
613-
lo = static_cast<double>(v - static_cast<uint64_t>(hi)); // difference is always positive
612+
lo = 0.0;
614613
}
615614
return *this;
616615
}

include/universal/verification/areal_test_suite.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ namespace sw { namespace universal {
143143
}
144144
// da + delta = (0,minpos)
145145
testValue = da + delta;
146-
if (issubnorm(testValue)) { std::cout << testValue << " is denormalized\n"; }
146+
if (isdenorm(testValue)) { std::cout << testValue << " is denormalized\n"; }
147147
nut = testValue;
148148
nrOfFailedTests += Compare(testValue, nut, interval, reportTestCases);
149149
}

static/dd/api/api.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,14 @@ try {
196196
ReportValue(a, "nextbelow 1.0", 20, 32);
197197

198198
{
199+
// iszero() and isdenorm() are defined in the sw::universal namespace
200+
// In clang there is an ambiguity in math.h
201+
// and for some reason isdenorm is not in std namespace
202+
// so make the call explicit for double
199203
double d(0.0);
200-
if (iszero(d)) std::cout << d << " is zero\n";
204+
if (sw::universal::iszero(d)) std::cout << d << " is zero\n";
201205
d = std::nextafter(d, +INFINITY);
202-
if (isdenorm(d)) std::cout << d << " is a subnormal number\n";
206+
if (sw::universal::isdenorm(d)) std::cout << d << " is a subnormal number\n";
203207
}
204208
{
205209
dd d(0.0);

0 commit comments

Comments
 (0)