Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

How to use java math...

Thread view: 
Boki - 02 Dec 2005 07:09 GMT
Hi All,

When I call:

Math.sin( 1 )

it failed..

cannot find symbol
symbol  : method sin(int)
location: class java.lang.Math
IchBin - 02 Dec 2005 07:47 GMT
> Hi All,
>
[quoted text clipped - 7 lines]
> symbol  : method sin(int)
> location: class java.lang.Math

You may, as a beginner, post these questions to c.l.j.help and not
c.l.j.programmer newsgroup.

You mean you call it like this

double doubleValue = Math.sin( 1 );

Its saying that it can not find the class java.lang.Math

If on windows, did you add Java Home install directory to your class path..

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Nigel Wade - 02 Dec 2005 15:43 GMT
>> Hi All,
>>
[quoted text clipped - 16 lines]
>
> Its saying that it can not find the class java.lang.Math

Actually, it's not.

It's saying that it's found Math in java.lang.Math, but it can't find a method
called "sin" which takes an int as it's argument. This is to be expected
because there isn't one - the only method "sin" in the java.lang.Math API takes
a double.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

klynn47@comcast.net - 02 Dec 2005 16:46 GMT
1, being an int, should be automatically promoted to a double. This
program works fine in 1.4.1_02

public class Test1 {

  public static void main(String[] args) {
     System.out.println(Math.sin(1));  
  }

}
klynn47@comcast.net - 02 Dec 2005 12:07 GMT
Could you show the full code?
Roedy Green - 02 Dec 2005 18:50 GMT
>When I call:
>
>Math.sin( 1 )
>
>it failed..

First, Math.sin wants a number in radians.  It also wants a double.  I
am puzzled though why the compiler was unwilling to promote an int to
a double automatically.

Show us you exact code.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.