On 2013-07-10 13:17, Ian Abbott wrote:
On 2013-07-10 13:03, Ian Abbott wrote:
On 2013-07-08 22:19, Alan Barrett wrote:
Perhaps this will work without either a compiler warning or potential loss of precision:
seconds = tdays * SECSPERDAY + (time_t)0.5;
For the record, that works fine in clang with no all warnings on, and
That should be "no warnings on".
I mean "all warnings on" dammit!
the assembler output contains no floating point conversions even with optimization turned off. With optimization off, the generated code is also slightly smaller than my version that retained the 'half_second' variable with its initial value cast to type 'type_t'.
-- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-