Skip to content

Commit

Permalink
debug parsedouble
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv committed Apr 12, 2024
1 parent f806c95 commit d3d413a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions javalib/src/main/scala/java/lang/IEEE754Helpers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ private[java] object IEEE754Helpers {

val nChars = s.length
if (nChars == 0)
throw new NumberFormatException(exceptionMsg(s))
throw new NumberFormatException("nchars == 0 " + exceptionMsg(s))

val cStr: CString = stackalloc[scala.Byte](nChars + 1)

if (_numericCharSeqToCString(s, nChars, cStr) == false) {
throw new NumberFormatException(exceptionMsg(s))
throw new NumberFormatException("cannot convert to cstring " + exceptionMsg(s))
}

val end = stackalloc[CString]() // Address one past last parsed cStr byte.
Expand All @@ -86,10 +86,10 @@ private[java] object IEEE754Helpers {
// or +/- infinity for values too +/- large for an IEEE754.
// Slick C lib design!
} else {
throw new NumberFormatException(exceptionMsg(s))
throw new NumberFormatException(s"parse ${classOf[T]} ($errno) " + exceptionMsg(s))
}
} else if (!end == cStr) { // No leading digit found: only "D" not "0D"
throw new NumberFormatException(exceptionMsg(s))
throw new NumberFormatException("end == cStr " + exceptionMsg(s))
} else {
// Beware: cStr may have interior NUL/null bytes. Better to
// consider it a counted byte array rather than a proper
Expand All @@ -109,7 +109,7 @@ private[java] object IEEE754Helpers {
while (idx < bytesLen) { // Check for garbage in the unparsed remnant.
val b = cStr(idx.toUSize)
if ((b < 0) || b > 0x20) {
throw new NumberFormatException(exceptionMsg(s))
throw new NumberFormatException("garbage in unparsed remnant " + exceptionMsg(s))
}
idx += 1
}
Expand Down

0 comments on commit d3d413a

Please sign in to comment.