Skip to content

strtod128 not accept valid hexadecimal floating point string #276

@tydeman

Description

@tydeman

/* Prereq: dnf install libdfp-devel */
#define STDC_WANT_DEC_FP 1
#define STDC_WANT_IEC_60559_DFP_EXT 1
#define STDC_WANT_IEC_60559_EXT 1
#define STDC_WANT_IEC_60559_TYPES_EXT 1

#include <errno.h>
#include <limits.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <float.h>
#include <fenv.h>
#include <math.h>

#pragma STDC FENV_ACCESS ON
#pragma STDC FP_CONTRACT OFF
#pragma STDC FENV_ROUND FE_TONEAREST
#pragma STDC FENV_DEC_ROUND FE_DEC_TONEAREST
#pragma STDC CX_LIMITED_RANGE OFF

int main(void){

if(1){
_Decimal128 dfp39;
char * endptr;
dfp39 = strtod128( "+0X7.0e.,", &endptr );
assert( (0.DL != dfp39) ||
( (1806.DL/256.DL) == dfp39 ) ); /
7.0546875 */
}
return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions