Re: v13 Compiled vs Interp execution

2018-02-22 Thread Keisuke Miyako via 4D_Tech
number literals are always typed real, regardless of decimals.

http://doc.4d.com/4Dv15/4D/15.5/Constants.300-3577854.en.html

you could code hexadecimals to enforce integer

0x01

but that's kind of nerdy...

predefined constants are also pre-typed.

http://doc.4d.com/4Dv15/4D/15.5/Optimization-Hints.300-3577824.en.html

by the way, you don't have to explicitly declare iterators (For/End for) 
because an integer is implied (unless declared otherwise).



On Feb 23, 2018, at 09:27, Chuck Miller via 4D_Tech 
<4d_tech@lists.4d.com> wrote:
I think it will work even without the .0

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13 Compiled vs Interp execution

2018-02-22 Thread Chuck Miller via 4D_Tech
As an aside I would use a local variable so command would look like this
c_real($MyNumber_R)
$MyNumber_R:=500.0
$real:=2*(MAXLONG-$MyNumber_R)

I do this so that 4D does not reset results based upon what it thinks it should 
do

I think it will work even without the .0

Regards

Chuck

 Chuck Miller Voice: (617) 739-0306
 Informed Solutions, Inc. Fax: (617) 232-1064   
 mailto:cjmillerinformed-solutions.com 
 Brookline, MA 02446 USA Registered 4D Developer
   Providers of 4D and Sybase connectivity
  http://www.informed-solutions.com  

This message and any attached documents contain information which may be 
confidential, subject to privilege or exempt from disclosure under applicable 
law.  These materials are intended only for the use of the intended recipient. 
If you are not the intended recipient of this transmission, you are hereby 
notified that any distribution, disclosure, printing, copying, storage, 
modification or the taking of any action in reliance upon this transmission is 
strictly prohibited.  Delivery of this message to any person other than the 
intended recipient shall not compromise or waive such confidentiality, 
privilege or exemption from disclosure as to this communication. 

> On Feb 22, 2018, at 12:53 PM, Timothy Penner via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> I think that using the MAXLONG constant is causing the value to be treated as 
> a longint.
> $Real := 2 * (MAXLONG - 500)
> 
> If you replace the MAXLONG constant with a value you get the correct result:
> $Real := 2 * (2147483647 - 500)
> 
> Interestingly, you can keep using the MAXLONG constant if you do something 
> like this:
> $Real := 2 * (MAXLONG - 500.1)

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: v13 Compiled vs Interp execution

2018-02-22 Thread Chip Scheide via 4D_Tech

Thanks!

> I think that using the MAXLONG constant is causing the value to be 
> treated as a longint.
> $Real := 2 * (MAXLONG - 500)
> 
> If you replace the MAXLONG constant with a value you get the correct result:
> $Real := 2 * (2147483647 - 500)
> 
> Interestingly, you can keep using the MAXLONG constant if you do 
> something like this:
> $Real := 2 * (MAXLONG - 500.1)
> 
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: v13 Compiled vs Interp execution

2018-02-22 Thread Timothy Penner via 4D_Tech
I think that using the MAXLONG constant is causing the value to be treated as a 
longint.
$Real := 2 * (MAXLONG - 500)

If you replace the MAXLONG constant with a value you get the correct result:
$Real := 2 * (2147483647 - 500)

Interestingly, you can keep using the MAXLONG constant if you do something like 
this:
$Real := 2 * (MAXLONG - 500.1)



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13 Compiled vs Interp execution

2018-02-22 Thread Chip Scheide via 4D_Tech
yes $real is declared as Real.
That is the first thing I checked  :)


> Do you have a C_REAL($Real) line in your code? The compiler might be 
> typing that variable as a longint.
> 
> Dani
> 
>> On Feb 22, 2018, at 10:14 AM, Chip Scheide via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> I have code that converts a value from REAL to Hex.
>> as part of my test routines, maximum value convertible is Maxlong 
>> (php routine)
>> I set the value to convert to (to test out of range error):
>> $Real := 2 * (MAXLONG - 500)
>> $Real := 2 * (2147483647 - 500) 
>> $Real := 2 * (2142483647)
>> $Real := 4284967294
>> 
>> interpretedly, this is correct, as this is the value given by - 
>> string($Real)
>> 
>> Compiled - the same code
>> String($Real) = -1002
>> 
>> Anyone have an explanation??
>> 
>> Thanks
>> Chip
>> 
>> 
>> 
>> Hell is other people 
>> Jean-Paul Sartre
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> 

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: v13 Compiled vs Interp execution

2018-02-22 Thread Dani Beaubien via 4D_Tech
Do you have a C_REAL($Real) line in your code? The compiler might be typing 
that variable as a longint.

Dani

> On Feb 22, 2018, at 10:14 AM, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> I have code that converts a value from REAL to Hex.
> as part of my test routines, maximum value convertible is Maxlong (php 
> routine)
> I set the value to convert to (to test out of range error):
> $Real := 2 * (MAXLONG - 500)
> $Real := 2 * (2147483647 - 500) 
> $Real := 2 * (2142483647)
> $Real := 4284967294
> 
> interpretedly, this is correct, as this is the value given by - string($Real)
> 
> Compiled - the same code
> String($Real) = -1002
> 
> Anyone have an explanation??
> 
> Thanks
> Chip
> 
> 
> 
> Hell is other people 
> Jean-Paul Sartre
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

v13 Compiled vs Interp execution

2018-02-22 Thread Chip Scheide via 4D_Tech
I have code that converts a value from REAL to Hex.
as part of my test routines, maximum value convertible is Maxlong (php routine)
I set the value to convert to (to test out of range error):
$Real := 2 * (MAXLONG - 500)
$Real := 2 * (2147483647 - 500) 
$Real := 2 * (2142483647)
$Real := 4284967294

interpretedly, this is correct, as this is the value given by - string($Real)

Compiled - the same code
String($Real) = -1002

Anyone have an explanation??

Thanks
Chip



Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**