Showing posts with label Math. Show all posts
Showing posts with label Math. Show all posts

Wednesday, May 30, 2012

Google can do complex calculation..!!


Google is a full-fledged calculator. You'll understand this when you start typing math equations into the search box. Try a simple problem such as 5 X 2, and press Search. Google immediately goes into calculator mode, showing you the answer instantaneously. Want to get fancy? 

A math calculation such as 5*9+(sqrt 10)3 is as easy for Google as 2+2.

Tuesday, May 29, 2012

“Go” Language Tutorial-5(Exported Names)


Exported names



After importing a package, you can refer to the names it exports.

In Go, a name is exported if it begins with a capital letter.

Foo is an exported name, as is FOO. The name foo is not exported.

Run the code. Then rename math.pi to math.Pi and try it again.

 

Example :

package main

import (
"fmt"
"math"
)

func main() {
fmt.Println(math.pi)
}

 

output:
prog.go:9: cannot refer to unexported name math.pi
prog.go:9: undefined: math.pi

after renaming math.pi to math.Pi

package main

import (
"fmt"
"math"
)

func main() {
fmt.Println(math.Pi)
}

output:
3.141592653589793

“Go” Language Tutorial-4(Imports)

Imports



This code groups the imports into a parenthesized, "factored" import statement. You can also write multiple import statements, like:
	import "fmt"
import "math"

but it's common to use the factored form to eliminate clutter.

 

Example :

package main

import (
"fmt"
"math"
)

func main() {
fmt.Printf("Now you have %g problems.",
math.Nextafter(2, 3))
}

output:
Now you have 2.0000000000000004 problems.