mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
19 lines
580 B
C
19 lines
580 B
C
#include <quiz.h>
|
|
#include <stdint.h>
|
|
#include <assert.h>
|
|
|
|
void assert_int64t_approximatively_equals_int64t(int64_t i, int64_t j) {
|
|
quiz_assert(i-j < 1000000);
|
|
quiz_assert(j-i < 1000000);
|
|
}
|
|
|
|
QUIZ_CASE(long_arithmetic) {
|
|
int64_t i = 123456789101112;
|
|
quiz_assert((float)i == 1.23456789101112e14f);
|
|
quiz_assert((double)i == 1.23456789101112e14);
|
|
float f = 123456789101112.12345f;
|
|
assert_int64t_approximatively_equals_int64t((int64_t)f, 123456789101112);
|
|
double d = 123456789101112.12345f;
|
|
assert_int64t_approximatively_equals_int64t((int64_t)d, 123456789101112);
|
|
}
|