home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sa104os2.zip / SATHR104.ZIP / SATHER / LIBRARY / FLT.SA < prev    next >
Text File  |  1995-02-05  |  19KB  |  597 lines

  1. -- Copyright (C) International Computer Science Institute, 1994.  COPYRIGHT  --
  2. -- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
  3. -- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
  4. -- the file "Doc/License" of the Sather distribution.  The license is also   --
  5. -- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
  6. --------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
  7.  
  8. value class FLT < $IS_EQ{FLT}, $IS_LT{FLT}, $NIL{FLT} is
  9.    -- IEEE 754-1984 "single" format 32-bit floating point.
  10.    -- Most of these functions presently just call the FLTD versions
  11.    -- because of C double/float weirdness.
  12.  
  13.    create(f:FLT):SAME is return f; end;
  14.  
  15.    plus(f:SAME):SAME is -- The sum of self and `f'. Built-in.
  16.       raise "FLT::plus(SAME):SAME undefined.";
  17.    end;
  18.  
  19.    minus(f:SAME):SAME is -- The difference between self and `f'. Built-in.     
  20.       raise "FLT::minus(SAME):SAME undefined.";
  21.    end;   
  22.    
  23.    negate:SAME is -- The negation of self. Same as zero minus self,
  24.       -- except that IEEE does funny things for the sign bit and
  25.       -- different rounding modes.
  26.       raise "FLT::negate:SAME undefined.";
  27.    end;
  28.  
  29.    times(f:SAME):SAME is -- The signed product of self and `f'. Built-in.
  30.       raise "FLT::times(SAME):SAME undefined.";
  31.    end;   
  32.    
  33.    div(f:SAME):SAME is -- The quotient of self and `f'. Built-in.
  34.       raise "FLT::div(SAME):SAME undefined.";
  35.    end;   
  36.    
  37.    is_eq(f:SAME):BOOL is -- True if self and `f' represent the same value.  Built-in.
  38.       raise "FLT::is_eq(f:SAME):BOOL undefined.";
  39.    end;
  40.  
  41.    is_neq(f:SAME):BOOL is
  42.       -- True if self and `f' represent different values.  Built-in.
  43.       -- See FLTD::is_neq for more about IEEE awkwardness.
  44.       raise "FLT::is_neq(f:SAME):BOOL undefined.";
  45.    end;
  46.    
  47.    is_lt(f:SAME):BOOL is -- True if self is less than `f'. Built-in.
  48.       raise "FLT::is_lt(SAME):BOOL undefined.";
  49.    end;   
  50.  
  51.    is_leq(f:SAME):BOOL is -- True if self is less than or equal to `f'.  Built-in.
  52.       raise "FLT::is_leq(SAME):BOOL undefined.";
  53.    end;   
  54.    
  55.    is_gt(f:SAME):BOOL is -- True if self is greater than `f' as signed integers. Built-in.
  56.       raise "FLT::is_gt(SAME):BOOL undefined.";
  57.    end;   
  58.  
  59.    is_geq(f:SAME):BOOL is -- True if self is greater than or equal to `f'.  Built-in.
  60.       raise "FLT::is_geq(SAME):BOOL undefined.";
  61.    end;   
  62.  
  63.    is_within(tolerance,val:SAME):BOOL is
  64.        return (self-val).abs<=tolerance;
  65.    end;
  66.  
  67.    -- IEEE functions.
  68.  
  69.    is_finite:BOOL is -- returns true if zero, subnormal or normal.
  70.        return C_FLT::ir_finite_(self);
  71.    end;
  72.  
  73.    is_inf:BOOL is -- returns true if infinite
  74.        return C_FLT::ir_isinf_(self);
  75.    end;
  76.  
  77.    is_nan:BOOL is -- returns true if NaN
  78.        return C_FLT::ir_isnan_(self);
  79.    end;
  80.  
  81.    is_normal:BOOL is -- returns true if normal
  82.        return C_FLT::ir_isnormal_(self);
  83.    end;
  84.  
  85.    is_subnormal:BOOL is -- returns true if subnormal
  86.        return C_FLT::ir_issubnormal_(self);
  87.    end;
  88.  
  89.    is_zero:BOOL is -- returns true is zero
  90.        return C_FLT::ir_iszero_(self);
  91.    end;
  92.  
  93.    signbit_set:BOOL is -- returns true if sign bit of self is set
  94.        return C_FLT::ir_signbit_(self);
  95.    end;
  96.  
  97.    unbiased_exponent:INT is
  98.        -- return unbiased exponent of self as an INT;
  99.        -- for zero this is INT::maxint.negate, for an
  100.        -- infinite it is INT::maxint.  If subnormal,
  101.        -- normalization occurs first.
  102.        return C_FLT::ir_ilogb_(self);
  103.    end;
  104.  
  105.    copysign(y:SAME):SAME is
  106.        -- return self with the sign bit set to the same as y's sign bit.
  107.        return C_FLT::r_copysign_(self,y);
  108.    end;
  109.  
  110.    nextup:SAME is -- return next representable number from self.
  111.        return C_FLT::r_nextafter_(self,1.flt);
  112.    end;
  113.  
  114.    nextdown:SAME is -- return previous representable number from self.
  115.        return C_FLT::r_nextafter_(self,-1.flt);
  116.    end;
  117.  
  118.    --  x.remainder(y) and x.mod(y) return a remainder of x with respect
  119.    --  to y; that is, the result r is one of the numbers that differ from
  120.    --  x by an integral multiple of y.  Thus (x-r)/y  is an integral
  121.    --  value, even though it might exceed INT::maxint if it were
  122.    --  explicitly computed as an INT.  Both functions return one  of the
  123.    --  two such r smallest in magnitude.  remainder(x,y) is the operation
  124.    --  specified in ANSI/IEEE Std 754-1985; the result of x.mod(y) may
  125.    --  differ from remainder's result by +-y.  The magnitude of
  126.    --  remainder's result can not exceed half that of y; its sign might
  127.    --  not agree with either x or y.  The magnitude of mod's result is
  128.    --  less than that of y; its sign agrees with that of x.  Neither
  129.    --  function will raise an exception as long as both arguments are
  130.    --  normal or subnormal.  x.remainder(0), x.mod(0), infinity.remainder(y),
  131.    --  and infinity.mod(y) are invalid operations that produce a NaN.
  132.  
  133.    remainder(y:SAME):SAME is
  134.       return C_FLT::r_remainder_(self,y);
  135.    end;
  136.  
  137.    mod(y:SAME):SAME is
  138.       return C_FLT::r_fmod_(self,y);
  139.    end;
  140.  
  141.    scale_by(n:INT):SAME is
  142.       -- return x*2.pow(n) computed by exponent manipulation rather
  143.       -- than by actually performing an exponentiation or a multiplication.
  144.       -- 1 <= x.abs.scale_by(-x.unbiased_exponent) < 2 for every x
  145.       -- except 0, infinity, and NaN.
  146.       return C_FLT::r_scalbn_(self,n);
  147.    end;
  148.  
  149.    -- Bessel functions of the first and second kinds.  y0, y1 and yn have
  150.    -- logarithmic singularities at the origin, so they treat zero and
  151.    -- negative arguments the way log does.
  152.  
  153.    bessel_j0:SAME is
  154.       return self.fltd.bessel_j0.flt;
  155.    end;
  156.  
  157.    bessel_j1:SAME is
  158.       return self.fltd.bessel_j1.flt;
  159.    end;
  160.  
  161.    bessel_jn(n:INT):SAME is
  162.       return self.fltd.bessel_jn(n).flt;
  163.    end;
  164.  
  165.    bessel_y0:SAME is
  166.       return self.fltd.bessel_y0.flt;
  167.    end;
  168.  
  169.    bessel_y1:SAME is
  170.       return self.fltd.bessel_y1.flt;
  171.    end;
  172.  
  173.    bessel_yn(n:INT):SAME is
  174.       return self.fltd.bessel_yn(n).flt;
  175.    end;
  176.  
  177.    -- Error functions
  178.  
  179.    erf:SAME is
  180.       -- error function x.erf = (1/sqrt(pi))*integrate(0,x,exp(-t^2)dt)
  181.       return self.fltd.erf.flt;
  182.    end;
  183.  
  184.    one_minus_erf:SAME is
  185.       -- 1.0-self.erf, but computed in a way to avoid cancellation for large self.
  186.       return self.fltd.one_minus_erf.flt;
  187.    end;
  188.  
  189.    -- Exponential, logarithm, power functions.  All these functions handle
  190.    -- exceptional arguments in the spirit of IEEE 754-1985.  So:
  191.    -- 0.log is -infinity with a division by zero exception
  192.    -- For x<0, including -infinity, x.log is a quiet NaN with an invalid op exception
  193.    -- For x=+infinity or a quiet NaN, x.log is x without exception
  194.    -- For a signaling NaN, x.log is a quiet NaN with an invalid op exception
  195.    -- 1.log is zero without exception
  196.    -- For any other positive x, x.log is a normalized number with an inexact exception
  197.  
  198.    exp:SAME is -- The exponential e^self.
  199.       return self.fltd.exp.flt;
  200.    end;
  201.    
  202.    exp_minus_one:SAME is -- e^self-1.0, accurate even for tiny self.
  203.       return self.fltd.exp_minus_one.flt;
  204.    end;
  205.  
  206.    exp2:SAME is -- 2^self
  207.       return self.fltd.exp2.flt;
  208.    end;
  209.  
  210.    exp10:SAME is -- 10^self
  211.       return self.fltd.exp10.flt;
  212.    end;
  213.    
  214.    log:SAME is -- The natural logarithm of self.
  215.       return self.fltd.log.flt;
  216.    end;
  217.  
  218.    plus_one_log:SAME is -- (self+1).log, accurate even for tiny self.
  219.       return self.fltd.plus_one_log.flt;
  220.    end;
  221.  
  222.    log2:SAME is -- The logarithm base two of self.
  223.       return self.fltd.log2.flt;
  224.    end;
  225.  
  226.    log10:SAME is -- The logarithm base ten of self.
  227.       return self.fltd.log10.flt;
  228.    end;
  229.  
  230.    pow(arg:SAME):SAME is
  231.       -- self raised to the arg'th power.  x.pow(0.0)=1.0 for all x.
  232.       return self.fltd.pow(arg.fltd).flt;
  233.    end;
  234.  
  235.    -- Hyperbolic functions.  They handle exceptional arguments in the
  236.    -- spirit of IEEE 754-1985.  So:
  237.    -- sinh and cosh return +-infinity on overflow
  238.    -- acosh returns a NaN if its argument is less than 1.0
  239.    -- atanh returns a NaN if its argument has an absolute value >1.0
  240.  
  241.    sinh:SAME is -- The hyperbolic sine of self.
  242.        return self.fltd.sinh.flt;
  243.    end;
  244.  
  245.    cosh:SAME is -- The hyperbolic cosine of self.
  246.        return self.fltd.cosh.flt;
  247.    end;
  248.  
  249.    tanh:SAME is -- The hyperbolic tangent of self.
  250.        return self.fltd.tanh.flt;
  251.    end;
  252.  
  253.    asinh:SAME is -- The inverse hyperbolic sine of self.
  254.        return self.fltd.asinh.flt;
  255.    end;
  256.  
  257.    acosh:SAME is -- The inverse hyperbolic cosine of self.
  258.        return self.fltd.acosh.flt;
  259.    end;
  260.  
  261.    atanh:SAME is -- The inverse hyperbolic tangent of self.
  262.        return self.fltd.asinh.flt;
  263.    end;
  264.  
  265.    -- Trigonometric functions.  These functions handle exceptional arguments
  266.    -- in the spirit of IEEE 754-1985.  So:
  267.    -- +-infinity.sin, +-infinity.cos, +-infinity.tan return NaN
  268.    -- x.asin and x.acos with x.abs>1 return NaN
  269.    -- sinpi etc. are similar except they compute self.sinpi=(self*pi).sin avoiding
  270.    -- range-reduction issues because their definition permits range reduction
  271.    -- that is fast and exact for all self.  The corresponding inverse functions
  272.    -- compute asinpi(x)
  273.  
  274.    hypot(arg:SAME):SAME is
  275.        -- sqrt(self*self+arg*arg), taking precautions against unwarranted
  276.        -- IEEE exceptions.  +-infinity.hypot(arg) is +infinity for any arg,
  277.        -- even a NaN, and is exceptional only for a signaling NaN.
  278.        return self.fltd.hypot(arg.fltd).flt;
  279.    end;
  280.  
  281.    sin:SAME is 
  282.        return self.fltd.sin.flt;
  283.    end;
  284.  
  285.    cos:SAME is
  286.        return self.fltd.cos.flt;
  287.    end;
  288.  
  289.    -- This is commented out because I haven't implemented compiler-wise
  290.    -- TUP classes yet.
  291.    --sincos:TUP{SAME,SAME} is
  292.    --    --Simultaneous computation of self.sin and self.cos.  This is faster
  293.    --    --than independently computing them.
  294.    --    return(C_FLT::c_flt_sincos(self));
  295.    --end;
  296.  
  297.    tan:SAME is
  298.        return self.fltd.tan.flt;
  299.    end;
  300.  
  301.    asin:SAME is -- The arc sine of self in the range [-pi/2, pi/2]
  302.        return self.fltd.asin.flt;
  303.    end;
  304.  
  305.    acos:SAME is -- The arc sine of self in the range [0.0, pi]
  306.        return self.fltd.acos.flt;
  307.    end;
  308.  
  309.    atan:SAME is -- The arc tangent of self in the range [-pi/2, pi/2].
  310.        return self.fltd.atan.flt;
  311.    end;
  312.  
  313.    atan2(f:SAME):SAME is
  314.       -- The arc tangent of self divided by arg in the range [-pi, pi].
  315.       -- It chooses the quadrant specified by (self, arg).
  316.       return self.fltd.atan2(f.fltd).flt;
  317.    end;
  318.  
  319.    sinpi:SAME is 
  320.        return self.fltd.sinpi.flt;
  321.    end;
  322.  
  323.    cospi:SAME is
  324.        return self.fltd.cospi.flt;
  325.    end;
  326.  
  327.    -- This is commented out because I haven't implemented compiler-wise
  328.    -- TUP classes yet.
  329.    --sincospi:TUP{SAME,SAME} is
  330.    --  -- Simultaneous computation of self.sinpi and self.cospi.  This is faster
  331.    --  -- than independently computing them.
  332.    --    return(C_FLT::c_flt_sincospi(self));
  333.    --end;
  334.  
  335.    tanpi:SAME is
  336.        return self.fltd.tanpi.flt;
  337.    end;
  338.  
  339.    asinpi:SAME is
  340.        -- (1/pi) times the arc sine of self.  Result is in the range [-1/2,1/2]
  341.        return self.fltd.asinpi.flt;
  342.    end;
  343.  
  344.    acospi:SAME is -- The arc sine of self*pi in the range [0.0, pi]
  345.        -- (1/pi) times the arc cosine of self.  Result is in the range [0,1]
  346.        return self.fltd.acospi.flt;
  347.    end;
  348.  
  349.    atanpi:SAME is
  350.        -- (1/pi) times the arc tangent of self.
  351.        -- Result is in the range [-1/2,1/2]
  352.        return self.fltd.atanpi.flt;
  353.    end;
  354.  
  355.    atan2pi(f:SAME):SAME is
  356.       -- (1/pi) times the arc tangent of self divided by arg.
  357.       -- Result in the range [-1, 1].
  358.       -- It chooses the quadrant specified by (self, arg).
  359.       return self.fltd.atan2pi(f.fltd).flt;
  360.    end;
  361.  
  362.    -- Miscellaneous
  363.  
  364.    abs:SAME is -- The absolute value of self.
  365.        return self.fltd.abs.flt;
  366.    end;
  367.    
  368.    signum:SAME is
  369.       if self<0.0 then return -1.0;
  370.       elsif self>0.0 then return 1.0;
  371. --    else return self;                                                         -- NLP
  372.       end; return self;                                                         -- NLP
  373. --    end;                                                                      -- NLP
  374.    end;
  375.  
  376.    log_gamma:SAME is
  377.       -- log gamma function.  x.ln_gamma=x.gamma.abs.log
  378.       return self.fltd.log_gamma.flt;
  379.    end;
  380.  
  381.    gamma:SAME is
  382.       -- gamma function.
  383.       return self.fltd.gamma.flt;
  384.    end;
  385.  
  386.    sqrt:SAME is -- The square root of self.
  387.       return self.fltd.sqrt.flt;
  388.    end;
  389.  
  390.    square:SAME is -- The square of self.
  391.       return self*self;
  392.    end;
  393.  
  394.    cube_root:SAME is -- The square root of self.
  395.       return self.fltd.cube_root.flt;
  396.    end;
  397.  
  398.    cube:SAME is -- The cube of self.
  399.       return self*self*self;
  400.    end;
  401.  
  402.    max(arg:SAME):SAME is -- The larger of self and arg.
  403.       -- Doesn't work properly is an argument is NaN.
  404. --    if self<arg then return arg; else return self; end;                       -- NLP
  405.       if self<arg then return arg; end; return self;                            -- NLP
  406.    end;
  407.  
  408.    min(arg:SAME):SAME is -- The smaller of self and arg.
  409.       -- Doesn't work properly is an argument is NaN.
  410. --    if self<arg then return self; else return arg; end;                       -- NLP
  411.       if self<arg then return self; end; return arg;                            -- NLP
  412.    end;
  413.  
  414.    -- Conversions.
  415.    private shared fbuf: FSTR;
  416.    
  417.    str:STR is 
  418.       -- A string version of self. 
  419.       if ((void(fbuf)) or (fbuf.size < 30)) then fbuf := #FSTR(30) end;
  420.       fstr ::= str_in(fbuf);
  421.       return(fstr.str); end;
  422.  
  423.    str(prec:INT):STR is 
  424.       -- A string version of self with arg digits of precision.
  425.       des_sz ::= prec+10;
  426.       if ((void(fbuf)) or (fbuf.size < des_sz)) then fbuf:=#FSTR(des_sz) end;
  427.       fstr ::= str_in(fbuf,prec);
  428.       return(fstr.str);  end;
  429.  
  430.    str_in(arg:FSTR):FSTR is 
  431.       store_in: FSTR;
  432.       if (arg.size >= 30) then store_in := arg;
  433.       else store_in := #FSTR(30) end;
  434.       sz ::= C_FLT::c_flt_str_in(self, store_in); 
  435.       store_in.loc := sz;
  436.       return(store_in); end;
  437.  
  438.    str_in(arg: FSTR, prec: INT): FSTR is
  439.       store_in: FSTR;
  440.       des_sz ::= prec+10;
  441.       if (arg.size >= des_sz) then store_in := arg;
  442.       else store_in := #FSTR(des_sz) end;
  443.       sz ::= C_FLT::c_flt_str_in_prec(self, prec, store_in); 
  444.       store_in.loc := sz;
  445.       return(store_in);  end;
  446.  
  447.    create (s: STR): SAME is
  448.       return C_FLTD::atof(s).flt
  449.    end;
  450.    
  451.    int:INT is
  452.       -- INT version of self.  It is an error if self is not integral.
  453.       -- Use truncate, floor, ceiling, or round to achieve this.
  454.       return self.fltd.int;
  455.    end;
  456.  
  457.    fltd:FLTD is
  458.       -- An FLTD version of self.  Built-in.
  459.       raise "FLT::fltd:FLTD undefined." end;   
  460.  
  461.    fltx:FLTX is
  462.       -- An extended floating point version of self. It is an
  463.       -- error if the value cannot be held in a FLTX. Built-in.      
  464.       raise "FLT::fltx:FLTX undefined." end;
  465.    
  466.    fltdx:FLTDX is
  467.       -- An extended floating point version of self.  Built-in.         
  468.       raise "FLT::fltdx:FLTDX undefined." end;
  469.  
  470.    truncate:SAME is -- The nearest integer toward zero.
  471.       return self.fltd.truncate.flt;
  472.    end;
  473.  
  474.    floor:SAME is -- The largest integer not greater than self.
  475.       return self.fltd.floor.flt;
  476.    end;
  477.  
  478.    ceiling:SAME is -- The smallest integer not less than self.
  479.       return self.fltd.ceiling.flt;
  480.    end;
  481.  
  482.    round:SAME is -- The closest integer to self.
  483.       return self.fltd.round.flt;
  484.    end;
  485.  
  486.    -- Special values.
  487.  
  488.    -- An approximation of the mathematical value "pi".
  489.    const pi:SAME:=FLTD::pi.flt;
  490.  
  491.    -- An approximation of the base of the natural logarithms "e".
  492.    const e:SAME:=FLTD::e.flt; 
  493.  
  494.    const sqrt_2:SAME:=FLTD::sqrt_2.flt;                 -- Approximation of 2.sqrt.
  495.    const log_2:SAME:=FLTD::log_2.flt;                   -- Approximation of 2.log. 
  496.    const log2_e:SAME:=FLTD::log2_e.flt;                 -- Approximation of e.log2.
  497.    const log10_e:SAME:=FLTD::log10_e.flt;               -- Approximation of e.log10.
  498.    const log_10:SAME:=FLTD::log_10.flt;                 -- Approximation of 10.log. 
  499.    const half_pi:SAME:=FLTD::half_pi.flt;               -- Approximation of pi/2. 
  500.    const quarter_pi:SAME:=FLTD::quarter_pi.flt;         -- Approximation of pi/4.
  501.    const inv_sqrt_2:SAME:=FLTD::inv_sqrt_2.flt;         -- Approximation of 1/(2.sqrt).
  502.    const inv_pi:SAME:=FLTD::inv_pi.flt;                 -- Approximation of 1/pi. 
  503.    const double_inv_pi:SAME:=FLTD::double_inv_pi.flt;   -- Approximation of 2/pi. 
  504.    const double_sqrt_pi:SAME:=FLTD::double_sqrt_pi.flt; -- Approximation of 2*(pi.sqrt).
  505.  
  506.    -- The value to be used to represent no element in sets.
  507.    const nil:SAME:=signaling_NaN(0);
  508.  
  509.    signaling_NaN(sig:INT):SAME is
  510.        -- IEEE signalling NaN.  `sig' is the significand (presently unused).
  511.        return C_FLT::r_signaling_nan_(sig);
  512.    end;
  513.  
  514.    quiet_NaN(sig:INT):SAME is 
  515.        -- IEEE quiet NaN.  `sig' is the significand (presently unused).
  516.        return C_FLT::r_quiet_nan_(sig);
  517.    end;
  518.  
  519.    infinity:SAME is -- IEEE Infinity.
  520.       return C_FLT::r_infinity_;
  521.    end;
  522.    
  523.    const epsilon:SAME:=1.19209290e-07; -- The minimum x>0.0 such that 1.0+x/=x. 
  524.  
  525.    const digits:INT:=6; -- The number of decimal digits of precision.
  526.  
  527.    -- The number of bits in the significand, including an implied bit.
  528.    const mantissa_bits:INT:=24;
  529.  
  530.    -- The smallest normalized positive number.
  531.    const min_normal:SAME:=1.17549435e-38;
  532.  
  533.    -- The largest normalized positive number.
  534.    const max_normal:SAME:=3.40282347e38;
  535.  
  536.    min_subnormal:SAME is -- The smallest subnormal positive number.
  537.       return C_FLT::r_min_subnormal_;
  538.    end;
  539.  
  540.    max_subnormal:SAME is -- The largest subnormal positive number.
  541.       return C_FLT::r_max_subnormal_;
  542.    end;
  543.  
  544.    -- The minimum negative integer x such that b^(x-1) is in the range
  545.    -- of normalized floating point numbers.
  546.    const min_exp:INT:=-125;
  547.  
  548.    -- The minimum x such that 10^x is in the range of normalized
  549.    -- floating point numbers.
  550.    const min_exp10:INT:=-37;
  551.  
  552.    const max_exp:INT:=128; -- The maximum allowable exponent.
  553.  
  554.    const max_exp10:INT:=38; -- The maximum x such that 10^x is within range.
  555.  
  556.    -- Useful iters
  557.  
  558.    sum!(i:SAME!):SAME is
  559.       -- Yields the sum of all previous values of `i'.
  560.       r::=0.0; loop r:=r+i; yield r end end;
  561.  
  562.    product!(i:SAME!):SAME is
  563.       -- Yields the product of all previous values of `i'.
  564.       r::=1.0; loop r:=r*i; yield r end end;
  565.  
  566. end; -- class FLT
  567.  
  568. -------------------------------------------------------------------
  569. external class C_FLT is
  570.     -- This corresponds to the standard math functions linkable with "-lm".   
  571.  
  572.     ir_finite_(a:FLT):BOOL;
  573.     ir_isinf_(a:FLT):BOOL;
  574.     ir_isnan_(a:FLT):BOOL;
  575.     ir_isnormal_(a:FLT):BOOL;
  576.     ir_issubnormal_(a:FLT):BOOL;
  577.     ir_signbit_(a:FLT):BOOL;
  578.     ir_iszero_(a:FLT):BOOL;
  579.     ir_ilogb_(a:FLT):INT;
  580.     r_copysign_(a:FLT,b:FLT):FLT;
  581.     r_nextafter_(a:FLT,b:FLT):FLT;
  582.     r_remainder_(a:FLT,b:FLT):FLT;
  583.     r_fmod_(a:FLT,b:FLT):FLT;
  584.     r_scalbn_(a:FLT,b:INT):FLT;
  585.     --r_c_flt_sincos_(a:FLT):TUP{FLT,FLT};
  586.     --r_c_flt_sincospi_(a:FLT):TUP{FLT,FLT};
  587.     r_signaling_nan_(a:INT):FLT;
  588.     r_quiet_nan_(a:INT):FLT;
  589.     r_infinity_:FLT;
  590.     r_min_subnormal_:FLT;
  591.     r_max_subnormal_:FLT;
  592.    c_flt_str_in(f: FLT, s: FSTR): INT;
  593.    c_flt_str_in_prec(f: FLT, prec: INT, s: FSTR): INT;
  594.    
  595. end;
  596. -------------------------------------------------------------------   
  597.