Select Git revision
testcodemul.c
-
Nayoung Kim authoredNayoung Kim authored
testcodemul.c 1.15 KiB
#include "fx_s17_14.h"
#include <stdio.h>
int main()
{
double a = 21.468, b = 17.297;
int mul1, mul2, mul3, mul4;
mul1 = fxMul_float(fromDouble(a), fromDouble(b));
mul2 = fxMul_precision(fromDouble(a), fromDouble(b));
mul3 = fxMul_fair(fromDouble(a), fromDouble(b));
mul4 = fxMul_performance(fromDouble(a), fromDouble(b));
fprintf(stdout, "================================================================================================= \n");
fprintf(stdout, "value : %.15f fxMul_float : %.15f diff : %.15f \n", 21.468 * 17.297, toDouble(mul1), (21.468 * 17.297) - toDouble(mul1));
fprintf(stdout, "value : %.15f fxMul_precision : %.15f diff : %.15f \n", 21.468 * 17.297, toDouble(mul2), (21.468 * 17.297) - toDouble(mul2));
fprintf(stdout, "value : %.15f fxMul_fair : %.15f diff : %.15f \n", 21.468 * 17.297, toDouble(mul3), (21.468 * 17.297) - toDouble(mul3));
fprintf(stdout, "value : %.15f fxMul_performance : %.15f diff : %.15f \n", 21.468 * 17.297, toDouble(mul4), (21.468 * 17.297) - toDouble(mul4));
fprintf(stdout, "================================================================================================= \n");
return 0;
}