It is currently Tue May 23, 2017 1:51 pm



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: BASIC crashes when useing ROUND() with "NAN" as input
Unread postPosted: Sun Mar 12, 2017 1:23 am 
Offline

Joined: Sat Dec 22, 2012 2:32 pm
Posts: 830
When "inlining" one of the last two lines, BASIC crashes

Code:
DIM              x[1]
x[1]           = 1
ARRAY.STD_DEV    std,x[]

?                std
?                ROUND(std)
! ?              ROUND(std,0)
! ?              ROUND(std,1)

END


Top
 Profile  
 
 Post subject: Re: BASIC crashes when useing ROUND() with "NAN" as input
Unread postPosted: Tue Mar 21, 2017 12:41 am 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 2795
Location: Colorado, U.S.
Thanks, Brochi. My implementation of ROUND() with the optional rounding mode parameter uses Java's BigDecimal. The docs for BigDecimal say it throws an error if you give it "infinity" or "not a number". I did not think about testing either of those cases.

We have talked about problems with NaN before. and I don't think we decided on a final solution. Perhaps you can refresh my memory: were there any bad problems, like this crash?

Fixing this crash is simple. Fixing all cases of NaN is not. We may have to fix them as we find them.

- Marc


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred