/* attempt to deal with prototype, bootstrap, jquery conflicts */ /* for dropdown menus */

Jump to content

Image of the Day

Day 17 -- a bunch more tools join the table :) #blender3d #screenshotsaturday #itssaturdaysomewhere #lowpoly #3D https://t.co/CYJucn0Lfv
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now
- - - - -

Floating Point Literals

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Jason Goepel   Members   

774
Like
0Likes
Like

Posted 20 May 2013 - 09:33 AM

I'm not sure if this is intentional or not, but the following produces produces a compiler error.

 

double 1e5;

 

It looks like the parser is treating the "1" character as a complete token and an integer literal, so the "e" character is unexpected.  The function "asStringScanDouble", however, is able to convert the string "1e5" to the appropriate double.

 

The parser requires a "." for all floating point literals.  Can we change the parser to also interpret the presence of the "e" or "E" character as a double?

 

The following change to the asCTokenizer::IsConstant function (line 258 of "as_tokenizer.cpp") seems to be the only change needed to make this happen.

 

if( n < sourceLength && source[n] == '.' )

 

becomes...

 

if( n < sourceLength && (source[n] == '.' || source[n] =='e' || source[n] == 'E') )

 

Thanks


Edited by Jason Goepel, 20 May 2013 - 09:34 AM.


#2 Andreas Jonsson   Moderators   

4551
Like
0Likes
Like

Posted 20 May 2013 - 03:07 PM

I'll look into it. Thanks.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Andreas Jonsson   Moderators   

4551
Like
0Likes
Like

Posted 29 June 2013 - 11:41 AM

I've changed this in revision 1658. Thanks.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.