Prev Next Index-> contents reference index search external Up-> f2cad library dint f2cad-> license Install get_started prototype library run.cpp utility add2lib.sh whats_new library-> d9knus d9lgmc daxpy dbesks dbskes dcsevl ddot dgamlm dgamma dgefa dgesl dint dscal idamax initds xerror dint-> dint.f Headings-> Prototype Fortran Source Description

dint

Prototype
`doublereal f2cad::dint_(doublereal *x);`

Fortran Source
dint.f

Description
This converts from a `doublereal` to an `integer` by rounding toward zero. ``` # include <f2cad/dint.hpp> test_result dint(void) { bool ok = true; // independent variables integer n = 2; // number of independent variables doublereal x[2]; // vector of independent variables x[0] = 4.5; // value of independent variables x[1] = -3.5; f2cad::Independent(n, x); // declare x as independent variable vector // dependent variables integer m = n; // number of dependent variables doublereal f[2]; // vector of dependent variables integer i; for(i = 0; i < m; i++) f[i] = f2cad::dint_(x+i); f2cad::Dependent(m, f); // declare f as dependent variable vector // check function value ok &= (f2cad::Value(f[0]) == 4.); ok &= (f2cad::Value(f[1]) == -3.); // Compute derivative of f w.r.t x using f2cad common interface. // This general interface works with adolc, cppad, and fadbad. // See GetStarted for package specific more efficient code. for(i = 0; i < m; i++) { double p = f2cad::Partial<doublereal>(i, i); ok &= f2cad::near_equal(p, 0., 1e-10, 1e-10); } if( ok ) return test_pass; return test_fail; } ```
Input File: example/dint.cpp