zoukankan      html  css  js  c++  java
  • nanl (Numerics) – C 中文开发手册

    [
  •   C 语言中文开发手册

    nanl (Numerics) - C 中文开发手册

    在头文件<math.h>中定义
    float nanf( const char* arg ); (since C99)
    double nan( const char* arg ); (since C99)
    long double nanl( const char* arg ); (since C99)

    实现定义字符串转换arg成相应的静态NaN值,则通过调用strtof,strtod或者strtold,分别说明如下:通话nan("string")等同于通话strtod("NAN(string)", (char**)NULL);。通话nan("")等同于通话strtod("NAN()", (char**)NULL);。通话nan(NULL)等同于通话strtod("NAN", (char**)NULL);。

    参数

    arg - 窄字符串标识NaN的内容

    返回值

    安静的NaN值与标识字符串相对应,arg或者如果实现不支持安静的NaN,则为零。

    #include <stdio.h>
    #include <math.h>
    #include <stdint.h>
    #include <inttypes.h>
    #include <string.h>
     
    int main(void)
    {
        double f1 = nan("1");
        uint64_t f1n; memcpy(&f1n, &f1, sizeof f1);
        printf("nan("1")   = %f (%" PRIx64 ")
    ", f1, f1n);
     
        double f2 = nan("2");
        uint64_t f2n; memcpy(&f2n, &f2, sizeof f2);
        printf("nan("2")   = %f (%" PRIx64 ")
    ", f2, f2n);
     
        double f3 = nan("0xF");
        uint64_t f3n; memcpy(&f3n, &f3, sizeof f3);
        printf("nan("0xF") = %f (%" PRIx64 ")
    ", f3, f3n);
    }

    可能的输出:

    nan("1")   = nan (7ff8000000000001)
    nan("2")   = nan (7ff8000000000002)
    nan("0xF") = nan (7ff800000000000f)
  •   C 语言中文开发手册
    ]
    转载请保留页面地址:https://www.breakyizhan.com/c-3/27773.html
  • 相关阅读:
    win10 UWP button
    内网分享资源
    内网分享资源
    CF724F Uniformly Branched Trees
    win10 UWP FlipView
    win10 UWP FlipView
    win10 UWP FlipView
    搭建阿里云 centos mysql tomcat jdk
    搭建阿里云 centos mysql tomcat jdk
    win10 UWP 申请微软开发者
  • 原文地址:https://www.cnblogs.com/breakyizhan/p/13295847.html
Copyright © 2011-2022 走看看