atan.java :  » Scripting » Pnuts » org » pnuts » math » Java Open Source

Java Open Source » Scripting » Pnuts 
Pnuts » org » pnuts » math » atan.java
/*
 * @(#)atan.java 1.2 04/12/06
 *
 * Copyright (c) 2001-2004 Sun Microsystems, Inc. All Rights Reserved.
 *
 * See the file "LICENSE.txt" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */
package org.pnuts.math;

import pnuts.lang.PnutsFunction;
import pnuts.lang.Context;

public class atan extends PnutsFunction {

  public atan(){
    super("atan");
  }

  public boolean defined(int nargs){
    return nargs == 1;
  }

  protected Object exec(Object[] args, Context context){
    if (args.length != 1){
      undefined(args, context);
      return null;
    }
    return new Double(Math.atan(((Number)args[0]).doubleValue()));
  }

  public String toString(){
    return "function atan(number)";
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.