day_of_week

std.elementwise.day_of_week · Level L4

The day of the week of a date given as days since 1970-01-01, Monday = 0: that day was a Thursday, so (days + 3) mod 7. Dates before 1970 work too, because the remainder is never negative.

(days + 3) mod 7

Signature

day_of_week(days: i64[n]) → i64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

daysi64[n]37AddshiftedModweekdayweekdayi64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference date.fromordinal(719163 + days).weekday() in exact rational arithmetic, on all 40 test cases.
  • All 149 int64 results are exact: the error is zero.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the int64 nearest the exact value)
100%
bit-equal to the NumPy formula in int64
100%
largest error, in units in the last place
0

Identity

Calls
—
Called by
—
sha256:ae768c5e105897ec6c9acf234868e3b2c1964c144e10f3101908933e08ac4de5

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.