Harbour Math Functions

Abs

ACos

ASin

ATan

ATn2

Cos

CosH

DToR

Exp

Exponent 

Fact

Floor

GetPrec

hb_mathErBlock
hb_mathErMode
hb_mathGetErrMode
hb_mathGetHandler
hb_mathGetLastError
hb_mathIsMathErr
hb_mathResetError
hb_mathSetErrMode
hb_mathSetHandler

Infinity
Int
Log

Log10
Max

Mantissa
Min
Mod

Pi
Round

RToD

SetPrec

Sign

Sin

SinH
Sqrt

Tan

TanH

Advertisements

hb_MemoRead()

HB_MEMOREAD()

Return the text file’s contents as a character string

Syntax

      HB_MEMOREAD( <cFileName> ) --> cString

Arguments

<cFileName> is the filename to read from disk. It must include the file extension. If file to be read lives in another directory, you must include the path.

Returns

Returns the contents of a text file as a character string.

If <cFileName> cannot be found or read HB_MEMOREAD returns an empty string (“”).

Description

HB_MEMOREAD() is a function that reads the content of a text file (till now) from disk (floppy, HD, CD-ROM, etc.) into a memory string. In that way you can manipulate as any character string or assigned to a memo field to be saved in a database.

HB_MEMOREAD() function is used together with MEMOEDIT() and HB_MEMOWRIT() to get from disk text from several sources that would be edited, searched, replaced, displayed, etc.

It is used to import data from other sources to our database.

Note: HB_MEMOREAD() does not use the settings SET DEFAULT or SET PATH to search for <cFileName>. It searches for <cFileName> in the current directory. If the file is not found, then HB_MEMOREAD() searches in the DOS path.

Over a network, HB_MEMOREAD() attempts to open <cFileName> in read-only mode and shared. If the file is used in mode exclusive by another process, the function will returns a null string (“”).

HB_MEMOREAD() vs MEMOREAD(): HB_MEMOREAD() is identical to MEMOREAD() except it won’t truncate the last byte (on non-UNIX compatible systems) if it’s a EOF char.

Examples

      *  This example uses HB_MEMOREAD() to assign the contents of a text
      *  file to a character variable for later search

         cFile   := "account.prg"
         cString := HB_MEMOREAD( cFile )
         cCopyright := "Melina"

         IF At( "Melina", cString ) == 0               // check for copyright
            HB_MEMOWRIT( cFile, cCopyright + cString ) // if not, add it!
         ENDIF

Compliance

Clipper

Platforms

All (64K)

Files

Library is rtl

Seealso

MEMOEDIT(), HB_MEMOWRIT(), REPLACE, MEMOREAD()

HardCR()

HARDCR()

Replace all soft carriage returns with hard carriages returns.

Syntax

      HARDCR( <cString> ) --> <cConvertedString>

Arguments

<cString> is a string of chars to convert.

Returns

<cConvertedString> Transformed string.

Description

Returns a string/memo with soft carriage return chars converted to hard carriage return chars.

Examples

      ? HARDCR( Data->CNOTES )

Tests

      @ 1, 1 SAY HARDCR( Data->CNOTES )
      will display converted string starting on row two, column two of the
      current device.

Compliance

Clipper

Files

Library is rtl

Seealso

MEMOTRAN(), STRTRAN()

Sqrt()

Sqrt()

Calculates the square root of a number.

Syntax

      Sqrt( <nNumber> ) --> <nSqrt>

Arguments

<nNumber> Any numeric value.

Returns

<nSqrt> The square root of <number>.

Description

This function returns the square root of <nNumber>. The precision of this evaluation is based solely on the settings of the SET DECIMAL TO command. Any negative number passed as <nNumber> will always return a 0.

Examples

      SET DECIMAL TO 5
      ? Sqrt( 632512.62541 )
      ? Sqrt( 845414111.91440 )

Compliance

Clipper

Platforms

All

Files

Library is core

Seealso

Round()

Round()

ROUND()

Rounds off a numeric expression.

Syntax

      ROUND( <nNumber>,<nPlace> ) --> <nResult>

Arguments

<nNumber> Any numeric value.

<nPlace> The number of places to round to.

Returns

<nResult> The rounded number.

Description

This function rounds off the value of <nNumber> to the number of decimal places specified by <nPlace>. If the value of <nPlace> is a negative number, the function will attempt to round <nNumber> in whole numbers. Numbers from 5 through 9 will be rounded up, all others will be rounded down.

Examples

      ? ROUND( 632512.62541, 5 )
      ? ROUND( 845414111.91440, 3 )

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

INT(), STR(), VAL(), SET FIXED

Mod()

MOD()

Return the modulus of two numbers.

Syntax

      MOD( <nNumber>, <nNumber1> ) -->  <nRemainder>

Arguments

<nNumber> Numerator in a divisional expression.

<nNumber1> Denominator in a divisional expression.

Returns

<nRemainder> The remainder after the division operation.

Description

This functuion returns the remainder of one number divided by another.

Examples

      ? Mod( 12, 8.521 )
      ? Mod( 12, 0 )
      ? Mod( 62412.5142, 4522114.12014 )

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

%

Min()

MIN()

Determines the minumum of two numbers or dates.

Syntax

      MIN( <xValue>, <xValue1> )  --> <xMin>

Arguments

<xValue> Any date or numeric value.

<xValue1> Any date or numeric value.

Returns

<xMin> The smaller numeric (or earlier date) value.

Description

This function returns the smaller of the two passed espressions. <xValue> and <xValue1> must be the same data type. If numeric, the smaller number is returned. If dates, the earlier date is returned.

Examples

      ? MIN( 214514214, 6251242142 )
      ? MIN( STOD( "20001111" ), STOD( "20140621" ) )

Compliance

Clipper

Platforms

All

Files

Library is rtl

Seealso

MAX()