Skip to content

Commit dd72aa3

Browse files
committed
Condition _Float16 usage in C on FLT16_MAX.
1 parent ebb9db4 commit dd72aa3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stdlib/public/runtime/SwiftDtoa.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
#include <stdio.h>
7373
#include <stdlib.h>
7474
#include <string.h>
75+
#define __STDC_WANT_IEC_60559_TYPES_EXT__
76+
#include <float.h>
7577

7678
#include "swift/Runtime/SwiftDtoa.h"
7779

@@ -343,10 +345,12 @@ static size_t nan_details(char *dest, size_t len, int negative, int quiet, uint6
343345

344346

345347
#if SWIFT_DTOA_BINARY16_SUPPORT
346-
// Format a C `float`
348+
#if defined FLT16_MAX
349+
// Format a C `_Float16`
347350
size_t swift_dtoa_optimal_binary16(_Float16 d, char *dest, size_t length) {
348351
return swift_dtoa_optimal_binary16_p(&d, dest, length);
349352
}
353+
#endif
350354

351355
// Format an IEEE 754 binary16 half-precision floating point value
352356
// into an optimal text form.

0 commit comments

Comments
 (0)