diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-07 21:11:46 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-12 21:26:35 -0400 |
commit | 74da141e618ef99959d509cb2e7be35a348a39db (patch) | |
tree | 88ebc38b381a1021fc2d74864a71e230ae591c3d /gl/floor.c | |
parent | c63a4f726a0b6ad8cf6040f947754a81fd4683bb (diff) | |
download | monitoring-plugins-74da141e618ef99959d509cb2e7be35a348a39db.tar.gz |
Sync with the latest Gnulib code (177f525)
Signed-off-by: Thomas Guyot-Sionnest <dermoth@aei.ca>
Diffstat (limited to 'gl/floor.c')
-rw-r--r-- | gl/floor.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* Round towards negative infinity. | 1 | /* Round towards negative infinity. |
2 | Copyright (C) 2007 Free Software Foundation, Inc. | 2 | Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software: you can redistribute it and/or modify | 4 | This program is free software: you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -67,27 +67,27 @@ FUNC (DOUBLE x) | |||
67 | { | 67 | { |
68 | /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */ | 68 | /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */ |
69 | if (z < TWO_MANT_DIG) | 69 | if (z < TWO_MANT_DIG) |
70 | { | 70 | { |
71 | /* Round to the next integer (nearest or up or down, doesn't matter). */ | 71 | /* Round to the next integer (nearest or up or down, doesn't matter). */ |
72 | z += TWO_MANT_DIG; | 72 | z += TWO_MANT_DIG; |
73 | z -= TWO_MANT_DIG; | 73 | z -= TWO_MANT_DIG; |
74 | /* Enforce rounding down. */ | 74 | /* Enforce rounding down. */ |
75 | if (z > y) | 75 | if (z > y) |
76 | z -= L_(1.0); | 76 | z -= L_(1.0); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | else if (z < L_(0.0)) | 79 | else if (z < L_(0.0)) |
80 | { | 80 | { |
81 | /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */ | 81 | /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */ |
82 | if (z > - TWO_MANT_DIG) | 82 | if (z > - TWO_MANT_DIG) |
83 | { | 83 | { |
84 | /* Round to the next integer (nearest or up or down, doesn't matter). */ | 84 | /* Round to the next integer (nearest or up or down, doesn't matter). */ |
85 | z -= TWO_MANT_DIG; | 85 | z -= TWO_MANT_DIG; |
86 | z += TWO_MANT_DIG; | 86 | z += TWO_MANT_DIG; |
87 | /* Enforce rounding down. */ | 87 | /* Enforce rounding down. */ |
88 | if (z > y) | 88 | if (z > y) |
89 | z -= L_(1.0); | 89 | z -= L_(1.0); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | return z; | 92 | return z; |
93 | } | 93 | } |