File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,16 @@ FloatingPoint.test("BinaryFloatingPoint/genericFloatingPointConversion") {
206
206
Float._convert(
207
207
from: Double._convert(from: Float.leastNonzeroMagnitude).value).value,
208
208
Float.leastNonzeroMagnitude)
209
+
210
+ // Let's make sure that the correct value is returned when two representable
211
+ // values are equally close to the original value.
212
+ let bitPattern: UInt64 = 0b01111111111_0000000000000000000000110000000000000000000000000000
213
+ var z = Double(bitPattern: bitPattern)
214
+ expectEqual(Float._convert(from: z).value, Float(z))
215
+
216
+ z = Double(Float.greatestFiniteMagnitude) +
217
+ Double(Float.greatestFiniteMagnitude.ulp / 2)
218
+ expectEqual(Float._convert(from: z).value, Float(z))
209
219
}
210
220
211
221
func positiveOne<T: ExpressibleByIntegerLiteral>() -> T {
You can’t perform that action at this time.
0 commit comments