# Why won't something print with desired precision in a while loop?

I have a problem: when I ask something to print with precision P, that is, Print[N[something, P]], it does not print with precision P, just with the usual output precision.

In particular, I have a triple nested while-loop, something of the form

While[p<...,

While[k<... ,

While[n<***+1,

process in which Y[n] is defined

n++ ]

Print[N[Y[***],100]];

k++ ]

p++ ]

Then the output prints Y[***] each time to the default printed precision, not 100. Other than this, my code works as expected.

Does anyone have an idea what I can do to fix this?

(My code is very long and I am doing an assignment where only small hints about parts of the code is allowed, so I don't think I should post my full code here. I hope I've provided enough and not too much detail.)

• Hard to say why without a MWE. It could be a bug, but hard to know. I tried this on 10.3.1 and it works: Print[N[Pi, 100]]. Can't you make a small example to show the problem? I just also add there might not be enough precision in the number itself. – Nasser Dec 25 '15 at 0:16
• OTOH, Print[N[3.14, 100]] will not print 100 digits (as expected). Y[***] must have at least a precision of 100 (or be exact) to get 100 digits of precision. – Michael E2 Dec 25 '15 at 0:17
• good example @MichaelE2, but this prints 100 digits: "Print[N[3.14100, 100]]" :) – Nasser Dec 25 '15 at 0:20
• @Nasser Also printing SetPrecision[3.14, 100] would print 100 digits, as would SetPrecision[Y[***], 100], though all beyond the precision of the number should be treated as garbage. (I thought our first comments covered the main points pretty well.) – Michael E2 Dec 25 '15 at 0:31

I suspect this question has little to do with Print. Consider
N[N[Pi, 6], 100]

3.14159
N can reduce the precision of its first argument, but it can't increase it. It seems likely to me that Y[***]`, whatever it actually is, simply doesn't represent anything that can evaluated to 100 digits of precision.