Not pulling correct data for the "In between" function.

I have a string field of high school gpa which is 4 characters long, i.e., 4.00
I created the tonumber formula on the field.
I need to pull a range from 2.31-2.40 so I say @hsgpa is between 2.30 and 2.41.
It is pulling students with a high school gpa of 2.41 and I don't know why?
Lecia SchusterSystems Technologist/Report ManagerAsked:
Who is Participating?
 
ste5anSenior DeveloperCommented:
Cause BETWEEN filters in almost any language/system with the boudaries being inclusive. Thus you filter for [2.31-2.41]. So you need [2.31-2.40]. Simply change the upper boundary to 2.40.
0
 
Lecia SchusterSystems Technologist/Report ManagerAuthor Commented:
Thank you, that seemed to fix my problem.
0
 
mlmccCommented:
Another reason could be since reals are stored as an approximation, rounding for display shows 2.407 as 2.41

mlmcc
0
 
ste5anSenior DeveloperCommented:
@mlmcc: it's a string field.
0
 
Lecia SchusterSystems Technologist/Report ManagerAuthor Commented:
Thank you everyone for your comments.  All comments confirm the best solution.
0
All Courses

From novice to tech pro — start learning today.