Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: Return the arctangent of x in radians

import math
print math.atan(-1./-1.)
print math.atan2(-1., -1.)

Java: How to divide one BigDecimal from another BigDecimal

import java.math.BigDecimal;
public class BigDecDiv
 {
  public static void main(String[] argv) throws Exception
  	{
    BigDecimal val1 = new BigDe

Python: Read String from standard input.

import math as operation
while 1:
    val1=raw_input("Enter X: ")
    val1= int(val1)
    val2=raw_input("Enter Y: ")
    val2= int(val2)
    if va

Java: Demonstrates the while loop.

public class WhileTest 
{
  public static void main(String[] args) 
 {
    double r = 0;
    while(r < 0.99d) 
    {
      r = Math.random();
      S

Java: How to multiply one BigDecimal to another BigDecimal

import java.math.BigDecimal;
public class BigDecMulti
 {
  public static void main(String[] argv) throws Exception
  	{
    BigDecimal val1 = new Big

Java: How to animate JButton

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import

Java: How to use Math.copySign method

public class MethodeCopySign {
  public static void main(String[] args) 
{
 
  // Returns a copySign of the first argument
    double d = Math.copy

Java-Regular_Expression: reset the matcher using ‘reset’ method

import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegexReset
 {
  public static void main(String[] args) throws Exception

Python: sort the items of a list

import math
myList=[2.0, -9.5, 78, -0.14, 13, 45, -51, round(math.pi, 0)]
print "Unsorted list: ",myList
myList.sort() # sort
print "Sorted list: "

Java: How to use Math.nextAfter method

public class AdjacentExample {
  public static void main(String[] args) {
    double lesserAdjacent = Math.nextAfter(150.0, 320.0);
    System.ou

Java: some maths operation using ‘BigDecimal’ class

import java.math.BigDecimal;
public class BigDecMath
 {
  public static void main(String[] args)
  	{
    BigDecimal bd1 = new BigDecimal("12525.14")

Java: How to Animate a 2D Graphics

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.J

Java: Fading a java component

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.T

Python: Return the cosine of a value

import math
print math.cos(1024)

Java: Demonstrates the while loop.

public class WhileTest 
{
  public static void main(String[] args) 
 {
    double r = 0;
    while(r < 0.99d) 
    {
      r = Math.random();
      S