MCPcopy Create free account
hub / github.com/Singular/Singular / toString

Method toString

Singular/svd_si.h:1458–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456 }
1457 template<unsigned int Precision>
1458 char * ampf<Precision>::toString() const
1459 {
1460 char *toString_Block=(char *)omAlloc(256);
1461 //
1462 // some special cases
1463 //
1464 if( !isFiniteNumber() )
1465 {
1466 mp_exp_t _e;
1467 char *ptr;
1468 ptr = mpfr_get_str(NULL, &_e, 10, 0, getReadPtr(), GMP_RNDN);
1469 strcpy(toString_Block, ptr);
1470 mpfr_free_str(ptr);
1471 return toString_Block;
1472 }
1473
1474 //
1475 // general case
1476 //
1477
1478 char buf_e[128];
1479 signed long iexpval;
1480 mp_exp_t expval;
1481 char *ptr;
1482 char *ptr2;
1483 ptr = mpfr_get_str(NULL, &expval, 10, 0, getReadPtr(), GMP_RNDN);
1484 ptr2 = ptr;
1485 iexpval = expval;
1486 if( iexpval!=expval )
1487 //throw internalError();
1488 WerrorS("internalError");
1489 sprintf(buf_e, "%ld", long(iexpval));
1490 if( *ptr=='-' )
1491 {
1492 ptr++;
1493 sprintf(toString_Block,"-0.%sE%s",ptr,buf_e);
1494 }
1495 else
1496 sprintf(toString_Block,"0.%sE%s",ptr,buf_e);
1497 mpfr_free_str(ptr2);
1498 return toString_Block;
1499 }
1500
1501 template<unsigned int Precision>
1502 const ampf<Precision> ampf<Precision>::getUlpOf(const ampf<Precision> &x)

Callers 1

testsvdFunction · 0.45

Calls 1

WerrorSFunction · 0.85

Tested by

no test coverage detected