Introduction
Introduction Statistics Contact Development Disclaimer Help
Rating value obsession
Wednesday Nov 20 1:12:04 2024
------------------------------
I have, for at least one week, been obsessed with the rating value
of a certain online site, let's call it film affinity.
It goes like this: The site assigns a rating value to the
films/series that are published there. The issue raises when it com
to evaluating those numbers.
There are three cases here:
1.- The number is a float, like for example: 6.3 or 5.9
2.- The number is an integrer, like for example: 5 or 6
3.- There is no rating value whatsoever so the rating value is 0, o
for coherence 0.0
Then if I am interested in evaluating the number I need to cover
three different cases. When I started using bash I read somewhere
that bash is not very good with maths, it turns out to be true, you
have to find your way around it. So I finally ended up doing this:
1.- If the rating value is a float number, it is ok. I can read the
float number. 6.7 --> 6.7
2.- If the rating value is an integrer, it is ok. I can read it lik
this: 5 --> 5.0 or 6 --> 6.0
3.- If the rating value is null, it is ok. I can read it as 0.0
In short, it is an if/elif/else statement in the bash shell
Great success!!!
You are viewing proxied material from sdf.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.