Skip to content
Snippets Groups Projects
Select Git revision
  • f86d73ceb320796a320498f15c48c6306a1f3eae
  • main default protected
2 results

test.c

Blame
  • test.c 2.07 KiB
    #include "fx_s17_14.h"
    #include <stdio.h>
    
    int main()
    {
    	double a,b;
    
    	fscanf(stdin, "%lf %lf", &a, &b);
    	
    	fprintf(stdout, "\n");
    	
    	fprintf(stdout, "fxAdd_float : a + b = %.15lf \n", toDouble(fxAdd_float(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxSub_float : a - b = %.15lf \n", toDouble(fxSub_float(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxMul_float : a * b = %.15lf \n", toDouble(fxMul_float(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxDiv_float : a / b = %.15lf \n", toDouble(fxDiv_float(fromDouble(a), fromDouble(b))));
    	
    	fprintf(stdout, "------------------------------------------- \n");
    	fprintf(stdout, "fxAdd_precision : a + b = %.15lf \n", toFloat(fxAdd_precision(fromFloat(a), fromFloat(b))));
    	fprintf(stdout, "fxSub_precision : a - b = %.15lf \n", toFloat(fxSub_precision(fromFloat(a), fromFloat(b))));
    	fprintf(stdout, "fxMul_precision : a * b = %.15lf \n", toDouble(fxMul_precision(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxDiv_precision : a / b = %.15lf \n", toDouble(fxDiv_precision(fromDouble(a), fromDouble(b))));
    	
    	fprintf(stdout, "------------------------------------------- \n");
    	fprintf(stdout, "fxAdd_fair : a + b = %.15lf \n", toDouble(fxAdd_fair(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxSub_fair : a - b = %.15lf \n", toDouble(fxSub_fair(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxMul_fair : a * b = %.15lf \n", toDouble(fxMul_fair(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxDiv_fair : a / b = %.15lf \n", toDouble(fxDiv_fair(fromDouble(a), fromDouble(b))));
    	
    	fprintf(stdout, "------------------------------------------- \n");
    	fprintf(stdout, "fxAdd_performance : a + b = %.15lf \n", toDouble(fxAdd_performance(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxSub_performance : a - b = %.15lf \n", toDouble(fxSub_performance(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxMul_performance : a * b = %.15lf \n", toDouble(fxMul_performance(fromDouble(a), fromDouble(b))));
    	fprintf(stdout, "fxDiv_performance : a / b = %.15lf \n", toDouble(fxDiv_performance(fromDouble(a), fromDouble(b))));
    		
    	return 0;
    }