Sample

JetBrains/e47

Human rating uses the original dataset scale.

DatasetJetBrains
Human0.72
Lines36

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
4.2Δ 43.2
Scalabrino0.410–1; higher is more readable
23.7Δ 23.7
Dorn0.0280–1; higher is more readable
2.5Δ 44.9
Mi0.0150–1; higher is more readable
4.2Δ 43.2
LLOC24Logical lines; fewer is more readable
11.4Δ 36.0
DeepSeek V4 Pro140–20; mean of three runs
35.2Δ 12.3
GPT-6.1 Sol160–20; mean of three runs
26.7Δ 20.8
BTTF0.3370–1; higher is more readable
17.8Δ 29.7
Human0.720–1; original rating
47.5

Views

Source code

import java.math.BigDecimal; public class PiPrinter { public static void main(String[] args) { BigDecimal pi = computePi(1000); System.out.println(pi); } private static BigDecimal computePi(final int SCALE) { BigDecimal arctan1_5 = arctan(5, SCALE); BigDecimal arctan1_239 = arctan(239, SCALE); BigDecimal pi = arctan1_5.multiply(BigDecimal.valueOf(4)).subtract(arctan1_239).multiply(BigDecimal.valueOf(4)); return pi.setScale(SCALE, BigDecimal.ROUND_HALF_UP); } private static BigDecimal arctan(int inverseX, int SCALE) { BigDecimal result, numer, term; BigDecimal invX = BigDecimal.valueOf(inverseX); BigDecimal invX2 = BigDecimal.valueOf(inverseX * inverseX); numer = BigDecimal.ONE.divide(invX, SCALE, BigDecimal.ROUND_HALF_UP); result = numer; int i = 1; do { numer = numer.divide(invX2, SCALE, BigDecimal.ROUND_HALF_UP); int denom = 2 * i + 1; term = numer.divide(BigDecimal.valueOf(denom), SCALE, BigDecimal.ROUND_HALF_UP); if ((i % 2) != 0) result = result.subtract(term); else result = result.add(term); i++; } while (term.compareTo(BigDecimal.ZERO) != 0); return result; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.1698.17−56.04
Source linesThe number of non-empty source lines.36+14.4
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.7−7.051

Intercept 8.87 + feature contributions = -39.82 (log-odds).
Score = sigmoid(-39.82) = 0.

Score0.41

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.119.972−1.416
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.0−0.804
Indentation frequencyHow rapidly indentation changes from line to line.1−0.703
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.36−0.405
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.36−0.238
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.11−0.13
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.34.81+0.077

Intercept 0.07 + feature contributions = -3.55 (log-odds).
Score = sigmoid(-3.55) = 0.028.

Score0.015
Score24
Run 1

The code structure is logical, separating pi computation from arctangent calculation. Nesting is shallow and action granularity is generally one operation per line, aiding readability. However, clarity of intent suffers: the odd/even term alternation in the arctan method uses a magic-number pattern that could be clearer, and the method signatures use SCALE as a parameter name in all caps, which is unconventional. Some lines, like the pi calculation, combine multiple operations, slightly reducing readability. The code is concise and follows a natural reading flow, but ambiguous variable names and minor style inconsistencies prevent a higher score.

Run 2

The code is reasonably readable with a clear structure: separate methods for computing pi and arctangent, and a simple main method. Naming is mostly clear, and the mathematical intent is understandable. However, there are some issues: the parameter names SCALE are uppercase, which violates Java conventions and reduces clarity. The arctan method uses a do-while loop with a condition that may not terminate for all inputs, and the loop logic is somewhat dense. Some variables are declared without initialization and then assigned on separate lines, reducing readability. There are also magic numbers (5, 239, 4) without explanation. The code is concise and not deeply nested, but the mathematical reasoning behind the pi formula is not commented, making the purpose less obvious. Overall, the structure is good, but conventions and clarity of intent could be improved.

Run 3

The code is generally readable, with clear method separation and intent. The main logic is understandable, and the arctan computation is logically structured. However, readability is reduced by a few issues: the SCALE parameter is named as a constant but used as a mutable parameter; variable declarations are grouped instead of declared close to usage; the loop termination relies on term reaching zero, which is not immediately obvious; and some lines do multiple operations. Nesting is flat, which helps, but the lack of comments explaining the Machin-like formula (π = 16 arctan(1/5) - 4 arctan(1/239)) makes the purpose less clear. Overall, it is readable but could be improved with better naming, comments, and slightly more structured variable handling.

Run 1

Code Structure: Clearly separates printing, pi computation, and arctangent calculation into focused methods. Nesting: Shallow, with only a conditional inside a loop. Clarity of intent: Method names communicate purpose, but abbreviated variables, uppercase SCALE parameters, and unexplained mathematical formulas make the numerical algorithm less accessible. Code length: Compact without substantial redundancy, although the chained pi expression is visually dense. Action granularity: Most lines perform one action; the chained arithmetic expression and grouped variable declaration slightly weaken this. Reading flow: Execution progresses naturally from entry point to helper methods, and the series calculation follows a consistent sequence. Braces around conditional branches and brief comments explaining the formula and termination condition would improve readability.

Run 2

Code Structure: Well separated into printing, computing pi, and evaluating arctangent. Nesting: Shallow, with only a conditional inside one loop. Clarity of intent: Method names convey purpose, but abbreviated variables and the unexplained mathematical formula and series require domain knowledge; uppercase SCALE is unconventional for a parameter. Code length: Compact without substantial redundancy. Action granularity: Most lines perform one action, though the chained pi calculation and grouped variable declarations reduce scanability. Reading flow: Natural progression from entry point to mathematical helpers, with consistent indentation; missing conditional braces and explanatory comments slightly hinder readability.

Run 3

Code Structure: Well-organized methods separate printing, computing pi, and evaluating arctangent. Nesting: Shallow, with only a conditional inside a loop. Clarity of intent: Method names communicate purpose, but abbreviated variables and unexplained mathematical constants obscure the algorithm; SCALE also resembles a constant despite being a parameter. Code length: Concise without substantial redundancy, though the long chained expression is harder to scan. Action granularity: Most lines perform one action, but grouped variable declarations and chained arithmetic reduce clarity. Reading flow: Execution follows a natural sequence from main to helper methods, although missing braces around conditional branches and a lack of mathematical context slightly hinder readability.