[liba] Add aeabi long conversion

This commit is contained in:
Émilie Feral
2017-08-31 15:17:22 +02:00
parent b9ec1b5383
commit 925f404382
11 changed files with 431 additions and 51 deletions

18
liba/test/long.c Normal file
View File

@@ -0,0 +1,18 @@
#include <quiz.h>
#include <stdint.h>
#include <assert.h>
void assert_int64t_approximatively_equals_int64t(int64_t i, int64_t j) {
assert(i-j < 1000000);
assert(j-i < 1000000);
}
QUIZ_CASE(long_arithmetic) {
int64_t i = 123456789101112;
assert((float)i == 1.23456789101112e14f);
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);
}