mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 22:03:11 -07:00
Revert Rational default base to 64 and uncomment code to convert to/from strings in intrat/fracrat, to resolve rounding errors.
This commit is contained in:
parent
43bd7bb16e
commit
9c6ef250d0
2 changed files with 15 additions and 15 deletions
|
@ -75,15 +75,15 @@ void fracrat( PRAT *pa , uint32_t radix, int32_t precision)
|
|||
{
|
||||
// Only do the intrat operation if number is nonzero.
|
||||
// and only if the bottom part is not one.
|
||||
//if ( !zernum( (*pa)->pp ) && !equnum( (*pa)->pq, num_one ) )
|
||||
//{
|
||||
// wstring ratStr = RatToString(*pa, FMT_FLOAT, radix, precision);
|
||||
// PNUMBER pnum = StringToNumber(ratStr, radix, precision);
|
||||
//
|
||||
// destroyrat( *pa );
|
||||
// *pa = numtorat( pnum, radix);
|
||||
// destroynum( pnum );
|
||||
//}
|
||||
if ( !zernum( (*pa)->pp ) && !equnum( (*pa)->pq, num_one ) )
|
||||
{
|
||||
wstring ratStr = RatToString(*pa, FMT_FLOAT, radix, precision);
|
||||
PNUMBER pnum = StringToNumber(ratStr, radix, precision);
|
||||
|
||||
destroyrat( *pa );
|
||||
*pa = numtorat( pnum, radix);
|
||||
destroynum( pnum );
|
||||
}
|
||||
|
||||
remnum( &((*pa)->pp), (*pa)->pq, BASEX );
|
||||
|
||||
|
|
|
@ -291,12 +291,12 @@ void intrat( PRAT *px, uint32_t radix, int32_t precision)
|
|||
// and only if the bottom part is not one.
|
||||
if ( !zernum( (*px)->pp ) && !equnum( (*px)->pq, num_one ) )
|
||||
{
|
||||
//wstring ratStr = RatToString(*px, FMT_FLOAT, radix, precision);
|
||||
//PNUMBER pnum = StringToNumber(ratStr, radix, precision);
|
||||
//
|
||||
//destroyrat( *px );
|
||||
//*px = numtorat( pnum, radix);
|
||||
//destroynum( pnum );
|
||||
wstring ratStr = RatToString(*px, FMT_FLOAT, radix, precision);
|
||||
PNUMBER pnum = StringToNumber(ratStr, radix, precision);
|
||||
|
||||
destroyrat( *px );
|
||||
*px = numtorat( pnum, radix);
|
||||
destroynum( pnum );
|
||||
|
||||
PRAT pret = nullptr;
|
||||
DUPRAT(pret,*px);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue