void
safe_add(volatile double interval[2], volatile double a, volatile double b)
{

	unsigned int orig;

	orig = fegetround();
	fesetround(FE_DOWNWARD);	
	interval[0] = a + b;
	fesetround(FE_UPWARD);		
	interval[1] = a + b;
	fesetround(orig);
}

int
main()
{
	const double nums[][2] = {
		{1, 2},
		{0.1, 0.2},
		{1e100, 1e-100},
		{1e308, 1e308},
	};
	double ival[2];
	int i;

	for (i = 0; i < sizeof(nums) / sizeof(nums[0]); i++) {
		
		safe_add(ival, nums[i][0], nums[i][1]);

		
		printf(, nums[i][0], nums[i][1]);
		printf(, ival[0], ival[1]);
		printf(, ival[1] - ival[0]);
	}
	return 0;
}