2 ms·
GHC (Haskell): $ ghci GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help 0.1 Loading package ghc-prim ... linking ... done. Loading package
by eru 16y ago
GHC (Haskell):
$ 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
.3
- erikwiffin 16y agoThanks, I've added them. Not only do I not have an interpreter for any of these languages handy, I've never even used them!
- eru 16y agoYou're welcome. bc 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.)
- erikwiffin 16y agoFixed. I've moved the rational number stuff to a comment, I'm working on the formatting, but I think what I've got now works.
- eru 16y agoGood. By the way, having OR in the middle column and AND in the right column seems a bit strange.