evaluate an expression using hardware floating-point
expression to be evaluated numerically
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=float8, double, or complex8; 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; see evalhf/fcnlist) or to user-defined functions in Maple. There are restrictions on user-defined functions to be properly evaluated within the evalhf environment. For details, see evalhf/procedure.
The evalhf function converts all its arguments to hardware floats, computes the answer and converts the result to a Maple software float value. 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=float8, datatype=double, or datatype=complex8, no conversion to Maple floats takes place. Using hfarrays or rtables with datatype=float8, double, or complex8, 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.
The evalhf[hfloat] function is identical to evalhf, except that the returned result is not converted to a software floating-point value. Such a returned value can be used in further expressions, where, depending on the setting of UseHardwareFloats, computation will be carried out using the hardware floating-point environment.
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.
A ≔ Matrix⁡3,2,i,j→i+j⁢I,datatype=complex8
f := proc(n) if n<2 then n else (n+1)*f(n-1)/n end if end proc:
g := proc(x) x^5*ln(x)/(1+x^2) end proc:
solutions ≔ solve⁡x3=−3
Digits ≔ trunc⁡evalhf⁡Digits
s1 ≔ evalhf⁡sin⁡1
s2 ≔ evalhfhfloat⁡sin⁡2
The hfloat option was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
Numerical Programming in Maple
Download Help Document