Hi members:

How can that be possible?
A floating point value renders correctly if displayed in a toast, but
undesired rounded up if displayed in a collection. See [1].

Anyone could point me what is wrong or missing in the below source code?
Thanks, Eder


[1] 
https://drive.google.com/file/d/0B9AugXy_qrXvb3hOVkEyWFBRSkE/view?usp=sharing

Source code portion:
"
    @Column(allowsNull = "true", scale = 5)
    @Getter
    @Setter
    @MemberOrder(sequence="4")
    private BigDecimal cotaNacional;

    @Column(allowsNull = "true", scale = 2)
    @Property()
    @Getter @Setter
    private PPBQuota cotaTarget;
" - StatisticsItem.java

"
    @CollectionLayout(render = RenderType.EAGERLY, named="Statistics")
    private SortedSet<StatisticsItem> statistics = new
TreeSet<StatisticsItem>();

    @Collection()
    public SortedSet<StatisticsItem> getStatistics() {

        return statistics;
    }

    public void setStatistics(final SortedSet<StatisticsItem> obj) {

        this.statistics = obj;
    }

...
        final StatisticsItem stitemC = new StatisticsItem();

        if (stitemC.getTotalGeral() > 0) {
            final BigDecimal frac =
BigDecimal.valueOf(totalnacionalcord).divide(BigDecimal.valueOf(stitemC.getTotalGeral()),
5, RoundingMode.HALF_DOWN);

            stitemC.setCotaNacional(frac.multiply(BigDecimal.valueOf(100)));
        }
        else
            stitemC.setCotaNacional(BigDecimal.ZERO);

        container.warnUser(stitemC.getCotaNacional().toPlainString());

        statistics.add(stitemC);

" - [handler entity].java

Reply via email to