HsYAML icon indicating copy to clipboard operation
HsYAML copied to clipboard

Use scientific to fix floating point rounding problems

Open mightybyte opened this issue 3 years ago • 3 comments

Here's a proof of concept. Do you have a preference about how to resolve the LANGUAGE Safe bit? I was unsure about that.

mightybyte avatar Jan 03 '22 16:01 mightybyte

Testsuite fails, missing instances From/ToYaml Double:

[1 of 1] Compiling Main             ( tests/Tests.hs, /__w/HsYAML/HsYAML/dist-newstyle/build/x86_64-linux/ghc-9.2.1/HsYAML-0.2.1.0/t/tests/build/tests/tests-tmp/Main.o )

tests/Tests.hs:26:[32](https://github.com/haskell-hvr/HsYAML/pull/58/checks#step:19:32): error:
    • No instance for (ToYAML Double) arising from a use of ‘outputStr’
    • In the second argument of ‘(==)’, namely ‘outputStr d’
      In the expression: ".nan" == outputStr d

tests/Tests.hs:60:32: error:
    • No instance for (FromYAML Double)
        arising from a use of ‘roundTrip’
    • In the second argument of ‘($)’, namely
        ‘roundTrip approxEq (1 :: Double)’

andreasabel avatar Feb 12 '22 20:02 andreasabel

Do you have a preference about how to resolve the LANGUAGE Safe bit?

I don't really have any experience with -XSafe. I'm fine with removing it for now and waiting until someone comes along who cares. :)

sjakobi avatar Nov 02 '22 15:11 sjakobi

What is the error if LANGUAGE Safe is left there?

andreasabel avatar Nov 04 '22 18:11 andreasabel