| 3194 | } |
| 3195 | |
| 3196 | PyObject * |
| 3197 | Dragon4_Scientific(PyObject *obj, DigitMode digit_mode, int precision, |
| 3198 | int min_digits, int sign, TrimMode trim, int pad_left, |
| 3199 | int exp_digits) |
| 3200 | { |
| 3201 | npy_double val; |
| 3202 | Dragon4_Options opt; |
| 3203 | |
| 3204 | opt.scientific = 1; |
| 3205 | opt.digit_mode = digit_mode; |
| 3206 | opt.cutoff_mode = CutoffMode_TotalLength; |
| 3207 | opt.precision = precision; |
| 3208 | opt.min_digits = min_digits; |
| 3209 | opt.sign = sign; |
| 3210 | opt.trim_mode = trim; |
| 3211 | opt.digits_left = pad_left; |
| 3212 | opt.digits_right = -1; |
| 3213 | opt.exp_digits = exp_digits; |
| 3214 | |
| 3215 | if (PyArray_IsScalar(obj, Half)) { |
| 3216 | npy_half x = PyArrayScalar_VAL(obj, Half); |
| 3217 | return Dragon4_Scientific_Half_opt(&x, &opt); |
| 3218 | } |
| 3219 | else if (PyArray_IsScalar(obj, Float)) { |
| 3220 | npy_float x = PyArrayScalar_VAL(obj, Float); |
| 3221 | return Dragon4_Scientific_Float_opt(&x, &opt); |
| 3222 | } |
| 3223 | else if (PyArray_IsScalar(obj, Double)) { |
| 3224 | npy_double x = PyArrayScalar_VAL(obj, Double); |
| 3225 | return Dragon4_Scientific_Double_opt(&x, &opt); |
| 3226 | } |
| 3227 | else if (PyArray_IsScalar(obj, LongDouble)) { |
| 3228 | npy_longdouble x = PyArrayScalar_VAL(obj, LongDouble); |
| 3229 | return Dragon4_Scientific_LongDouble_opt(&x, &opt); |
| 3230 | } |
| 3231 | |
| 3232 | val = PyFloat_AsDouble(obj); |
| 3233 | if (PyErr_Occurred()) { |
| 3234 | return NULL; |
| 3235 | } |
| 3236 | return Dragon4_Scientific_Double_opt(&val, &opt); |
| 3237 | } |
| 3238 | |
| 3239 | #undef DEBUG_ASSERT |
no outgoing calls
no test coverage detected