# __fp_btoh() — Convert from IEEE floating-point to hexadecimal floating-point

## Standards

Standards / Extensions | C or C++ | Dependencies |
---|---|---|

Both | OS/390® V2R6 |

## Syntax

```
#include <_Ieee754.h>
int __fp_btoh(void *src_ptr, int src_type,
void *trg_ptr, int trg_type,
int rmode);
```

## General description

The __fp_btoh() function
converts data in IEEE floating-point format, pointed to by src_ptr,
to hexadecimal floating-point format, and stores the hexadecimal floating-point
value at the location pointed to by trg_ptr. src_ptr and trg_ptr point
to C floating-point variables of type float, double, or long double
as indicated by src_type and trg_type.
Valid values for src_type and trg_type are
_FP_FLOAT, _FP_DOUBLE, and _FP_LONG_DOUBLE. rmode specifies
rounding mode for inexact mappings. Valid values are:

**Value****Description**- _FP_BH_NR
- No rounding
- _FP_BH_RZ
- Rounding toward zero
- _FP_BH_BRN
- Biased round to nearest
- _FP_BH_RN
- Round to nearest
- _FP_BH_RP
- Round toward +infinity
- _FP_BH_RM
- Round toward -infinity

## Return values

If invalid src_type, trg_type,
or rmode is specified, __fp_btoh() returns
-1. Otherwise, it returns the following values:

- 0
- Zero (IEEE floating-point +zero or -zero value mapped to hexadecimal floating-point +zero or -zero value, respectively).
- 1
- Underflow (IEEE floating-point value is too small to map to hexadecimal floating-point). In this case *trg_ptr is set to the hexadecimal floating-point value corresponding to the smallest convertible IEEE floating-point value.
- 2
- Success (with rounding performed as indicated by rmode).
- 3
- Overflow (IEEE floating-point value is too large to map to hexadecimal floating-point). In this case *trg_ptr is set to the hexadecimal floating-point value corresponding to the largest convertible IEEE floating-point value.