Deleted Added
sdiff udiff text old ( 9888:68d6b600d51f ) new ( 9899:0392ef94d766 )
full compact
1/*
2 * Copyright (c) 2013, Andreas Sandberg
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 21 unchanged lines hidden (view full) ---

30#include <fputils/fp80.h>
31
32#include "test_helper.h"
33
34#include <math.h>
35#include <stdio.h>
36#include <stdlib.h>
37
38/* We provide our own version of isinf_sgn since the C99 standard
39 * doesn't guarantee that isinf() returns the sign of the infinity
40 * (most implementations do). */
41static inline int
42isinf_sgn(double x)
43{
44 return isinf(x) ? (signbit(x) ? -1 : 1) : 0;
45}
46
47static void
48test_fp80_cvtd_class(const char *name, fp80_t fin, int class)
49{
50 double d = fp80_cvtd(fin);
51 if (fpclassify(d) != class) {
52 test_diag("wrong class");
53 test_fail(name);
54 } else {
55 test_ok(name);
56 }
57}
58
59static void
60test_fp80_cvtd_inf(const char *name, fp80_t fin, int expected_inf_class)
61{
62 double d = fp80_cvtd(fin);
63 if (isinf_sgn(d) != expected_inf_class) {
64 test_diag("wrong infinity type");
65 test_fail(name);
66 } else {
67 test_ok(name);
68 }
69}
70
71int

--- 13 unchanged lines hidden ---