Rate This Document
Findability
Accuracy
Completeness
Readability

v?log10

Compute the element-wise base-10 logarithm of a vector.

Interface Definition

C interface:

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

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

Fortran interface:

CALL VSLOG10(LEN, SRC, DST);

CALL VDLOG10(LEN, SRC, DST);

Parameters

Parameter

Type

Description

Input/Output

len

Integer

Number of elements in the input vector.

If len ≤ 0, the system displays a message indicating that the value of len is invalid.

Input

src

  • For vslog10, src is of single-precision floating-point type.
  • For vdlog10, src is of double-precision floating-point type.

Input vector src with length len.

If the pointer is null, the system prompts a null pointer error.

Input

dst

  • For vslog10, dst is of single-precision floating-point type.
  • For vdlog10, dst is of double-precision floating-point type.

Output vector dst with length len.

If the pointer is null, the system prompts a null pointer error.

Output

Return Value

  • The logarithm y of x with 10 as the base is returned for each operation value. y ∈ (-INF, +INF).
  • If the input x is ±0, the return value is -∞.
  • If the input x is 1, the return value is 0.
  • If the input x is a negative number, the return value is NaN.
  • If the input x is +∞, the return value is +∞.
  • If the input x is NaN, the return value is NaN.

Dependencies

C: "kvml.h"

Fortran: "kvml.f03"

Examples

C interface:

    int i, len = 4; 
    float src[len] = {0.0f, 1.0f, inf, nan}; 
    float* dst = (float*)malloc(sizeof(float) * len); 
    if (dst == NULL) { 
        printf("Malloc Failed!\n"); 
        return 0; 
    } 
    vslog10(len, src, dst); 
    /** 
     *  Output dst: 
     *      -inf  0  inf  nan 
     * 
     */

Fortran interface:

    INTEGER :: LEN = 4 
    REAL(4) SRC(4)  
    REAL(4) DST(4) 
    DATA SRC /1, 2, 3, 4/ 
    CALL VSLOG10(LEN, SRC, DST) 
    !  
    ! OUTPUT DST: 
    !     0.00000000, 0.301030010, 0.477121234, 0.602060020 
    !