Post Reply 
"#pragma mode ..." statement
02-19-2019, 06:33 PM
Post: #3
RE: "#pragma mode ..." statement
The Prime will interpret symbols in a program according to the settings currently in force for displaying numbers etc.

For example, if your Home settings say that the number format to use to display numbers to you is with a dot as a thousands separator and a comma as a decimal separator, then the number '12345' will be displayed:

Code:
12.345

If you now have this in a program:

Code:
A := 12,345

it will be interpreted as the real number '12.345'

What the #pragma directive does is say to the Prime: "Right, if the number format to use isn't explicit in a literal that you see in this program, ignore your Home settings and use these settings instead."

With the appropriate #pragma setting, the "12,345" above will be interpreted as twelve thousand, three hundred and forty-five despite your home settings saying that the comma is the decimal separator rather than the thousands separator.

#pragma clears up ambiguities.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
"#pragma mode ..." statement - Jean-Michel - 02-19-2019, 03:08 PM
RE: "#pragma mode ..." statement - grsbanks - 02-19-2019 06:33 PM



User(s) browsing this thread: 1 Guest(s)