🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.sys.palmtops.pilot
Article #198

Mathlib functions always returning 0

#198
From: Luc M.
Date: Tue, 21 Oct 2003 02:27
28 lines
2198 bytes
I get '0' from a mathlib functions when I try to pass a parameter.
The functions return the proper value if the parameter is checked before
calling the function.

Assuming 'index' is equal to 2, why does the function 'sqrt(index)' return 0
in the following code:

   Int32 index;
   double c;

   index = StrAToI(FldGetTextPtr(fldInput));     /* field set so that index
is 2 */
   c = sqrt(index);                                              /* Returns
0 ? */


But it returns the proper value in the following code:

    index = StrAToI(FldGetTextPtr(fldInput));   /* field set so that index
is 2 */
    if(index == 2)
    {
      c = sqrt(index);                                          /* Returns
proper value !!! */
    }


Any help is greatly appreciated.
Technical Details
Message-ID: <7Q0lb.2265$aw5.156000@news20.bellglobal.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!snoopy.risq.qc.ca!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10baa0,9fa37096d9ae1ba3,start
X-Google-Attributes: gid10baa0,public
X-Google-Thread: 11219a,9fa37096d9ae1ba3,start
X-Google-Attributes: gid11219a,public
X-Google-Thread: 109e18,9fa37096d9ae1ba3,start
X-Google-Attributes: gid109e18,public
X-Google-Thread: 112073,9fa37096d9ae1ba3,start
X-Google-Attributes: gid112073,public
X-Google-ArrivalTime: 2003-10-20 19:42:33 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!snoopy.risq.qc.ca!news.uunet.ca!nf3.bellglobal.com!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail
From: "Luc M." <luc_martineau@hotmail.com>
Newsgroups: alt.comp.sys.palmtops.pilot,comp.sys.palmtops,comp.sys.palmtops.pilot,codewarrior.palm
Subject: Mathlib functions always returning 0 
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2720.3000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300
Message-ID: <7Q0lb.2265$aw5.156000@news20.bellglobal.com>
Date: Mon, 20 Oct 2003 22:27:22 -0400
NNTP-Posting-Host: 216.209.117.44
X-Complaints-To: abuse@sympatico.ca
X-Trace: news20.bellglobal.com 1066703235 216.209.117.44 (Mon, 20 Oct 2003 22:27:15 EDT)
NNTP-Posting-Date: Mon, 20 Oct 2003 22:27:15 EDT
Organization: Bell Sympatico