Changeset 739


Ignore:
Timestamp:
May 30, 2017 4:48:32 AM (4 months ago)
Author:
kulshres
Message:

add implementation of frexp() with badouble

this may or may not work.

Signed-off-by: Kshitij Kulshreshtha <kshitij@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ADOL-C/src/adouble.cpp

    r676 r739  
    18091809adub ldexp ( const badouble& x, int exp ) {
    18101810    return x*ldexp(1.0,exp);
     1811}
     1812/*--------------------------------------------------------------------------*/
     1813/* frexp Function */
     1814adub frexp ( const badouble& x, int* n) {
     1815    double v = frexp(x.value(), n);
     1816    adouble r = x - v;
     1817    adouble z = r - double(*n);
     1818    if (z == 0) {
     1819        return (x - double(*n));
     1820    } else {
     1821        fprintf(stderr,"ADOL-C warning: std::frexp() returned inconsistent results\n");
     1822        return (r - double(*n));
     1823    }
    18111824}
    18121825
Note: See TracChangeset for help on using the changeset viewer.