Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Psychophanta
Always Here
Posts: 5153 Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:
Post
by Psychophanta » Wed Jan 11, 2006 11:12 pm
Returns wrong.
Returns good, but it is ugly to say the compiler a constant is float by adding .0 to the value.
remi_meier
Enthusiast
Posts: 468 Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland
Post
by remi_meier » Thu Jan 12, 2006 5:56 pm
It isn't a problem for me, but 256f would be shorter (and 256d for doubles
)
Athlon64 3700+, 1024MB Ram, Radeon X1600
Polo
Addict
Posts: 2422 Joined: Tue May 06, 2003 5:07 pm
Location: UK
Post
by Polo » Thu Jan 12, 2006 5:58 pm
#a.f would just be perfect
remi_meier
Enthusiast
Posts: 468 Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland
Post
by remi_meier » Thu Jan 12, 2006 6:10 pm
But a constant cannot have a type because the 'preprocessor' just inserts
it directly to the code. It would break some 'standard'
(but it would
be ok for me
)
Athlon64 3700+, 1024MB Ram, Radeon X1600
Kale
PureBasic Expert
Posts: 3000 Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:
Post
by Kale » Thu Jan 12, 2006 6:22 pm
Polo wrote: #a.f would just be perfect
This is how it used to be but was changed, it was just wrong.
I think this is ok, just add a '.0' if you want the compiler to use floats.
--Kale
Psychophanta
Always Here
Posts: 5153 Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:
Post
by Psychophanta » Thu Jan 12, 2006 6:50 pm
Kale wrote: I think this is ok, just add a '.0' if you want the compiler to use floats.
It is ok, and functional, but ugly, not very elegant
I think there must be better solution.
Rescator
Addict
Posts: 1769 Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway
Post
by Rescator » Thu Jan 12, 2006 11:46 pm
Not really, as a constant is just a constant that is glued in as is into a line of code.
So if you have to use .0 in the code line then you also need to use .0 in the constant.
Psychophanta
Always Here
Posts: 5153 Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:
Post
by Psychophanta » Tue Jan 17, 2006 6:02 pm
Do you see what i want to say? Is it consistent?
EDIT: Well, i've said nothing but repeat ... forget
blueznl
PureBasic Expert
Posts: 6166 Joined: Sat May 17, 2003 11:31 am
Contact:
Post
by blueznl » Tue Jan 17, 2006 8:47 pm
psycho, yes, it is consistent, and you know
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide
right here ... )
Rescator
Addict
Posts: 1769 Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway
Post
by Rescator » Tue Jan 17, 2006 11:46 pm
It would really confuse beginners, as you would have so many variations.
#a.f=256 ;integer forced to float
#a=256.0 ;float
#a.f=256.0 ;float float?
#a=256 ;integer
I don't know about you folks but I find having just
#a=256.0 ;float
#a=256 ;integer
so much simpler
I've made it a habit to always use .0 on "round" floats.
#NULL
Addict
Posts: 1497 Joined: Thu Aug 30, 2007 11:54 pm
Location: right here
Post
by #NULL » Mon Mar 03, 2008 2:35 pm
<edit>
stupid code removed :roll:
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Mar 03, 2008 3:47 pm
Debug wrote: 0.0
*puzzled*
...so, who said it did right?
...mind the typecast order in PB.
it's always an issue, so you should be used to it meanwhile...
oh... and have a nice day.
Psychophanta
Always Here
Posts: 5153 Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:
Post
by Psychophanta » Mon Mar 03, 2008 8:07 pm
Kaeru Gaman wrote:
Debug wrote: 0.0
*puzzled*
...so, who said it did right?
I did. It worked for previous versions.
Now you need to do:
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Mar 03, 2008 8:38 pm
yup, but it's still a typecast-problem.
like this one:
http://www.purebasic.fr/english/viewtopic.php?p=202206
but I think, especially for constants it should be no problem to write it in a way that will work, e.g.
PS:
I agree that it would be nice to type constants, but this will be no solution for this problem.
will produce the same problem, because 1 and 3 are integer and result in 0
oh... and have a nice day.