nimble-dev / nimble

The base NIMBLE package for R
http://R-nimble.org
BSD 3-Clause "New" or "Revised" License
158 stars 24 forks source link

Difference in printing from compiled code in version 1.2.0 #1458

Closed danielturek closed 5 months ago

danielturek commented 5 months ago

@perrydv @paciorek Flagging this for attention before upcoming release of version 1.2.0.

I'm hoping this change in printing (printing double type from compiled execution) can be reverted to old behaviour (that of versions 1.1.0 and earlier). I don't suspect this change was intentional, but if it was, then I guess disregard this.

Reproducible example of printing, using versions 1.1.0, and 1.2.0 (devel branch):

Version 1.1.0

library(nimble)

Rnf <- nimbleFunction(
    run = function(n = double()) {
        print(n)
    }
)

Cnf <- compileNimble(Rnf)

Rnf(200)
## 200

Cnf(200)
## 200

Version 1.2.0 (devel branch)

library(nimble)

Rnf <- nimbleFunction(
    run = function(n = double()) {
        print(n)
    }
)

Cnf <- compileNimble(Rnf)

Rnf(200)
## 200

Cnf(200)
200.0000000

I have not investigated this any further.

paciorek commented 5 months ago

I am fixing this on devel, so that if the new digits option is NULL (the default) we revert to previous printing behavior.

@danielturek thanks for the sharp eye here.