[ 
https://issues.apache.org/jira/browse/CALCITE-4346?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stamatis Zampetakis updated CALCITE-4346:
-----------------------------------------
    Fix Version/s: 1.27.0

> strange result in toString function with bigdecimal type
> --------------------------------------------------------
>
>                 Key: CALCITE-4346
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4346
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Zhixiong Chen
>            Priority: Major
>             Fix For: 1.27.0
>
>
> In  SqlFunctions the toString function with BigDecimal type will replace 0.1 
> with .1 .
> But why is this ?
> {code:java}
> public static String toString(BigDecimal x) {
>  final String s = x.toString();
>  if (s.equals("0")) {
>  return s;
>  } else if (s.startsWith("0.")) {
>  // we want ".1" not "0.1"
>  return s.substring(1);
>  } else if (s.startsWith("-0.")) {
>  // we want "-.1" not "-0.1"
>  return "-" + s.substring(2);
>  } else {
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to