authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-26 16:30:15-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-02-26 16:30:15-05:00
log8dd0b4e1f12bc9f70ff6c312b35563595fdb4476
tree05022203182824c64c65cb5d64bbde5b04eb7743
parent0ac1934ad64716adeb98620003a0b905fb5cfda6

add passing test for floating point edge case


1 files changed, 15 insertions(+), 0 deletions(-)

test/cases/math.zig+15
......@@ -201,3 +201,18 @@ fn smallIntAddition() {
201201
202202 assert(result == 0);
203203}
204
205fn testFloatEquality() {
206 @setFnTest(this);
207
208 const x: f64 = 0.012;
209 const y: f64 = x + 1.0;
210
211 testFloatEqualityImpl(x, y);
212 comptime testFloatEqualityImpl(x, y);
213}
214
215fn testFloatEqualityImpl(x: f64, y: f64) {
216 const y2 = x + 1.0;
217 assert(y == y2);
218}