21
$\begingroup$

Bug introduced in 10.0 and fixed in 10.0.2


I want to format numbers in decimal notation and chose TextString for this task. But today, when looking at the final result of my 3-weeks measurement, the sign seemed odd. I traced it to the following, unexpected behaviour of TextString:

TextString[1.0]
(*  1.0  *)

TextString[-1.0]
(* -1.0  *)

TextString[-0.5]
(* 0.5  UNEXPECTED *)

Using Trace gave a huge string of output that I am unable to interpret. Is TextString the wrong tool for this job?

$\endgroup$
  • 7
    $\begingroup$ Looks like a nasty bug, adding tag. Please report it to WRI, and do mention your measurements and the consequences. $\endgroup$ – Szabolcs Nov 13 '14 at 15:18
16
$\begingroup$

Not much to say here other than this is a nasty bug, but since you seemed to be curious what exactly goes wrong, here's the function that does the formatting:

Mathematica graphics

This function breaks the number into integer and fractional parts, converts both to a string (as integers) and joins them with a decimal point. The integer part of -0.5 is 0 which is formatted as 0, not as -0.

$\endgroup$
  • $\begingroup$ How exactly did you find this? All I could find is i.stack.imgur.com/1aHe9.png which is pretty horrible. $\endgroup$ – Öskå Nov 13 '14 at 15:31
  • $\begingroup$ @Öskå Check this out: mathematica.stackexchange.com/a/15948/12 (get the github version of the code) $\endgroup$ – Szabolcs Nov 13 '14 at 15:32
  • 15
    $\begingroup$ @Mr.Wizard No, won't fix it. I'm really annoyed by the recent decline in quality . When one has spare time, it might be fun digging up problems like this. But when it affects our work directly, and wastes a lot of time, then it is horrible. I can imagine that after an experience like Martin's (messing up his experimental results and wasting a lot of time) many people wouldn't touch Mma with a 10 foot pole. It can't even format a number reliably! $\endgroup$ – Szabolcs Nov 13 '14 at 15:44
  • 8
    $\begingroup$ @Szabolcs this will be fixed in 10.0.2. Very unfortunate bug, I apologize! Personally, most developers and testers I know wanted more time to iron out kinks like these, but we do not set the cadence of our release cycle. $\endgroup$ – Taliesin Beynon Nov 19 '14 at 23:16
  • 1
    $\begingroup$ @Taliesin Is there any constructive channel in which we might support the position of "most developers and testers"? Will anyone listen? $\endgroup$ – Mr.Wizard Aug 2 '15 at 2:33
4
$\begingroup$

This has been fixed in Version 10.0.2. On windows:

 TextString[-0.5]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.