# What's the best way to build rating implementation?

```
y = 1 if x > 0
y = 0 if x = 0
y = -1 if x < 0
```

```
z = |x| if |x| >= 1
z = 1 if |x| < 1
```

Tags: architecture algorithm database-design data-structures

Source: By Sam McAfee as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5

##### Related code-snippets:

- How can I get the value of in a loop?
- How do you enable a plugin for a PHP application?
- Function for creating color wheels.
- What is the most efficient code for 10000 prime numbers?
- How can we efficiently get sorted sums of a sorted list?
- What is the most efficient graph data structure in Python?
- "Sorting" colors by distinctiveness. Followup:
- How do I map Streams in C#. Mapping Streams to Data Structures in C#: Can I understand the structure of Streams?
- In C#, reading from byte array a C/C++ data structure in C#.
- What is the best way to calculate Big O?
- Graph serialization is a form of graph serialization.
- How do you create a sparse array?
- What's the best way to abstract season/show/episode data in a blog?
- Find largest rectangle in cubic cm (middle rectangle problem)!
- What is the structure of a Java application?