# Why is TextString[-0.5] a positive number?

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?

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

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:

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.

• How exactly did you find this? All I could find is i.stack.imgur.com/1aHe9.png which is pretty horrible. – Öskå Nov 13 '14 at 15:31
• @Öskå Check this out: mathematica.stackexchange.com/a/15948/12 (get the github version of the code) – Szabolcs Nov 13 '14 at 15:32
• @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! – Szabolcs Nov 13 '14 at 15:44
• @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. – Taliesin Beynon Nov 19 '14 at 23:16
• @Taliesin Is there any constructive channel in which we might support the position of "most developers and testers"? Will anyone listen? – Mr.Wizard Aug 2 '15 at 2:33

This has been fixed in Version 10.0.2. On windows:

 TextString[-0.5]