|
| 1 | +//===----------------------------------------------------------------------===// |
| 2 | +// |
| 3 | +// This source file is part of the Swift.org open source project |
| 4 | +// |
| 5 | +// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors |
| 6 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 7 | +// |
| 8 | +// See https://swift.org/LICENSE.txt for license information |
| 9 | +// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 10 | +// |
| 11 | +//===----------------------------------------------------------------------===// |
| 12 | + |
| 13 | +@_exported import _Builtin_float |
| 14 | + |
| 15 | +@available(swift, deprecated: 3.0, message: "Please use 'T.radix' to get the radix of a FloatingPoint type 'T'.") |
| 16 | +public let FLT_RADIX = Double.radix |
| 17 | + |
| 18 | +%for type, prefix in [('Float', 'FLT'), ('Double', 'DBL'), ('Float80', 'LDBL')]: |
| 19 | +% if type == "Float80": |
| 20 | +#if !os(Android) && !os(WASI) && !os(Windows) && (arch(i386) || arch(x86_64)) |
| 21 | +% end |
| 22 | +// Where does the 1 come from? C counts the usually-implicit leading |
| 23 | +// significand bit, but Swift does not. Neither is really right or wrong. |
| 24 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.significandBitCount + 1'.") |
| 25 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 26 | +public let ${prefix}_MANT_DIG = ${type}.significandBitCount + 1 |
| 27 | + |
| 28 | +// Where does the 1 come from? C models floating-point numbers as having a |
| 29 | +// significand in [0.5, 1), but Swift (following IEEE 754) considers the |
| 30 | +// significand to be in [1, 2). This rationale applies to ${prefix}_MIN_EXP |
| 31 | +// as well. |
| 32 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.greatestFiniteMagnitude.exponent + 1'.") |
| 33 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 34 | +public let ${prefix}_MAX_EXP = ${type}.greatestFiniteMagnitude.exponent + 1 |
| 35 | + |
| 36 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude.exponent + 1'.") |
| 37 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 38 | +public let ${prefix}_MIN_EXP = ${type}.leastNormalMagnitude.exponent + 1 |
| 39 | + |
| 40 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.greatestFiniteMagnitude' or '.greatestFiniteMagnitude'.") |
| 41 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 42 | +public let ${prefix}_MAX = ${type}.greatestFiniteMagnitude |
| 43 | + |
| 44 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.ulpOfOne' or '.ulpOfOne'.") |
| 45 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 46 | +public let ${prefix}_EPSILON = ${type}.ulpOfOne |
| 47 | + |
| 48 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNormalMagnitude' or '.leastNormalMagnitude'.") |
| 49 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 50 | +public let ${prefix}_MIN = ${type}.leastNormalMagnitude |
| 51 | + |
| 52 | +@available(swift, deprecated: 3.0, message: "Please use '${type}.leastNonzeroMagnitude' or '.leastNonzeroMagnitude'.") |
| 53 | +@_originallyDefinedIn(module: "Darwin", SwiftStdlib 5.11) |
| 54 | +public let ${prefix}_TRUE_MIN = ${type}.leastNonzeroMagnitude |
| 55 | + |
| 56 | +% if type == "Float80": |
| 57 | +#endif |
| 58 | +% end |
| 59 | +%end |
0 commit comments