mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-23 10:30:49 +00:00
Eggert tuneups
SCCS-file: difftime.c SCCS-SID: 7.6
This commit is contained in:
committed by
Paul Eggert
parent
2143f48eda
commit
7ffbb96c5e
@ -43,9 +43,7 @@ const time_t time0;
|
||||
/*
|
||||
** Repair delta overflow.
|
||||
*/
|
||||
hibit = 1;
|
||||
while ((hibit <<= 1) > 0)
|
||||
continue;
|
||||
hibit = (~ (time_t) 0) << (TYPE_BIT(time_t) - 1);
|
||||
/*
|
||||
** The following expression rounds twice, which means
|
||||
** the result may not be the closest to the true answer.
|
||||
@ -65,10 +63,10 @@ const time_t time0;
|
||||
** This problem occurs only with very large differences.
|
||||
** It's too painful to fix this portably.
|
||||
** We are not alone in this problem;
|
||||
** many C compilers round twice when converting
|
||||
** some C compilers round twice when converting
|
||||
** large unsigned types to small floating types,
|
||||
** so if time_t is unsigned the "return delta" above
|
||||
** has the same double-rounding problem.
|
||||
** has the same double-rounding problem with those compilers.
|
||||
*/
|
||||
return delta - 2 * (long_double) hibit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user