Math library compatibility modes, Matherr() – Comtrol eCos User Manual

Page 356

Advertising
background image

Chapter 13. C and math library overview

CYG_LIBC_TIME_DSTON

on

void

cyg_libc_time_setzoneoffsets

(

time_t stdoffset, time_t dstoffset

);

This function sets the offsets from UTC used when Daylight Savings Time is enabled or disabled. The offsets are
in time_t’s, which are seconds in the current inplementation.

Cyg_libc_time_dst cyg_libc_time_getzoneoffsets

(

time_t *stdoffset, time_t *dstoffset

);

This function retrieves the current setting for Daylight Savings Time along with the offsets used for both STD and
DST. The offsets are both in time_t’s, which are seconds in the current implementation.

cyg_bool cyg_libc_time_settime

(

time_t utctime

);

This function sets the current time for the system The time is specified as a time_t in UTC. It returns non-zero on
error.

Math library compatibility modes

This math library is capable of being operated in several different compatibility modes. These options deal solely
with how errors are handled.

There are 4 compatibility modes: ANSI/POSIX 1003.1; IEEE-754; X/Open Portability Guide issue 3 (XPG3); and
System V Interface Definition Edition 3.

In IEEE mode, the

matherr()

function (see below) is never called, no warning messages are printed on the stderr

output stream, and errno is never set.

In ANSI/POSIX mode, errno is set correctly, but

matherr()

is never called and no warning messages are printed

on the stderr output stream.

In X/Open mode, errno is set correctly,

matherr()

is called, but no warning messages are printed on the stderr

output stream.

In SVID mode, functions which overflow return a value HUGE (defined in

math.h

), which is the maximum single

precision floating point value (as opposed to HUGE_VAL which is meant to stand for infinity). errno is set correctly
and

matherr()

is called. If

matherr()

returns 0, warning messages are printed on the stderr output stream for

some errors.

The mode can be compiled-in as IEEE-only, or any one of the above methods settable at run-time.

Note: This math library assumes that the hardware (or software floating point emulation) supports IEEE-754
style arithmetic, 32-bit 2’s complement integer arithmetic, doubles are in 64-bit IEEE-754 format.

252

Advertising