@@ -233,6 +233,10 @@ TEST(TestWithinUlp, Double) {
233233 CheckWithinUlp (1.0 , 1.0000000000000007 , 3 );
234234 CheckNotWithinUlp (1.0 , 1.0000000000000007 , 2 );
235235 CheckNotWithinUlp (1.0 , 1.0000000000000007 , 1 );
236+ // left and right have a different exponent but are still very close
237+ CheckWithinUlp (1.0 , 0.9999999999999999 , 1 );
238+ CheckWithinUlp (1.0 , 0.9999999999999988 , 11 );
239+ CheckNotWithinUlp (1.0 , 0.9999999999999988 , 10 );
236240
237241 CheckWithinUlp (123.4567 , 123.45670000000015 , 11 );
238242 CheckNotWithinUlp (123.4567 , 123.45670000000015 , 10 );
@@ -253,6 +257,10 @@ TEST(TestWithinUlp, Float) {
253257 CheckWithinUlp (1 .0f , 1 .0000001f , 1 );
254258 CheckWithinUlp (1 .0f , 1 .0000013f , 11 );
255259 CheckNotWithinUlp (1 .0f , 1 .0000013f , 10 );
260+ // left and right have a different exponent but are still very close
261+ CheckWithinUlp (1 .0f , 0 .99999994f , 1 );
262+ CheckWithinUlp (1 .0f , 0 .99999934f , 11 );
263+ CheckNotWithinUlp (1 .0f , 0 .99999934f , 10 );
256264
257265 CheckWithinUlp (123 .456f , 123 .456085f , 11 );
258266 CheckNotWithinUlp (123 .456f , 123 .456085f , 10 );
0 commit comments