@@ -1313,7 +1313,7 @@ func TestQuantityAsApproximateFloat64(t *testing.T) {
1313
1313
{decQuantity (7 * 1024 * 1024 , 1 , BinarySI ), (7 * 1024 * 1024 ) * 10 },
1314
1314
{decQuantity (7 * 1024 * 1024 , 4 , BinarySI ), (7 * 1024 * 1024 ) * 10000 },
1315
1315
{decQuantity (7 * 1024 * 1024 , 8 , BinarySI ), (7 * 1024 * 1024 ) * 100000000 },
1316
- {decQuantity (7 * 1024 * 1024 , - 1 , BinarySI ), (7 * 1024 * 1024 ) * math . Pow10 ( - 1 )}, // '* Pow10' and '/ float (10)' do not round the same way
1316
+ {decQuantity (7 * 1024 * 1024 , - 1 , BinarySI ), (7 * 1024 * 1024 ) / float64 (10 )},
1317
1317
{decQuantity (7 * 1024 * 1024 , - 8 , BinarySI ), (7 * 1024 * 1024 ) / float64 (100000000 )},
1318
1318
1319
1319
{decQuantity (1024 , 0 , DecimalSI ), 1024 },
@@ -1322,7 +1322,7 @@ func TestQuantityAsApproximateFloat64(t *testing.T) {
1322
1322
{decQuantity (7 * 1024 * 1024 , 1 , DecimalSI ), (7 * 1024 * 1024 ) * 10 },
1323
1323
{decQuantity (7 * 1024 * 1024 , 4 , DecimalSI ), (7 * 1024 * 1024 ) * 10000 },
1324
1324
{decQuantity (7 * 1024 * 1024 , 8 , DecimalSI ), (7 * 1024 * 1024 ) * 100000000 },
1325
- {decQuantity (7 * 1024 * 1024 , - 1 , DecimalSI ), (7 * 1024 * 1024 ) * math . Pow10 ( - 1 )}, // '* Pow10' and '/ float (10)' do not round the same way
1325
+ {decQuantity (7 * 1024 * 1024 , - 1 , DecimalSI ), (7 * 1024 * 1024 ) / float64 (10 )},
1326
1326
{decQuantity (7 * 1024 * 1024 , - 8 , DecimalSI ), (7 * 1024 * 1024 ) / float64 (100000000 )},
1327
1327
1328
1328
{decQuantity (1024 , 0 , DecimalExponent ), 1024 },
@@ -1331,7 +1331,7 @@ func TestQuantityAsApproximateFloat64(t *testing.T) {
1331
1331
{decQuantity (7 * 1024 * 1024 , 1 , DecimalExponent ), (7 * 1024 * 1024 ) * 10 },
1332
1332
{decQuantity (7 * 1024 * 1024 , 4 , DecimalExponent ), (7 * 1024 * 1024 ) * 10000 },
1333
1333
{decQuantity (7 * 1024 * 1024 , 8 , DecimalExponent ), (7 * 1024 * 1024 ) * 100000000 },
1334
- {decQuantity (7 * 1024 * 1024 , - 1 , DecimalExponent ), (7 * 1024 * 1024 ) * math . Pow10 ( - 1 )}, // '* Pow10' and '/ float (10)' do not round the same way
1334
+ {decQuantity (7 * 1024 * 1024 , - 1 , DecimalExponent ), (7 * 1024 * 1024 ) / float64 (10 )},
1335
1335
{decQuantity (7 * 1024 * 1024 , - 8 , DecimalExponent ), (7 * 1024 * 1024 ) / float64 (100000000 )},
1336
1336
1337
1337
// very large numbers
@@ -1344,11 +1344,11 @@ func TestQuantityAsApproximateFloat64(t *testing.T) {
1344
1344
{decQuantity (- 12 , 500 , DecimalSI ), math .Inf (- 1 )},
1345
1345
}
1346
1346
1347
- for _ , item := range table {
1347
+ for i , item := range table {
1348
1348
t .Run (fmt .Sprintf ("%s %s" , item .in .Format , item .in .String ()), func (t * testing.T ) {
1349
1349
out := item .in .AsApproximateFloat64 ()
1350
1350
if out != item .out {
1351
- t .Fatalf ("expected %v, got %v" , item .out , out )
1351
+ t .Fatalf ("test %d expected %v, got %v" , i + 1 , item .out , out )
1352
1352
}
1353
1353
if item .in .d .Dec != nil {
1354
1354
if i , ok := item .in .AsInt64 (); ok {
0 commit comments