---
title: v?logb
description: "矢量计算输入x的指数值，以浮点形式返回。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0082.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0082.html
indexId: 855317d025fd9738c0166c0c9391ff0cdf6f18603e153210c79802067150418861
---
# v?logb

矢量计算输入x的指数值，以浮点形式返回。

#### 接口定义

C interface：

void vslogb(const int len, const float* src, float* dst);

void vdlogb(const int len, const double* src, double* dst);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| len | 整型数 | 表示输入向量的元素个数。 len≤0时会提示参数len无效并返回。 | 输入 |
| src | 在vslogb中是单精度浮点类型。 在vdlogb中是双精度浮点类型。 | 输入向量src，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输入 |
| dst | 在vslogb中是单精度浮点类型。 在vdlogb中是双精度浮点类型。 | 输出dst，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输出 |


#### 输出结果

- 每一个运算值返回其浮点指数值y，对于vslogb，y ∈ [-149,127]；对于vdlogb，y ∈ [-1074,1023]。
- 其他特殊值参考如下说明。| 输入值（src） | 输出值（dst） |
| --- | --- |
| ±inf | +inf |
| ±0 | \-inf |
| nan | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：

```
#define N 4
    const float src[N] = {73.2f, 8.0f, +INFINITY, +0.0f};
    float dst[N] = {0};

    vslogb(N, src, dst);
    printFArr("input1:", N, src);
    printFArr("output:", N, dst);

    /** 
     *  input1:  73.200    8.000      inf    0.000
     *  output:   6.000    3.000      inf     -inf 
     * 
     */
```
