/[gcl]/gcl/o/num_sfun.c
ViewVC logotype

Diff of /gcl/o/num_sfun.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by camm, Sat Jul 20 07:10:55 2002 UTC revision 1.3 by camm, Tue Aug 6 22:41:30 2002 UTC
# Line 425  number_cos(object x) Line 425  number_cos(object x)
425          }          }
426  }  }
427    
428    static object
429    number_tan1(object x)
430    {
431            double cos(double);
432    
433            switch (type_of(x)) {
434    
435            case t_fixnum:
436            case t_bignum:
437            case t_ratio:
438                    return(make_longfloat((longfloat)tan(number_to_double(x))));
439    
440            case t_shortfloat:
441                    return(make_shortfloat((shortfloat)tan((double)(sf(x)))));
442    
443            case t_longfloat:
444                    return(make_longfloat(tan(lf(x))));
445    
446            case t_complex:
447            {
448                    object r;
449                    object x0, x1, x2;
450                    vs_mark;
451    
452                    x0 = number_times(imag_two, x);
453                    vs_push(x0);
454                    x0 = number_exp(x0);
455                    vs_push(x0);
456                    x1 = number_minus(x0,small_fixnum(1));
457                    vs_push(x1);
458                    x2 = number_plus(x0,small_fixnum(1));
459                    vs_push(x2);
460                    x2 = number_times(x2,imag_unit);
461                    vs_push(x2);
462                    r = number_divide(x1, x2);
463    
464                    vs_reset;
465                    return(r);
466            }
467    
468            default:
469                    FEwrong_type_argument(sLnumber, x);
470                    return(Cnil);
471    
472            }
473    }
474    
475  object  object
476  number_tan(object x)  number_tan(object x)
477  {  {
478          object r, s, c;          object r, c;
479          vs_mark;          vs_mark;
480    
         s = number_sin(x);  
         vs_push(s);  
481          c = number_cos(x);          c = number_cos(x);
482          vs_push(c);          vs_push(c);
483          if (number_zerop(c) == TRUE)          if (number_zerop(c) == TRUE)
484                  FEerror("Cannot compute the tangent of ~S.", 1, x);                  FEerror("Cannot compute the tangent of ~S.", 1, x);
485          r = number_divide(s, c);          r = number_tan1(x);
486          vs_reset;          vs_reset;
487          return(r);          return(r);
488  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26