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-Hi
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
-
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 t
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
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
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 v
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 := 42
7 matches
Mail list logo