| 568 | } |
| 569 | |
| 570 | char *floatToStr( const gmp_float & r, const unsigned int oprec ) |
| 571 | { |
| 572 | #if 1 |
| 573 | mp_exp_t exponent; |
| 574 | int size,insize; |
| 575 | char *nout,*out,*in; |
| 576 | |
| 577 | insize= (oprec+2) * sizeof(char) + 10; |
| 578 | in= (char*)omAlloc( insize ); |
| 579 | |
| 580 | mpf_get_str(in,&exponent,10,oprec,*(r.mpfp())); |
| 581 | |
| 582 | //if ( (exponent > 0) |
| 583 | //&& (exponent < (int)oprec) |
| 584 | //&& (strlen(in)-(in[0]=='-'?1:0) == oprec) ) |
| 585 | //{ |
| 586 | // omFree( (void *) in ); |
| 587 | // insize= (exponent+oprec+2) * sizeof(char) + 10; |
| 588 | // in= (char*)omAlloc( insize ); |
| 589 | // int newprec= exponent+oprec; |
| 590 | // mpf_get_str(in,&exponent,10,newprec,*(r.mpfp())); |
| 591 | //} |
| 592 | nout= nicifyFloatStr( in, exponent, oprec, &size, SIGN_EMPTY ); |
| 593 | omFree( (void *) in ); |
| 594 | out= (char*)omAlloc( (strlen(nout)+1) * sizeof(char) ); |
| 595 | strcpy( out, nout ); |
| 596 | omFree( (void *) nout ); |
| 597 | |
| 598 | return out; |
| 599 | #else |
| 600 | // for testing purpose... |
| 601 | char *out= (char*)omAlloc( (1024) * sizeof(char) ); |
| 602 | sprintf(out,"% .10f",(double)r); |
| 603 | return out; |
| 604 | #endif |
| 605 | } |
| 606 | //<- |
| 607 | |
| 608 | //-> gmp_complex::* |
no test coverage detected