5 ms·
http://0.30000000000000004.com/ http://0.30000000000000004.com/ Because why not? I've populated it with some languages that I can convenient access to an inter
by erikwiffin 16y ago
http://0.30000000000000004.com/ http://0.30000000000000004.com/
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.
- waterhouse 16y agoRacket (aka PLT Scheme): $ 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
- erikwiffin 16y agoThanks, added.
- eru 16y agoGHC (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.
- moderation 16y agoGo (via the online system at http://golang.org/ http://golang.org/) package main import "fmt" func main() { fmt.Println(.1+.2) } 0.3
- erikwiffin 16y agothanks, added
- ben_straub 16y agoPowershell: PS C:\> 0.1 + 0.2 0.3
- erikwiffin 16y agothanks, added
- olalonde 16y agoIIRC, Ruby supports rational numbers through http://ruby-doc.org/core/classes/Rational.html http://ruby-doc.org/core/classes/Rational.html
- deleted 16y ago[deleted]