Jan Jones is right on the 0

She’s wrong on the -1 (because the value „07c0000000“ is -0.25)
She’s right on the „1“, I can verify that, also the manuals say the same

Actually, for some floating point numbers, there is different forms you can 
express them correctly in floating point form - That’s what is called a 
de-normalized float (40*2^-1, for example, is the same as 20 * 2^1) - So 
floating point numbers having the same value don’t necessarily need to have the 
same representation. But that’s not the case here.

And your line 2500, I’m afraid, actually needs to go through all this hassle, 
I’m afraid. And maybe that’s the reason why INT on the BBQL to my knowledge 
will only work with values that fit into 16 bits (opposed to SMSQ/E which 
allows 32-bit values here) - Because the BBQL does not have a LONGINT->FLOAT 
operation, while SMSQ/E has

Tobias
(Who just realized he may have to re-apply to the Mailing list because he only 
receives about half the messages)

> Am 14.08.2015 um 18:56 schrieb Norman Dunbar <nor...@dunbar-it.co.uk>:
> 
> Evening all,
> 
> I'm reading through Jan Jones' QL Handbook on my Kindle when I came across a 
> possible error on the section about the internal representation of Floating 
> Point numbers. 18% into the book. (or page 37 in the Quanta reprint from eons 
> ago!)
> 
> She says that:
> 
> 0 is 0000 00000000
> 1 is 0801 40000000
> -1 is 07ff c0000000
> 
> My own experimenting with poke_float and peek_float from DJToolkit 1.15 show 
> different values for the negatives:
> 
> -1 is 0800 80000000
> 
> The values read back correctly - poke_float addr, -1 followed by print 
> peek_float(addr) does indeed give -1.
> 
> 
> 
> Second question, is there a simple way to look at the internal representation 
> of a float and determine whether it is an INT or not?
> 
> So if I got 2.7 and 2.0 as two parameters, is it easy to tell that the second 
> is an INT while the first is not. Looking at the internal representation, I 
> don't think it is.
> 
> There are some useful conversion routines in the maths package, but I don;t 
> see a way, easily, to INT() a floating point value and leave that INT value 
> on the maths stack as a floating point. I need to NLINT it to a long word INT 
> instead and then mess about re-stacking that as a float instead - this cannot 
> surely be how it is done?
> 
> Surely, the interpreter doesn't have to go through those hoops whever it sees 
> something like:
> 
> 2500 IF INT(x) = x THEN do_somthing: END IF
> 
> Does it?
> 
> 
> Cheers,
> Norm.
> 
> -- 
> Norman Dunbar
> Dunbar IT Consultants Ltd
> 
> Registered address:
> 27a Lidget Hill
> Pudsey
> West Yorkshire
> United Kingdom
> LS28 7LG
> 
> Company Number: 05132767
> _______________________________________________
> QL-Users Mailing List
> http://www.q-v-d.demon.co.uk/smsqe.htm

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to