1. Why does Math.floor return a double? stackoverflow.comOfficial javadoc says that Math.floor returns a double that is "equal to a mathematical integer", but then why shouldn't it return an int? |
2. Is there any square root function more accurate than java.lang.Math.sqrt(double) stackoverflow.comI am looking for square root functions (to use in java) that can give square roots upto atleast to 5-6 decimal places accurately. If there is a way to control accuracy ... |
3. Javas Math.sin() produces NaN all the time stackoverflow.comForgive me if this is a dumb beginners problem, but I really don't get it. I have a member variable declared like so:
When I assign 3.14159265 to Value and try ... |
4. How to approximate double? stackoverflow.comHow to I write a function that approximates a double in the following manner, returning an int:
|
5. How do I convert a double to a fraction in a format suitable for representing inches? stackoverflow.comI am using the Apache Commons math.Fraction class to convert my doubles to fractions, which is working fine. However, I need it to calculate these fractions in a way that ... |
6. Java: questions about radians, Math.cos, Math.sin, double and long stackoverflow.comI need to implement the harvesine distance in my java code. I found this snippet in Javascript, and I need to convert it to java.
|
7. Getting Math.pow to return a correct value? stackoverflow.comhow can I make this expression not end up being a zero.
|
8. Java Doubles are not good at math stackoverflow.comI am currently writing a calculator program in java. It is my first java program, I am used to c++. I have noticed that doubles in java are not at all like ... |
9. Why is my math with Doubles coming out wrong? stackoverflow.comThis is how I am creating q
at this point the values of the other variables are
but
|
10. Java equivalent to commons-math Stats that works on multi precision rather than double stackoverflow.comI could translate the code to use BigDecimal or the Apfloat library rather than double but that would take considerable effort. I was hoping that there was an FOSS library that ... |
11. Why is the last number wrong? stackoverflow.comWhy is only the last number wrong in the output this code:
|
12. Java double precision math stackoverflow.comI'm doing a bit of modding to a popular game(Minecraft) and I seen these lines in the terrain generation
|
13. Why does Math.ceil return a double? stackoverflow.comThis one threw me for a loop for a bit. When I call |
14. Java Math - Floor/Ceil returning double coderanch.comIs there a good reason Math.floor() and Math.ceil() return double's instead of int (or more precisely long)? Is this just a matter of "it was done in JDK 1.0 this way and we can't change it" or is there some justification to it? I haven't seen a better explanation other than "it's what the API documentation says", which doesn't really answer ... |
15. is Math.pow only used with type double? java-forums.orgI'm trying to calculate compound interest only using integers and I keep getting errors messages associated with this formula: amount = principal * Math.pow( 1.0 + rate, year ); I get stuff like: InterestTwo.java:20: pow(double,double) in java.lang.Math cannot be applied to (int) or InterestTwo.java:20: possible loss of precision found : double required: int amount = principal * Math.pow( 1.0 + rate, ... |
16. double x = Math.sqrt(anynumber); forums.oracle.comFirst off, many here don't take too well to folks who post the entire assignment, without showing any work as many will assume that the poster wants someone else to do the assignment for them. I will assume that this isn't you, that you don't want someone to do it all for you. Secondly, our track record for helping folks who ... |
17. Where is Math.sin(double x); actually defined? forums.oracle.com |