Re: Negative Numbers and NumberFormat

2017-04-06 Thread Bob Sneidar via use-livecode
Oh that is interesting. Each number has to be a separate argument. That is something I did not glean from reading the docs a while back. Bob S On Apr 6, 2017, at 14:26 , Paul Dupuis via use-livecode > wrote: put

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Paul Dupuis via use-livecode
On 4/6/2017 5:04 PM, Bob Sneidar via use-livecode wrote: > put format("00:00:00", "9:50:00") produces 00:00:00. > put format("##:##:##", "9:50:00") produces ##:##:##. > put format("nnn.nnn.nnn.nnn", "192.168.1.1") produces nnn.nnn.nnn.nnn put format("%2d:%02d:%02d", 9,50,0) produces 9:50:00

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Bob Sneidar via use-livecode
put format("00:00:00", "9:50:00") produces 00:00:00. put format("##:##:##", "9:50:00") produces ##:##:##. put format("nnn.nnn.nnn.nnn", "192.168.1.1") produces nnn.nnn.nnn.nnn Point being, format is great for formatting NUMBERS, not converting truncated numeric values in between delimiters or

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Paul Dupuis via use-livecode
Okay, put format("$ %05.2f",-5.553) into msg gives $ -5.55 I am sure there is some formatting someone would want that can not be done with the format function, but most can and without spending the time to exhaustively test, I suspect that anything you can do with numberFormat you can do with

Re: Negative Numbers and NumberFormat

2017-04-06 Thread hh via use-livecode
You forgot to give examples for Bob's original problem? The negative numbers ... ;-) > Paul D. wrote: >> put format("$%0.2f",tMoney) into msg >> >> for tMoney = 5.55, you get $5.55 >> for tMoney = 5.3, you get $5.33 >> >> want a space between the $, then use >> put format("$ %0.2f",tMoney)

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Paul Dupuis via use-livecode
I am curious why folks use numberFormat vs the format function (which is much more consistent and versatile). Is the issue the complexity of the formatting strings for the format function? put format("$%0.2f",tMoney) into msg for tMoney = 5.55, you get $5.55 for tMoney = 5.3, you get $5.33

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Bob Sneidar via use-livecode
I already have some functions for formatting numerical values I can submit for review. formatDate() is already in the masterLibrary. function formatMoney theValue -- strip out monetary symbols replace "$" with empty in theValue replace "ยข" with empty in theValue switch case

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Richard Gaskin via use-livecode
Paul Dupuis wrote: > On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote: >> >> Confirmed - running this script in v9dp6 and again all the way back >> in v6.0: >> >> on mouseUp >>set the numberformat to "###.###" >>put 2.5 + 2.5 into x >>set the numberformat to "000.000" >>

Re: Negative Numbers and NumberFormat

2017-04-06 Thread Bob Sneidar via use-livecode
I've created a monster. All the more reason to depricate numberformat and go with some kind of formatNumber() function like Excel has. I'll have a go today sometime. Bob S > On Apr 5, 2017, at 17:27 , Paul Dupuis via use-livecode > wrote: > > On 4/5/2017

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Paul Dupuis via use-livecode
On 4/5/2017 7:42 PM, J. Landman Gay via use-livecode wrote: > On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote: >> Jacque wrote: >> >>> HyperCard distinguished between "#" and "0" and produced different >>> results. It sounds like LC doesn't? >> >> Confirmed - running this script in v9dp6

Re: Negative Numbers and NumberFormat

2017-04-05 Thread J. Landman Gay via use-livecode
On 4/5/17 5:48 PM, Richard Gaskin via use-livecode wrote: Jacque wrote: HyperCard distinguished between "#" and "0" and produced different results. It sounds like LC doesn't? Confirmed - running this script in v9dp6 and again all the way back in v6.0: on mouseUp set the numberformat to

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Richard Gaskin via use-livecode
Jacque wrote: > HyperCard distinguished between "#" and "0" and produced different > results. It sounds like LC doesn't? Confirmed - running this script in v9dp6 and again all the way back in v6.0: on mouseUp set the numberformat to "###.###" put 2.5 + 2.5 into x set the

Re: Negative Numbers and NumberFormat

