immutable class FLTD < $REAL_NUMBER{FLTD}, $HASH, $FMT |
---|
**** | IEEE 754-1984 "double" format 64-bit floating point. |
$FMT | $HASH | $IS_EQ | $REAL_NUMBER{_} | $NUMBER{_} | $NFE{_} | $STR | $NIL | $IS_NIL | $IS_LT{_} | $FLT |
const digits:INT:=15; |
---|
**** | The number of decimal digits of precision. |
const epsilon:SAME:=2.2204460492503131e-16d; |
---|
**** | The minimum x>0.0 such that 1.0+x/=x. |
const mantissa_bits:INT:=53; |
---|
**** | The number of bits in the significand, including an implied bit. |
const max_exp10:INT:=308; |
---|
**** | The maximum x such that 10^x is within range. |
const max_exp:INT:=1024; |
---|
**** | The maximum allowable exponent. |
const min_exp10:INT:=-307; |
---|
**** | The minimum x such that 10^x is in the range of normalized floating point numbers. |
const min_exp:INT:=-1021; |
---|
**** | The minimum negative integer x such that b^(x-1) is in the range of normalized floating point numbers. |
const one: FLTD := 1.0d; |
---|
**** |
const zero:SAME := 0.0d; |
---|
**** | See $NUMBER. |
abs:SAME |
---|
**** | The absolute value of self. |
acos:SAME |
---|
**** | The arc sine of self in the range [0.0, pi] Trigonometric functions handle exceptional arguments in the spirit of IEEE 754-1985. So:
____+-infinity.sin,_+-infinity.cos,_+-infinity.tan_return_NaN ____x.asin_and_x.acos_with_x.abs>1_return_NaN sinpi etc. are similar except they compute self.sinpi=(self*pi).sin avoiding range-reduction issues because their definition permits range reduction that is fast and exact for all self. The corresponding inverse functions compute asinpi(x). |
acosh:SAME |
---|
**** | The inverse hyperbolic cosine of self. Hyperbolic functions handle exceptional arguments in the spirit of IEEE 754-1985. So: sinh and cosh return +-infinity on overflow acosh returns a NaN if its argument is less than 1.0 atanh returns a NaN if its argument has an absolute value >1.0 |
acospi:SAME |
---|
**** | (1/pi) times the arc cosine of self. Result in the range [0, 1] See comment for `acos'. |
asin:SAME |
---|
**** | The arc sine of self in the range [-pi/2, pi/2] See comment for `acos'. |
asinh:SAME |
---|
**** | The inverse hyperbolic sine of self. See comment at `acosh'. |
asinpi:SAME |
---|
**** | (1/pi) times the arc sine of self. Result in the range [-1/2, 1/2] See comment for `acos'. |
at_least(arg:SAME):SAME |
---|
**** | Same as `self.max(arg)' |
at_most(arg:SAME):SAME |
---|
**** | Same as `self.min(arg)' |
atan2(f:SAME):SAME |
---|
**** | The arc tangent of self divided by f in the range [-pi, pi]. It chooses the quadrant specified by (self, arg). See comment for `acos'. |
atan2pi(f:SAME):SAME |
---|
**** | (1/pi) times the arc tangent of self divided by f. Result in the range [-1, 1]. It chooses the quadrant specified by (self, arg). See comment for `acos'. |
atan:SAME |
---|
**** | The arc tangent of self in the range [-pi/2, pi/2]. See comment for `acos'. |
atanh:SAME |
---|
**** | The inverse hyperbolic tangent of self. See comment at `acosh'. |
atanpi:SAME |
---|
**** | (1/pi) times the arc tangent of self. Result in the range [-1/2, 1/2] See comment for `acos'. |
bessel_j0:SAME |
---|
**** | Bessel functions of the first and second kinds. y0, y1 and yn have logarithmic singularities at the origin, so they treat zero and negative arguments the way log does. |
bessel_j1:SAME |
---|
**** | See comment at `bessel_j0'. |
bessel_jn(n:INT):SAME |
---|
**** | See comment at `bessel_j0'. |
bessel_y0:SAME |
---|
**** | See comment at `bessel_j0'. |
bessel_y1:SAME |
---|
**** | See comment at `bessel_j0'. |
bessel_yn(n:INT):SAME |
---|
**** | See comment at `bessel_j0'. |
ceiling:SAME |
---|
**** | The smallest integer not less than self. |
copysign(y:SAME):SAME |
---|
**** | return self with the sign bit set to the same as y's sign bit. |
cos:SAME |
---|
**** | See comment for `acos'. |
cosh:SAME |
---|
**** | The hyperbolic cosine of self. See comment at `acosh'. |
cospi:SAME |
---|
**** | See comment for `acos'. |
create(f:FLT):SAME |
---|
create(f:FLTD):SAME |
---|
**** |
____create(f:FLTX):SAME_is_return_f.fltd_end; ____create(f:FLTDX):SAME_is_return_f.fltd_end; ____create(f:FLTI):SAME_is_return_f.fltd_end; |
create(f:INT):SAME |
---|
create(f:INTI):SAME |
---|
create (s: STR): SAME |
---|
cube:SAME |
---|
**** | The cube of self. |
cube_root:SAME |
---|
**** | The cube root of self. |
div(f:SAME):SAME |
---|
**** | The quotient of self and `f'. Built-in. |
double_inv_pi:SAME |
---|
**** | Approximation of 2/pi. Built-in. |
double_sqrt_pi:SAME |
---|
**** | Approximation of 2*(pi.sqrt). Built-in. |
e:SAME |
---|
**** | An approximation of the base of the natural logarithms "e". Built-in. |
erf:SAME |
---|
**** | error function:
___x.erf_=_(1/sqrt(pi))*integrate(0,x,exp(-t^2)dt) |
exp10:SAME |
---|
**** | 10^self. Built-in. See comment at `exp'. |
exp2:SAME |
---|
**** | 2^self See comment at `exp'. |
exp:SAME |
---|
**** | The exponential e^self.
Exponential, logarithm, power functions functions handle exceptional arguments in the spirit of IEEE 754-1985. So:
____0.log_is_-infinity_with_a_division_by_zero_exception ____For_x<0,_including_-infinity,_x.log_is_a_quiet_NaN_with_an ____invalid_op_exception ____For_x=+infinity_or_a_quiet_NaN,_x.log_is_x_without_exception ____For_a_signaling_NaN,_x.log_is_a_quiet_NaN_with_an_invalid_op_exception ____1.log_is_zero_without_exception For any other positive x, x.log is a normalized number with an inexact exception. |
exp_minus_one:SAME |
---|
**** | e^self-1.0, accurate even for tiny self. See comment at `exp'. |
floor:SAME |
---|
**** | The largest integer not greater than self. |
flt:FLT |
---|
**** | A floating point version of self. It is an error if the value cannot be held in a FLT. Built-in. |
fltd:FLTD |
---|
**** | Convert to FLTD. Identity operation. |
fmt( f: STR ): STR |
---|
**** | Convert into a nice ascii string. See the separate document for FMT for the details. |
gamma:SAME |
---|
**** | gamma function. |
get_representation(out sign: BOOL,out exp: INT,out mlo: INT,out mhi: INT) |
---|
**** | Gets the internal representation as sequence of INTs. |
half_pi:SAME |
---|
**** | Approximation of pi/2. Built-in. |
hash:INT |
---|
**** | A lousy hash function, can someone suggest better? |
hypot(arg:SAME):SAME |
---|
**** | sqrt(self*self+arg*arg), taking precautions against unwarranted IEEE exceptions. +-infinity.hypot(arg) is +infinity for any arg, even a NaN, and is exceptional only for a signaling NaN. |
infinity:SAME |
---|
**** | IEEE Infinity. |
int:INT |
---|
**** | INT version of self. It is an error if self is not integral. Use truncate, floor, ceiling, or round to achieve this. Built-in. |
integral:BOOL |
---|
**** | Same as `is_integral' |
inti:INTI |
---|
**** | Convert to INTI. |
inv_pi:SAME |
---|
**** | Approximation of 1/pi. Built-in. |
inv_sqrt_2:SAME |
---|
**** | Approximation of 1/(2.sqrt). Built-in. |
is_bet(l,u:SAME):BOOL |
---|
**** | Another name for `is_between'. |
is_between(l,u:SAME):BOOL |
---|
**** | True if self between l and u. |
is_eq(b:SAME):BOOL |
---|
**** | True if self and `b' have the same value |
is_finite:BOOL |
---|
**** | returns true if zero, subnormal or normal. |
is_inf:BOOL |
---|
**** | returns true if infinite |
is_integral:BOOL |
---|
**** | Return true if self is integral. |
is_lt(f:SAME):BOOL |
---|
**** | True if self is less than `f'. Built-in. |
is_nan:BOOL |
---|
**** | returns true if NaN. See somment at "is_nil". |
is_nil:BOOL |
---|
**** | True is self is a NaN. |
is_normal:BOOL |
---|
**** | returns true if normal |
is_subnormal:BOOL |
---|
**** | returns true if subnormal |
is_within(tolerance,val:SAME):BOOL |
---|
**** | True if self close to (within absolute tolerance of) val. |
is_zero:BOOL |
---|
**** | returns true is zero |
log10:SAME |
---|
**** | The logarithm base ten of self. See comment at `exp'. |
log10_e:SAME |
---|
**** | Approximation of e.log10. Built-in. |
log2:SAME |
---|
**** | The logarithm base two of self. See comment at `exp'. |
log2_e:SAME |
---|
**** | Approximation of e.log2. Built-in. |
log:SAME |
---|
**** | The natural logarithm of self. See comment at `exp'. |
log_10:SAME |
---|
**** | Approximation of 10.log. Built-in. |
log_2:SAME |
---|
**** | Approximation of 2.log. Built-in. |
log_gamma:SAME |
---|
**** | log gamma function. x.ln_gamma=x.gamma.abs.log |
max(arg:SAME):SAME |
---|
**** | The larger of self and arg. Caution: may not behave as expected if one argument is a NaN. |
max_normal:SAME |
---|
**** | The largest normal positive number. |
max_subnormal:SAME |
---|
**** | The largest subnormal positive number. |
maxval:SAME |
---|
**** | Maximal value; see $NUMBER. |
min(arg:SAME):SAME |
---|
**** | The smaller of self and arg. Caution: may not behave as expected if one argument is a NaN. |
min_normal:SAME |
---|
**** | The smallest normal positive number. |
min_subnormal:SAME |
---|
**** | The smallest subnormal positive number. |
minus(f:SAME):SAME |
---|
**** | The difference between self and `f'. Built-in. |
minval:SAME |
---|
**** | Minimal value; see $NUMBER. |
mod(y:FLTD):FLTD |
---|
**** | See the comment at FLT::remainder |
negate:SAME |
---|
**** | The negation of self. Same as zero minus self, except for IEEE rounding modes and the sign bit. |
nextdown:FLTD |
---|
**** | return previous representable number from self. |
nextup:FLTD |
---|
**** | return next representable number from self. |
nil:SAME |
---|
**** | See $NIL for use of `nil'. nil for FLTD is a signalling NaN. |
one_minus_erf:SAME |
---|
**** | 1.0-self.erf, but computed in a way to avoid cancellation for large self. |
pi:SAME |
---|
**** | An approximation of the mathematical value "pi". Built-in. |
plus(f:SAME):SAME |
---|
**** | The sum of self and `f'. Built-in. |
plus_one_log:SAME |
---|
**** | (self+1).log, accurate even for tiny self. See comment at `exp'. |
pow(arg:SAME):SAME |
---|
**** | self raised to the arg'th power. x.pow(0.0)=1.0 for all x. See comment at `exp'. |
quarter_pi:SAME |
---|
**** | Approximation of pi/4. Built-in. |
quiet_NaN(sig:INT):SAME |
---|
**** | IEEE quiet NaN. `sig' is the significand (presently unused). |
remainder(y:FLTD):FLTD |
---|
**** |
__x.remainder(y)_and_x.mod(y)_return_a_remainder_of_x_with_respect __to_y;_that_is,_the_result_r_is_one_of_the_numbers_that_differ_from __x_by_an_integral_multiple_of_y.__Thus_(x-r)/y__is_an_integral __value,_even_though_it_might_exceed_INT::maxint_if_it_were __explicitly_computed_as_an_INT.__Both_functions_return_one__of_the __two_such_r_smallest_in_magnitude.__remainder(x,y)_is_the_operation __specified_in_ANSI/IEEE_Std_754-1985;_the_result_of_x.mod(y)_may __differ_from_remainder's_result_by_+-y.__The_magnitude_of __remainder's_result_can_not_exceed_half_that_of_y;_its_sign_might __not_agree_with_either_x_or_y.__The_magnitude_of_mod's_result_is __less_than_that_of_y;_its_sign_agrees_with_that_of_x.__Neither __function_will_raise_an_exception_as_long_as_both_arguments_are __normal_or_subnormal.__x.remainder(0),_x.mod(0),_oo.remainder(y), __and_oo.mod(y)_are_invalid_operations_that_produce_a_NaN. |
round:SAME |
---|
**** | The closest integer to self. Built-in. |
scale_by(n:INT):FLTD |
---|
**** | return x*2.pow(n) computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication. 1 <= x.abs.scale_by(-x.unbiased_exponent) < 2 for every x except 0, infinity, and NaN. |
sign:SAME |
---|
**** | Returns -1.0d, 0.0d or 1.0d depending on sign of self. |
signaling_NaN(sig:INT):SAME |
---|
**** | IEEE signalling NaN. `sig' is the significand (presently unused). |
signbit_set:BOOL |
---|
**** | returns true if sign bit of self is set |
signum:SAME |
---|
**** | Another name for `sign'. |
sin:SAME |
---|
**** | +-infinity.sin, +-infinity.cos, +-infinity.tan return NaN x.asin and x.acos with x.abs>1 return NaN sinpi etc. are similar except they compute self.sinpi=(self*pi).sin avoiding range-reduction issues because their definition permits range reduction that is fast and exact for all self. The corresponding inverse functions compute asinpi(x). |
sincos(out sin: SAME,out cos: SAME) |
---|
**** | Simultaneous computation of self.sin and self.cos. This is faster than independently computing them. See comment for `acos'. |
sincospi(out s,out c:SAME) |
---|
**** | Simultaneous computation of self.sinpi and self.cospi. This is faster than independently computing them. See comment for `acos'. |
sinh:SAME |
---|
**** | The hyperbolic sine of self. See comment at `acosh'. |
sinpi:SAME |
---|
**** | See comment for `acos'. |
sqrt:SAME |
---|
**** | The square root of self. |
sqrt_2:SAME |
---|
**** | Approximation of 2.sqrt. Built-in. |
square:SAME |
---|
**** | The square of self. |
str(prec:INT):STR |
---|
**** | A string version of self with "prec" digits of precision. |
str:STR |
---|
**** | A string version of self. changed to make the class reentrant. Same thing happens in FLT. Other str methods do the same thing. if ((void(fdbuf)) or (fdbuf.size < 30)) then fdbuf := #FSTR(30) end; |
str_in(arg:FSTR):FSTR |
---|
**** | Return an FSTR representation of self using the space in arg if possible |
str_in(arg:FSTR, |
---|
**** | Return FSTR version of self with precicsion of "prec" using the space in arg if possible. |
tan:SAME |
---|
**** | See comment for `acos'. |
tanh:SAME |
---|
**** | The hyperbolic tangent of self. See comment at `acosh'. |
tanpi:SAME |
---|
**** | See comment for `acos'. |
times(f:SAME):SAME |
---|
**** | The signed product of self and `f'. Built-in. |
truncate:SAME |
---|
**** | The nearest integer toward zero. Built-in. |
unbiased_exponent:INT |
---|
**** | return unbiased exponent of self as an INT; for zero this is INT::maxint.negate, for an infinite it is INT::maxint. If subnormal, normalization occurs first. |
product!(i:SAME):SAME |
---|
**** | Yields the product of all previous values of `i'. |
sum!(i:SAME):SAME |
---|
**** | Yields the sum of all previous values of `i'. |
store_into(s:FSTR):INT |
---|
**** | Store the acsii representation into s. Built-in. |
store_into_prec(p:INT,s:FSTR):INT |
---|
**** | Store the acsii representation into s with precision p. Built-in. |