Patrice,
This is the test code I used for the math functions.
James
// *********************************************************************
// Created with bc9Basic - BASIC To C/C++ Translator (V) 9.2.6.0 (2017/02/05)
// The bc9Basic translator (bc9.exe) was compiled with
// g++ (tdm64-1) 5.1.0
// ----------------------------------------------------------------------
// BCX (c) 1999 - 2009 by Kevin Diggins
// *********************************************************************
// Translated for compiling with the
// Microsoft (R) C/C++ Optimizing Compiler
// On MS Windows
// Using TCLib by Fred Harris
// *********************************************************************
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#define _X(y) y
#include <windows.h>
#define x64
#include "TCLib\stdio.h"
#include "TCLib\string.h"
#include "TCLib\stdlib.h"
#include "TCLib\memory.h"
#include "TCLib\malloc.h"
#include "TCLib\math.h"
#include "TCLib\tchar.h"
#include "TCLib\Strings.cpp"
typedef String fstring;
FILE* stdin;
FILE* stdout;
FILE* stderr;
//<---UNICODE AWARE
#define SFMT (const char*)"%s\r\n"
//>---UNICODE AWARE
// NO HEADERS START
#ifndef _WINDOWS_
//<---UNICODE AWARE
typedef _TCHAR *PCHAR, *LPCH, *PCH, *NPSTR, *LPSTR, *PSTR;
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
typedef unsigned int UINT;
//>---UNICODE AWARE
#endif
// NO HEADERS END
// ***************************************************
// Compiler Defines
// ***************************************************
// C++
#if defined( __cplusplus )
#define overloaded
#define C_EXPORT EXTERN_C __declspec(dllexport)
#define C_IMPORT EXTERN_C __declspec(dllimport)
#define BEGIN_EXTERN_C extern _T("C") {
#define END_EXTERN_C }
#else
#define C_EXPORT __declspec(dllexport)
#define C_IMPORT __declspec(dllimport)
#endif
// Microsoft VC++
#ifndef DECLSPEC_UUID
#if (_MSC_VER >= 1100) && defined ( __cplusplus )
#define DECLSPEC_UUID(x) __declspec(uuid(x))
#else
#define DECLSPEC_UUID(x)
#endif
#endif
// ***************************************************
// Compiler Defines
// ***************************************************
#ifndef __cplusplus
#error A C++ compiler is required
#endif
// *************************************************
// User's GLOBAL ENUM blocks
// *************************************************
// *************************************************
// System Defined Constants
// *************************************************
typedef const _TCHAR* ccptr;
#define CCPTR const _TCHAR*
#define cfree free
//<---UNICODE AWARE
typedef char _char;
#define _strlen strlen
//>---UNICODE AWARE
#define EQU ==
#define NOT_USED(x) if(x);
#define CTLHNDL(id) GetDlgItem(hWnd,id)
#define cSizeOfDefaultString 2048
// *************************************************
// User Defined Constants
// *************************************************
#define PI 3.141592653589753
#define TR 57.2957795130831
// *************************************************
// Standard Prototypes
// *************************************************
_TCHAR* BCX_TmpStr(size_t, size_t = 0, int = 1);
void Pause (void);
// *************************************************
// System Variables
// *************************************************
#define LDOUBLE long double
// *************************************************
// User Defined Types, Unions and Classes
// *************************************************
// *************************************************
// User Global Variables
// *************************************************
// *************************************************
// User Prototypes
// *************************************************
int _tmain (void);
// *************************************************
// User Global Initialized Arrays
// *************************************************
// *************************************************
// Runtime Functions
// *************************************************
#ifndef BCXTmpStrSize
#define BCXTmpStrSize 2048
#endif
_TCHAR *BCX_TmpStr (size_t Bites, size_t iPad, int iAlloc)
{
static int StrCnt;
static _TCHAR *StrFunc[BCXTmpStrSize];
StrCnt = (StrCnt + 1) & (BCXTmpStrSize - 1);
if(StrFunc[StrCnt]) {
free (StrFunc[StrCnt]);
StrFunc[StrCnt] = NULL;
}
#if defined BCX_MAX_VAR_SIZE
if(Bites * sizeof(_TCHAR) > BCX_MAX_VAR_SIZE)
{
_tprintf(_T("Buffer Overflow caught in BCX_TmpStr - requested space of %d EXCEEDS %d\n"), (int)(Bites * sizeof(_TCHAR)), BCX_MAX_VAR_SIZE);
abort();
}
#endif
if(iAlloc) StrFunc[StrCnt] = (_TCHAR*)calloc(Bites + iPad + 1, sizeof(_TCHAR));
return StrFunc[StrCnt];
}
void Pause(void)
{
_tprintf(_T("\n%ls\n"), _T("Press any key to continue..."));
_getwch();
}
// *************************************************
// User Subs, Functions and Class Methods
// *************************************************
int _tmain ()
{
LDOUBLE ld = {0};
double d1 = {0};
float f1 = {0};
int I = {0};
ld = sin( 45 / TR);
_tprintf(_T("%.19LG\n"), (LDOUBLE)ld);
I = sin( 45 / TR);
d1 = sin( 45 / TR);
f1 = sin( 45 / TR);
_tprintf(_T("%d\n"), (int)I);
_tprintf(_T("%.15G\n"), (double)d1);
_tprintf(_T("%.7G\n"), (float)f1);
ld = cos( 45 / TR);
_tprintf(_T("%.19LG\n"), (LDOUBLE)ld);
ld = acos( 45 / TR);
d1 = sqrt( 144);
_tprintf(_T("%.15G\n"), (double)d1);
I = time( NULL);
_tprintf(_T("%ls%d\n"), _T("I = "), (int)I);
_tprintf(_T("%ls\n"), _T("Hello There"));
I = rand();
_tprintf(_T("%ls%d\n"), _T("I = "), (int)I);
srand((DWORD)time(NULL));
d1 = fmod( 5.3, 2);
_tprintf(_T("%ls%.15G\n"), _T("d1 = "), (double)d1);
f1 = fmodf( 5.3, 2);
_tprintf(_T("%ls%.7G\n"), _T("f1 = "), (float)f1);
Pause();
}