2017-04-05 Thread J. Landman Gay via use-livecode
On 4/5/17 2:07 PM, Mark Waddingham via use-livecode wrote: I should say the bit of engine code which does parsing and application of the numberformat has been left untouched in terms of what it does for as long as I can remember... It is one of those places where a subtle change could break apps

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Bob Sneidar via use-livecode
Yup. I have thought for a long time that there should be a formatNumber() function that did almost exactly what Excel does in terms of formatting a number. I will have to look into that. I'll post it if I throw one together. Should be easy given the string operations LC is capable of. Bob S

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Mark Waddingham via use-livecode
I should say the bit of engine code which does parsing and application of the numberformat has been left untouched in terms of what it does for as long as I can remember... It is one of those places where a subtle change could break apps quite easily as it is somewhat hard to see precisely what

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Mark Waddingham via use-livecode
On 2017-04-05 20:28, Bob Sneidar via use-livecode wrote: And here is an oddity again. In the dictionary, there is no mention of spaces or any other character besides "0.#" being valid in a numberformat string, but: set the numberformat to " 00";put -09+0 & ":" & 00+0 & ":" & 00+0 produces

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Bob Sneidar via use-livecode
And here is an oddity again. In the dictionary, there is no mention of spaces or any other character besides "0.#" being valid in a numberformat string, but: set the numberformat to " 00";put -09+0 & ":" & 00+0 & ":" & 00+0 produces -09:000:000 In fact, you can put ANYTHING in place of a 0,

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Bob Sneidar via use-livecode
That was my point, that the sign should not take up one of the digits in numberformat 00. And thank you for your explanation about strings being strings until math was done on them. In my timeCalc() function however, I already convery everything to seconds and just before conatenating HH, MM

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Mark Waddingham via use-livecode
On 2017-04-05 19:21, Mark Waddingham via use-livecode wrote: The latter bit about 'not being able to do arithmetic' might sound odd but it is a reflection of the finiteness of computers. Just correcting myself: 'finiteness of computers' was the wrong thing to say here - if you can represent

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Mark Waddingham via use-livecode
On 2017-04-03 19:11, Bob Sneidar via use-livecode wrote: Was anyone aware that the sign takes up one of the digital in number format? For instance, set the numberformat to "00";put -1 +0 & ":" & 0 +0 & ":" & 0 +0 returns: -1:00:00 but set the numberformat to "00";put -12 +0 & ":" & 0 +0 & ":"

Re: Negative Numbers and NumberFormat

2017-04-05 Thread Bob Sneidar via use-livecode
Never mind. Bob S > On Apr 4, 2017, at 13:12 , hh via use-livecode > wrote: > Bob S. wrote: You should rather say the number format determines the num of DIGITS. >>> hh wrote: >>> That's what you wish to have (good idea). But it's not like that,

Re: Negative Numbers and NumberFormat

2017-04-04 Thread hh via use-livecode
>>> Bob S. wrote: >>> You should rather say the number format determines the num of DIGITS. >> hh wrote: >> That's what you wish to have (good idea). But it's not like that, its >> the length of the number as string. > Bob S. wrote > Really? Then why does : > set the numberformat to 0.0; put

Re: Negative Numbers and NumberFormat

2017-04-04 Thread Bob Sneidar via use-livecode
Really? Then why does : set the numberformat to 0.0;put -.1 + 0 result in -0.1 ? Bob S > On Apr 3, 2017, at 16:55 , hh via use-livecode > wrote: > >> You should rather say the number format determines the num of DIGITS. > > That's what you wish to have (good

Re: Negative Numbers and NumberFormat

2017-04-03 Thread hh via use-livecode
> Bob S. worte: > I have a function for calculating the difference in time Then you mean -(01:00:00) and not (-01):(00):(00), quite different. AFAIK most languages do such time evaluations as follows 1) compute the time in seconds, 2) convert its absolute value to time format, and 3) if

Re: Negative Numbers and NumberFormat

2017-04-03 Thread Bob Sneidar via use-livecode
The time format is irrelevant. It just so happens I have a function for calculating the difference in time, and when the first character is a - I know the end time is earlier than the start time, which was what I was checking for. And I think you are mistaken. numberFormat sets the format for

Re: Negative Numbers and NumberFormat

2017-04-03 Thread hh via use-livecode
TMHO, this could be a feature request rather than a bug report. The zeros in the number format determine the num of characters and "-" is one. Also we have -0 = 0. So what about "-01:-00:-00" ?? > Bob S. wrote: > "-01:00:00"? > Yes I expected this. It's not that I cannot work around it, > it's

Re: Negative Numbers and NumberFormat

2017-04-03 Thread Bob Sneidar via use-livecode
Yes I expected this. It's not that I cannot work around it, it's just that it seems it ought to put 2 zeros where 2 zeros are specified in the numberFormat and if it doesn't and should, then I will file an (admittedly low priority) bug report. Bob S > On Apr 3, 2017, at 10:16 , dunbarx via

Re: Negative Numbers and NumberFormat

2017-04-03 Thread dunbarx via use-livecode
Hi. Hmmm. When you say "...the sign takes up one of the digital " does this make it better or worse: set the numberformat to "00" put -1112 +0 & ":" & 0 +0 & ":" & 0 +0 or going the other way, with your top snippet, did you expect: -01:00:00 Craig Newman -- View this message in