ticklish format

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

ticklish format

Post by dunbarx » Tue Jun 11, 2019 9:50 pm

Why when I put the ticks into a variable, I get it in scientific notation, whereas if I just ask for the ticks, I get an integer.

I am in v.9.04. I do not remember this ever happening in earlier versions. I can convert using the "format" function, but what is the scoop?

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: ticklish format

Post by bogs » Tue Jun 11, 2019 10:16 pm

dunbarx wrote:
Tue Jun 11, 2019 9:50 pm
I am in v.9.04. I do not remember this ever happening in earlier versions.
Me either :shock:
Selection_001.png
Tick tick tick...
Selection_001.png (11.02 KiB) Viewed 4711 times
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: ticklish format

Post by dunbarx » Tue Jun 11, 2019 10:43 pm

Bogs.

AH HAHAHAHAHA. You kill me.

Try this:

Code: Select all

on mouseUp
   breakpoint
   put the ticks
   put the ticks into temp
   put  format("%0.f",temp) into temp
end mouseUp
Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: ticklish format

Post by dunbarx » Tue Jun 11, 2019 10:44 pm

HAHAHA. Still giggling

Let me catch my breath.

It also applies to "the seconds".

I don't see a preference that formats numbers in the SE.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: ticklish format

Post by bogs » Wed Jun 12, 2019 7:13 am

dunbarx wrote:
Tue Jun 11, 2019 9:50 pm
Why when I put the ticks into a variable, I get it in scientific notation, whereas if I just ask for the ticks, I get an integer.
Glad you got a chuckle from my following of your formula, even if I'm not sure why :D
dunbarx wrote:
Tue Jun 11, 2019 10:43 pm
Try this:
Ok...
Selection_001.png
And now for something completely different...
Image

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: ticklish format

Post by Klaus » Wed Jun 12, 2019 11:51 am

Variable or not, I get the correct integer, too.
macOS 10.14.5, LC 9.04 Indy

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: ticklish format

Post by dunbarx » Wed Jun 12, 2019 3:14 pm

I don't, sort of. In a button script:

Code: Select all

on mouseUp
   breakpoint
   put the ticks  into temp -- temp is in sci. notatation ("9.36209E+10")
   put the seconds  into temp  -- temp is in sci. notatation
   put the ticks  && the seconds into temp  -- temp is two integers
end mouseUp
I get scientific notation in the variable pane for each of the first two "put" lines. If I open either of those variables by double clicking the variable name, the small window shows an integer. So scientific notation in the variable pane of the SE, but an integer if I open the variable up for inspection

The third line, concatenating the two functions, shows integers all around.

A small thing, likely a tiny bug, but I wasted a lot of time on it. If nobody else has seen this, I am not sure it is worth reporting.

Craig

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: ticklish format

Post by bogs » Wed Jun 12, 2019 3:59 pm

dunbarx wrote:
Wed Jun 12, 2019 3:14 pm
If nobody else has seen this, I am not sure it is worth reporting.
Well, I'm not sure I count in that 'seeing' it stuff, after all I'm ...
* on linux and...
* don't venture past 6.x, and...
* haven't gotten any version of Lc past 8.0.1 to run on my distro of choice reliably to do any serious testing.

To test for stuff in the newer versions, I have to launch a VM and on my incredibly underwhelming system that is something I only do when I have *lots* of spare time on my hands.

I vote for you to report it :P
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: ticklish format

Post by jacque » Thu Jun 13, 2019 5:17 pm

This sounds like the automatic typing the engine does so that we don't have to declare typed variables. The engine is treating the data as a float until it is transformed to text. This is what numberformat does too and the data has to be put in a field or treated in a script as text before it displays as text. In your example, comcatenating the ticks and the seconds transforms it to a text string.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: ticklish format

Post by dunbarx » Thu Jun 13, 2019 5:53 pm

Jacque.

I get that, which is why for decades I have always added a "0" to any value after changing the numberFormat.

But as usual I am the only one seeing this. And it is a small thing, after all; LC is perfectly capable of using scientific format for all its needs (and mine) that incorporate these two functions.

It's just that, well, why me?

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: ticklish format

Post by jacque » Thu Jun 13, 2019 6:12 pm

It's not just you, I see it in the variable watcher frequently. It just never bothered me and didn't interfere with the scripts.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”