Re: Variablen in Methode nicht zulaessig
- From: mirco_menard@xxxxxxx
- Date: 30 Dec 2005 03:38:01 -0800
Stefan Ram schrieb:
> Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx> writes:
> > public static double hypotenuse(double a, double b)
> > {
> > // berechnet die Hypotenuse im rechtwinkligen Dreick
> > double x;
> > x =Math.sqrt(a*a+b*b);
> > x =Math.round(x*100.0)/100.0;
> > return x;
> > }
>
> Due to the rounding, the comment and the name of the method
> now is misleading. Assume, a = 3E-17 and b = 4E-17, the result
> according to the comment should be 5E-17, but I am afraid it
> might be significantly different.
>
> There is also another possible implementation:
>
> public static double hypotenuse( final double a, final double b )
I'm sorry, it was a misstake, have no language watch
> { return java.lang.Math.hypot( a, b ); }
.
- References:
- Variabln in Methode nicht zulässig
- From: mirco_menard
- Re: Variabln in Methode nicht zulässig
- From: Roedy Green
- Variabln in Methode nicht zulässig
- Prev by Date: Re: polygon shape of jcomponent
- Next by Date: How to add elements to a JList without preventing refresh
- Previous by thread: Re: Variabln in Methode nicht zulässig
- Next by thread: polygon shape of jcomponent
- Index(es):
Relevant Pages
|