# Changing machine precision notebook-wide leads to peculiarities

For a project of mine it is preferrable to set notebook precision globally. I have done so by using the answer in Global precision setting.

The idea is to dynamically create a Range from variables created with this $PreRead, but a peculiarity occurs. The below code illustrates this: a rather trivial function with input variables is SetDelayed. However, on a fresh kernel asdf does not evaluate. The global variant outside Module however works fine. Is there any way to create the below functionality using this $PreRead? Or is there an alternative to the $PreRead method that can be used interchangeably? ClearAll["Global*"]; myGlobalPrecision = 2 $$MachinePrecision;$$PreRead = (# /. s_String /; StringMatchQ[s, NumberString] && Precision@ToExpression@s == MachinePrecision :> s <> "" <> ToString@Floor@myGlobalPrecision <> "." &); asdf[PTsNo_, {xLBound_Real, xUBound_Real}] := Module[{xIncrements}, xIncrements = Range[xLBound, xUBound, (xUBound - xLBound)/(PTsNo - 1)] ] ListPlotResolution = 20; SpaceLowerBound = 0; SpaceUpperBound = 10.; xLBoundGlobal = SpaceLowerBound; xUBoundGlobal = SpaceUpperBound; PTsNoGlobal = 20; asdf[ListPlotResolution, {SpaceLowerBound/1., SpaceUpperBound/1.}] xIncrements = Range[xLBoundGlobal, xUBoundGlobal, (xUBoundGlobal - xLBoundGlobal)/(PTsNoGlobal - 1)]  • Note that zero in arbitrary precision arithmetic is the Integer zero when computed thus: 0/1.20. Hence the second argument to asdf is not a list of Real. – Michael E2 Nov 26 '19 at 14:03 • @MichaelE2 Interesting. That indeed does improve the situation... – 1010011010 Nov 26 '19 at 14:05 • @MichaelE2 How does one enforce Realness of 0/1.20? – 1010011010 Nov 26 '19 at 14:06 • It's a good question. 020 represents an underlfow less than$10^{-20}\$. It computes as zero plus/minus an uncertainty in arbitrary precision arithmetic. The only true (?) zero in arbitrary precision is the integer 0. So as far as argument patterns go, you could use xLBound: 0 | _Real. There is also xLBound_?InternalRealValuedNumberQ but it will allow Integer and Rational arguments as well. – Michael E2 Nov 26 '19 at 14:13
• @MichaelE2 It seems as if removing the /1. and using your Internal`RealValuedNumberQ trick solved the problem. – 1010011010 Nov 26 '19 at 15:10