Closed MuratOzsoyler closed 3 years ago
This is a very interesting situation. I forked the repo and compiled. Tests are successfully run. And result in the REPL is
> formatNumber "0.0" 1234567890123459.0
(Right "1234567890123459.0")
I thought the problem might be related to the compiler version (head can not be compiled older than 0.14 purescript) so checked out commit 3411dbc16efcf6fe9ea0760434dc153f5cc99c58. Compiled with 0.13.8 and tested. Result:
> formatNumber "0.0" 1234567890123459.0
(Right "1234567890123459.0")
I started to blame myself for the false alarm. Just for curiosity I tested one more time in my original project (ps 0.13.8, formatters 4.0.1). The result is this time is:
> formatNumber "0.0" 1234567890123459.0
(Right "2147483647.2147483647")
Both repls are open on my monitor now and one succeeds and one fails!
Hi I am new here could I resolve this as my firs issue?
I do see this on Try PureScript:
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (logShow)
import TryPureScript (render, withConsole)
import Data.Formatter.Number (formatNumber)
main :: Effect Unit
main = render =<< withConsole do
logShow $ formatNumber "0.0" 1234567890123459.0
producing (Right "2147483647.2147483647")
. I think there's definitely something up here, though I haven't yet looked into this issue.
@JuanFML Please feel free! No one else is working on this at the moment (as far as I know).
Cool! I will try to solve it, if I have any issue I'll let you know
Hi! I looked into the problem through the weekend and I think on the actual repo the problem is generated in a different way than in TryPurescript, I wasn't able to fix it, but I think maybe it has to do with the operations that occur in the formatter. I am new to PureScript, so If you want to solve it go ahead,
This is a little late, but I believe that this was fixed between v4.0.1 and v5.0.0.
See this discussion
https://github.com/purescript-contrib/purescript-formatters/pull/56#discussion_r471893147
from a PR that got merged as part of 5.0.0.
I think this issue can be closed?
Thanks @ntwilson!
Describe the bug If number is greater than 10 digits
formatNumber
always returns02147483647.2147483647
or alike.To Reproduce
but
Expected behavior Numbers up to
12345678901234564.0
can exactly beshow
n. SoformatNumber
should format them. If for whatever reason it could not format reasonably thenLeft
should be returned.