• is std::trunc() ever going to work?

    From janezz55@21:1/5 to All on Sat Oct 22 02:11:20 2022
    I tried to use std::trunc(), but it doesn't work and browsing through header files revealed gcc does not trust the math.h header file DJGPP provides and so does not declare it. trunc(), truncf(), truncl() work as expected though.

    the error is:

    error: 'trunc' is not a member of 'std'; did you mean 'trunc'? /usr/i586-pc-msdosdjgpp/include/math.h:195:15: note: 'trunc' declared here
    195 | extern double trunc(double);

    apparently the macro __CORRECT_ISO_CPP11_MATH_H_PROTO_FP is not defined. Defining it explicitly produces errors related to isnan().

    Documentation about the macro says: Define if all C++11 floating point overloads are available in <math.h>.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From jwt27@21:1/5 to All on Wed Nov 23 21:24:11 2022
    On 2022-10-22 11:11, janezz55 wrote:
    I tried to use std::trunc(), but it doesn't work and browsing through header files revealed gcc does not trust the math.h header file DJGPP provides and so does not declare it. trunc(), truncf(), truncl() work as expected though.

    the error is:

    error: 'trunc' is not a member of 'std'; did you mean 'trunc'? /usr/i586-pc-msdosdjgpp/include/math.h:195:15: note: 'trunc' declared here
    195 | extern double trunc(double);

    apparently the macro __CORRECT_ISO_CPP11_MATH_H_PROTO_FP is not defined. Defining it explicitly produces errors related to isnan().

    Documentation about the macro says: Define if all C++11 floating point overloads are available in <math.h>.

    For some reason this message never showed up in my mailbox, I only just
    see it now on NNTP.

    The issue is that djgpp does not implement all C99 math functions, so
    libstdc++ just disables all of them. You can of course use ::trunc()
    from libc or __builtin_trunc() (with f/l suffix where appropriate).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From janezz55@21:1/5 to All on Wed Nov 23 18:05:28 2022
    The issue is that djgpp does not implement all C99 math functions, so libstdc++ just disables all of them. You can of course use ::trunc()
    from libc or __builtin_trunc() (with f/l suffix where appropriate).

    I know the workaround already. Hopefully someone will write a patch for this quirk.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)