17

2

When thinking on the workaround for this `LogLogPlot`

bug suggested by halirutan I noticed that `CompiledFunction`

actually can return machine numbers smaller than `$MinMachineNumber`

. Consider:

```
f = Compile[{{t, _Real}}, Exp[-9 t^2]];
num = f[8.872]
num < $MinMachineNumber
MachineNumberQ[num]
MachineNumberQ[num2 = ToExpression[ToString[num, StandardForm]]]
```

2.191864698767832`*^-308

True

True

False

As you see, `num`

is smaller than `$MinMachineNumber`

BUT `MachineNumberQ`

returns `True`

. Conversion of this number into `String`

and backward returns arbitrary-precision number.

Moreover, `CompiledFunction`

accepts such numbers and works with them correctly:

```
f2 = Compile[{{x, _Real}}, Sqrt@x];
f2[num]
```

1.480494747970364`*^-154

How this behavior could be explained? Does it mean that `CompiledFunction`

actually CAN work with arbitrary-precision numbers?

P.S. I use *Mathematica* 8.0.4 under Windows 7 x64.

Good old floating-point magic :) – ssch – 2013-11-25T15:03:52.673

3@AlexeyPopkov Yes, they are machine numbers (they satisfy IEEE 754 double-precision standard). Therefore,

`MachineNumberQ`

returns`True`

. – ybeltukov – 2013-11-25T15:39:14.920How can I enter a subnormal positive double by hands? Entering

`5.*^-324`

gives arbitrary-precision number. – Alexey Popkov – 2013-11-25T15:48:11.240@AlexeyPopkov It doesn't fit in the comment so I post it in the update of my answer. – ybeltukov – 2013-11-25T15:59:55.650

3Subnormals are normally handled (slowly) by microcode or in software rather than by the floating-point unit directly. I wonder, is there any way to switch on flush-to-zero? – Oleksandr R. – 2013-11-25T23:15:26.737

`first digit of this number (a little bug)`

it's not a bug — it's reflection of the fact that there's that much precision in this representation (next representable value is`1e-323`

).`libdouble-conversion`

as well as`gdtoa`

will also give you a single decimal digit for`2^-1074`

when asked to format in "shortest" form compatible with binary-decimal-binary round-trip criterion. – Ruslan – 2018-07-24T08:08:09.840