Because why not? I've populated it with some languages that I can convenient access to an interpreter for. If you post/send me .1 + .2 in any other languages, I'll try and put them up.
Because why not? I've populated it with some languages that I can convenient access to an interpreter for. If you post/send me .1 + .2 in any other languages, I'll try and put them up.
$ ghci
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
0.1 Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 0.1 + 0.2
0.30000000000000004
And just for fun with GHC's rational numbers: Prelude> :m + Data.Ratio
Prelude Data.Ratio> (1 % 10) + (2 % 10)
3 % 10
Hugs (Haskell): $ hugs
Hugs> 0.1 + 0.2
0.3
bc: $ bc
0.1 + 0.2
.3
Gforth: $ gforth
0.1e 0.2e f+ f. 0.3 ok
dc: $ dc
0.1 0.2 + p
.3bc and dc are probably installed on your Linux or Unix box.
By the way, you should fix "Below are some examples of sending .1 + .2 to standard output in a variety of common languages." to "[...] in a variety of languages."
It also seems like the names of bc and dc are non-capitalized.
For the Haskell entry, please just shorten it to "0.1 + 0.2". The "Prelude>" thing is just a prompt for the REPL. ":m + Data.Ratio" loads the rational number module, please take the entry about Haskell's rational numbers out since yours is a page about floating point. (You might want to replace it with a comment, that Haskell supports rational numbers. But so do lots of languages in their libraries.)
C would be a good addition. (Plus Fortran, Cobol, Ada and J.)
$ racket
Welcome to Racket v5.0.1.
> (+ .1 .2)
0.30000000000000004
> (+ 1/10 2/10)
3/10
Steel Bank Common Lisp: $ sbcl
This is SBCL 1.0.43 [...elided]
* (+ .1 .2)
0.3
* (+ 1/10 2/10)
3/10 package main
import "fmt"
func main() {
fmt.Println(.1+.2)
}
0.3 PS C:\> 0.1 + 0.2
0.3