[GHC] #14389: Improved results in GHCi during basic calculations

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- We can use GHCi as a calculator using {{{+}}}, {{{-}}}, {{{*}}}, {{{/}}}, {{{sin}}}, {{{cos}}}, and others. sometimes the result does not meet our expectations. for example if I calculate 3 + 2, the result is 5 and in line with our expectations. \\ {{{ Prelude> 3+2 5 }}} but sometimes it is not.\\ for the two examples below, please, can we have in GHCi a result other than the one given?\\ {{{ Prelude> exp(log(1000)-log(10)) 99.99999999999996 }}} can we have a result equal to {{{100}}}? \\ {{{ Prelude> 12*(1/3-1/4)-1 -2.220446049250313e-16 }}} can we have a result equal to {{{0}}}? \\ -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by svenpanne): * status: new => closed * resolution: => invalid Comment: Sorry to say, but this ticket is basically the same as your previous tickets #14377 and #14384. The bottom line is: The floating point numbers/operations available on normal HW are fundamentally different from the usual numbers/operations from math. If you want to understand the details, please have a look at ''the'' paper in this area "What Every Computer Scientist Should Know About Floating-Point Arithmetic" (available at e.g. http://www.validlab.com/goldberg/paper.pdf). Your `exp`/`log` result is therefore fully expected, and the same holds for the last example, although there you can calculate in a different domain by adding a `:: Rational` after it. Before opening more tickets in this area, please have a look at that paper first and try to understand Haskell's defaulting mechanism, too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by vanto): * status: closed => new * resolution: invalid => Comment: Hello svenpanne, happy to read you again. Sorry to say, but when you solve these equations in Xcas (formal computation) or in Wolfram Mathematica, the results are just, fair, rightful (i.e 100 or 0) I know what's in this paper for a long time. in the past, when I was younger I started to calculate with a slide-rule and now I use a calculator. I am new to Haskell, not in this word! so if you can not do it, just say "I do not know how to do it." There is no shame in that. I reopen this ticket just to see it closed by you again, apparently you like playing with tickets, is'nt it? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hsyl20):
I know what's in this paper for a long time.
I reopen this ticket just to see it closed by you again, apparently you
Your memory fails you then as you don't seem to understand the difference between formal and floating-point computations. like playing with tickets, is'nt it? Could you stop trolling? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hsyl20): * status: new => closed * resolution: => invalid -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by vanto): * status: closed => new * resolution: invalid => Comment: hsylv20, you are rude. your susceptibility outweighs the reason. Trolling? I do not know what is it? you do not understand humor and you are stubborn too. this ticket is a new request requesting the opinion of a member of the Committe. hsyl20 and svennpanne, you are not a member of the current Committee, so I do not recognize you as the authority to close this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by svenpanne): * status: new => closed * resolution: => invalid Comment: This is a bug tracker for GHC, so one doesn't need to be a member of any Haskell Committee or such to open/close/modify tickets. Open Source is largely based on mutual agreement, not on organizational hierarchies. If you want to propose changes to the Haskell language per se, you can open a pull request on https://github.com/haskell/rfcs, but probably you should better start on the haskell-cafe mailing list to test your ideas. Anyway, for the current ticket at hand such a proposal would very probably have no success: You propose adding some kind of symbolic computation, but Haskell doesn't aim to be a computer algebra system like MATLAB or Mathematica. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Open Source is largely based on mutual agreement, not on organizational hierarchies. Sorry. It's new to me.\\ you should better start on the haskell-cafe mailing list to test your ideas It's a good idea. I have never used a mailing list yet. I hope people are kind. To be honest, I do not speak the English language well, and that
Anyway, for the current ticket at hand such a proposal would very
#14389: Improved results in GHCi during basic calculations -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by vanto): Replying to [[span(style=color: #FF0000, svenpanne )]]: \\ Thanks svenpanne for your explanations.\\ penalizes me in a conversation when I have to discuss technical details. That's why I would never make a proposal for GHC.\\ probably have no success It does not matter to me. My ideas are for everyone.\\
but Haskell doesn't aim to be a computer algebra system like MATLAB or Mathematica. It is an answer that suits me. I understand. It took a lot of time and energy for each of us to say it. \\ \\ One more thing. I hope I was not rude to you with my humor. I try to always be polite to people. (even if sometimes I speak a little loudly). This ticket will remain closed permanently. Thanks again.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14389#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC