question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BigInt encoded in scientific notation

See original GitHub issue

https://scastie.scala-lang.org/CYDFcG1GSPSMxWqgsUi1Vw

import io.circe.syntax._

println(BigInt(1000).asJson)
// 1e3

Is this expected? Looks like a bug to me.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
travisbrowncommented, Aug 11, 2019

Fixed in #1217 and #1218.

1reaction
plokhotnyukcommented, Dec 14, 2018

@joroKr21 as W/A you can try the following custom encoder:

 implicit val bigIntEncoder: Encoder[BigInt] = Encoder.encodeJsonNumber
    .contramap(x => JsonNumber.fromDecimalStringUnsafe(new java.math.BigDecimal(x.bigInteger).toPlainString))

Also, please, see how it works in a context of benchmarks (updated results will be published in a week).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Initialization with string in scientific format in Java BigInteger?
Scientific notation applies to BigInteger s only in a limited scope - i.e. when the number in front of E is has as...
Read more >
Help regarding parsing string in scientific notation (very large ...
I am reading an excel file that contains value under a column as 123456789987654321123456789. As it is excel, value is opened in scientific...
Read more >
Manually Parsing Scientific Notation in Hive 0.81 - Matt Faus
Concatenate strings from steps 1 and 2 with (Y – len(X)) '0' characters. Cast the string from step 4 to a bigint, this...
Read more >
String Representation of Java Decimals Without Scientific ...
Learn how to print your decimal numbers in Java as full strings while skipping the scientific notation for cleaner, more readable outputs.
Read more >
scientific notation javascript | The AI Search Engine You Control
toString());. Beware, though, that any integer you output as a JavaScript number (not a BigInt) that's more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found