Discussion:
XL C++ and the missing trunc()
(too old to reply)
Baguley, Nicholas: Absa
2017-08-02 13:00:23 UTC
Permalink
Raw Message
Hi List

I am trying to compile some code

16761 | #define _ISOC99_SOURCE
16762 | #include "math.h"
16763 | ..dNewValue = trunc(dValue*dDigits) / dDigits;

Getting error:


============================================¬
"/u/abnb529/cpf/source/XMM021D.C", line 16763.29: CCN5274 (S) The name lookup for "trunc" did not find a declaration.
16764 |


Running 15650ZOS V2.2 z/OS XL C++

Version Macros. . . . . . . . : __COMPILER_VER__=0x42020000
: __LIBREL__=0x42020000
: __TARGET_LIB__=0x42020000

Could anyone shed some light?
TIA

Nick Baguley


:LANGLVL(ANONSTRUCT,ANONUNION,ANSIFOR,ANSISINIT,AUTOTYPEDEDUCTION,CHECKPLACEMENTNEW,C1XNORETURN,
COMPLEXINIT,C99VLA,C99__FUNC__,C99LONGLONG,C99PREPROCESSOR,NOCOMPATRVALUEBINDING,CONSTEXPR,NODBCS,
DECLTYPE,DEFAULTANDDELETE,DELEGATINGCTORS,NODEPENDENTBASELOOKUP,NODOLLARINNAMES,EMPTYSTRUCT,
EXPLICITCONVERSIONOPERATORS,EXTENDEDFRIEND,NOEXTENDEDINTEGERSAFE,EXTERNTEMPLATE,ILLPTOM,
IMPLICITINT,INLINENAMESPACE,LIBEXT,NOLONGLONG,NONEWEXCP,OFFSETNONPOD,NOOLDDIGRAPH,NOOLDFRIEND,
NOOLDMATH,NOOLDSTR,OLDTEMPACC,NOOLDTMPLALIGN,OLDTMPLSPEC,NOREDEFMAC,RIGHTANGLEBRACKET,
REFERENCECOLLAPSING,RVALUEREFERENCES,SCOPEDENUM,STATIC_ASSERT,NOTEMPSASLOCALS,NOTEXTAFTERENDIF,
GNU_LABELVALUE,GNU_COMPUTEDGOTO,TRAILENUM,TYPEDEFCLASS,NOUCS,UNIFORMINIT,VARARGMACROS,
VARIADICTEMPLATES,NULLPTR,GNU_INCLUDE_NEXT,ZEROEXTARRAY,NOC99COMPLEX,NOC99COMPLEXHEADER,
NOGNU_COMPLEX,GNU_SUFFIXIJ)



Important Notice:
Absa is an Authorised Financial Services Provider and Registered Credit Provider,
registration number: NCRCP7. This e-mail and any files transmitted with it may
contain information that is confidential, privileged or otherwise protected from
disclosure. If you are not an intended recipient of this e-mail, do not duplicate
or redistribute it by any means. Please delete it and any attachments and notify
the sender that you have received it in error. Unless specifically indicated, this
e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities,
investment products or other financial product or service, an official confirmation of
any transaction, or an official statement of Absa. Any views or opinions presented
are solely those of the author and do not necessarily represent those of Absa.
This e-mail is subject to terms available at the following link:
http://www.absa.co.za/disclaimer.
The Disclaimer forms part of the content of this email. If you are unable to access
the Disclaimer, send a blank e-mail to ***@absa.co.za and we will send you a
copy of the Disclaimer. By messaging with Absa you consent to the foregoing.
By emailing Absa you consent to the terms herein. This email may relate to or be sent
from other members of the Absa Group.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
John McKown
2017-08-02 13:17:19 UTC
Permalink
Raw Message
On Wed, Aug 2, 2017 at 8:01 AM, Baguley, Nicholas: Absa <
Post by Baguley, Nicholas: Absa
Hi List
I am trying to compile some code
16761 | #define _ISOC99_SOURCE
16762 | #include "math.h"
16763 | ..dNewValue = trunc(dValue*dDigits) / dDigits;
============================================¬
"/u/abnb529/cpf/source/XMM021D.C", line 16763.29: CCN5274 (S) The name
lookup for "trunc" did not find a declaration.
16764 |
Running 15650ZOS V2.2 z/OS XL C++
Version Macros. . . . . . . . : __COMPILER_VER__=0x42020000
: __LIBREL__=0x42020000
: __TARGET_LIB__=0x42020000
Could anyone shed some light?
TIA
Nick Baguley
​Looking at page:
https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/trun.htm

The code seems to be:


*C++ TR1 C99*

#define _TR1_C99
#include <math.h>

float trunc(float x);

long double trunc(long double x);​
--
Veni, Vidi, VISA: I came, I saw, I did a little shopping.

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2017-08-02 13:32:20 UTC
Permalink
Raw Message
Not sure that it matters but the doc specifies

#include <math.h>

Are you possibly getting the wrong math.h?

You could also try

#define _TR1_C99
#include <math.h>

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On
Behalf Of Baguley, Nicholas: Absa
Sent: Wednesday, August 2, 2017 6:01 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: XL C++ and the missing trunc()

Hi List

I am trying to compile some code

16761 | #define _ISOC99_SOURCE
16762 | #include "math.h"
16763 | ..dNewValue = trunc(dValue*dDigits) / dDigits;

Getting error:


============================================¬
"/u/abnb529/cpf/source/XMM021D.C", line 16763.29: CCN5274 (S) The name
lookup for "trunc" did not find a declaration.
16764 |


Running 15650ZOS V2.2 z/OS XL C++

Version Macros. . . . . . . . : __COMPILER_VER__=0x42020000
: __LIBREL__=0x42020000
: __TARGET_LIB__=0x42020000

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Loading...