evalhf - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Resource Management : evalhf : evalhf

evalhf

evaluate an expression using hardware floating-point

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

evalhf(expr)

Parameters

expr

-

expression to be evaluated numerically

Description

• 

A call to evalhf evaluates an expression to a numerical value using the floating-point hardware of the underlying system. The evaluation is done in double precision.

• 

In some cases evalhf may call evalf for evaluation of some special functions with complex arguments, or with real arguments leading to complex results.

• 

The argument of evalhf must be an expression that evaluates to a single value; an hfarray or rtable with datatype=float[8], double, or complex[8]; or a procedure. As opposed to evalf, no other symbolic answers are permitted.

• 

The argument evaluated by evalhf can include function calls, either to standard functions (such as sin and arctan) or to user-defined functions in Maple (see evalhf/procedure).  Also see evalhf/procedure for all the restrictions on user functions to be properly evaluated within evalhf.

• 

The evalhf function converts all its arguments to hardware floats, computes the answer and converts the answer to a Maple float result. Hence the user never deals with hardware floating-point numbers; these are confined to evalhf.

• 

It is advantageous to do as much computation as possible within a single call to evalhf, to avoid the conversion overhead.

• 

When evalhf returns an hfarray or rtable with datatype=float[8], datatype=double, or datatype=complex[8], no conversion to Maple floats takes place until the time that elements of the array are accessed. Even then, only the accessed elements are converted. Using hfarrays or rtables with datatype=float[8], double, or complex[8], it is possible to pass data between invocations of evalhf at almost no cost.

• 

Maple includes evalhf for the purpose of gaining speed in numerical computations or for users who wish to use the hardware floating-point system.

• 

If Digits is set equal to (the integer part of) the special value evalhf(Digits) (approximately 15 on many 32-bit architectures) then evalf and evalhf (when both succeed) should produce similar results.

• 

In the evalhf environment, non-default numeric event handling settings are not guaranteed to be respected.

Thread Safety

• 

The evalhf command is thread safe as of Maple 15, provided that evaluating the given expression is itself thread safe.

• 

For more information on thread safety, see index/threadsafe.

Examples

evalhfsinⅇγ+2+lncosCatalan

0.0980197901238379354

(1)

AMatrix3,2,i,j→i+jI,datatype=complex[8]

A:=1.+1.I1.+2.I2.+1.I2.+2.I3.+1.I3.+2.I

(2)

evalhfmapsin,A

1.29845758141598+0.634963914784736I3.16577851321617+1.95960104142161I1.403119250622040.489056259041294I3.420954861117011.50930648532362I0.2177595516221521.16344036370325I0.5309210862485203.59056458998578I

(3)

f := proc(n) if n<2 then n else (n+1)*f(n-1)/n end if end proc:

evalhff100&plus;f10&plus;f1

57.

(4)

g := proc(x) x^5*ln(x)/(1+x^2) end proc:

evalhfg2

4.43614195558364965

(5)

solutionssolvex3&equals;3

solutions:=31&sol;3&comma;1231&sol;312I35&sol;6&comma;1231&sol;3&plus;12I35&sol;6

(6)

mapevalhf&comma;solutions

1.44224957030740830&comma;0.7211247851537041511.24902476648340643I&comma;0.721124785153704151&plus;1.24902476648340643I

(7)

DigitstruncevalhfDigits

Digits:=15

(8)

evalfg2

4.43614195558365

(9)

See Also

evalhf[array]

evalhf[boolean]

evalhf[constant]

evalhf[fcnlist]

evalhf[fortran]

evalhf[hfarray]

evalhf[var]

option_hfloat

rtable

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam