delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2022/11/24/23:34:26

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: jwt27 <dont AT spam DOT me>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: is std::trunc() ever going to work?
Date: Wed, 23 Nov 2022 21:24:11 +0100
Organization: Aioe.org NNTP Server
Message-ID: <tllvhb$akf$1@gioia.aioe.org>
References: <80d78acb-55c9-4bd0-9198-2c3705e9489en AT googlegroups DOT com>
Mime-Version: 1.0
Injection-Info: gioia.aioe.org; logging-data="10895"; posting-host="wDhOh390r9/gMGzpPOjpGQ.user.gioia.aioe.org"; mail-complaints-to="abuse AT aioe DOT org";
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
X-Notice: Filtered by postfilter v. 0.9.2
Bytes: 1975
Lines: 19
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019