🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #431

Re: Math problem please help me

#431
From: kc
Date: Tue, 16 Dec 2003 08:17
89 lines
3175 bytes
What values are using.
I used 12.4 and 14.1
and get the following

12.4
14.1
352.57000000000005
0.6177053966874066
gama
1.1370967741935483
0.849461322392921
-0.9604045283018868
fi
2.859246884862765
teta2
-0.05551347883261104
Felipe wrote:

> hi...im working with jbuilder and i have a problem with Math class.... i write my class but in the teta2 angle send me an NaN i was checking but i cant found the problem... somebody can help me??? is urgent..this is my class
> 
> 
> import java.math.*;
> import java.util.*;
> import java.lang.*;
> import java.text.*;
> 
> public class Cinversa {
> 
>  public Cinversa(String coordx,String coordy) {
>    double B;
>    double x,y;
>    double r;
> 
>     double r2, x2, y2, teta1, teta2, L1, L2, t, L12, L22;
>     double Beta, Gama, G, fi, fi2, rad1, rad2;
> int largo;
> 
>  String X3 =coordx;
>  String Y3 = coordy;
> 
>      x = Double.valueOf(coordx).doubleValue();
>      y = Double.valueOf(coordy).doubleValue();
> 
> 
>     if (y != 0) {
>   L1 = 62.5;
>   L2 = 53;
>   System.out.println(x);
>   System.out.println(y);
>   x2 = Math.pow(x,2);
>   y2 = Math.pow(y,2);
>   r2 = (x2+y2);
>   r = Math.sqrt(r2);
>   System.out.println(r2);
> 
>   G = (r2 + Math.pow(L1,2) - Math.pow(L2,2))/(2*L1*r);
>   System.out.println(G);
>   Gama = Math.acos(G);
>   System.out.println("gama");
>   B = y/x;
>   System.out.println(B);
>   Beta = Math.atan(B);
>   System.out.println(Beta);
> 
> 
>   fi = (r2 - Math.pow(L1,2) - Math.pow(L2,2))/(2*L1*L2);
>   System.out.println(fi);
>     System.out.println("fi");
>  teta2 = Math.acos(fi);*******here is the problem***********
>         System.out.println(teta2);
>     System.out.println("teta2");
> 
> 
>      if (teta2 > 0) {
> 
>        teta1 = (Beta - Gama);
>         t = (teta1 *625)/1450;
>         System.out.println(teta1);
>       }
> 
>      if (teta2 < 0) {
> 
>        teta1 = (Beta + Gama);
>         t = (teta1 *625)/1450;
>         System.out.println(teta1);
>      }
>   }
> }
> }
Technical Details
Message-ID: <3fdebf7c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fde951d@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,55e04f84d88b5035
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-12-16 00:39:32 PST
Date: Tue, 16 Dec 2003 09:17:03 +0100
From: kc <kc@divitech.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.api
Subject: Re: Math problem please help me
References: <3fde951d@newsgroups.borland.com>
In-Reply-To: <3fde951d@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 212.242.145.133
Message-ID: <3fdebf7c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1071562620 212.242.145.133 (16 Dec 2003 00:17:00 -0700)
Lines: 90
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail