<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mahesh U Naidu</title>
    <description>The latest articles on DEV Community by Mahesh U Naidu (@ph1618).</description>
    <link>https://dev.to/ph1618</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4076289%2F04764b08-f1bf-4359-a1d9-e19358db51a6.png</url>
      <title>DEV Community: Mahesh U Naidu</title>
      <link>https://dev.to/ph1618</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ph1618"/>
    <language>en</language>
    <item>
      <title>I found 3 real accuracy bugs in a Vedic astrology API, so I built my own computation layer</title>
      <dc:creator>Mahesh U Naidu</dc:creator>
      <pubDate>Thu, 13 Aug 2026 12:27:23 +0000</pubDate>
      <link>https://dev.to/ph1618/i-found-3-real-accuracy-bugs-in-a-vedic-astrology-api-so-i-built-my-own-computation-layer-3i62</link>
      <guid>https://dev.to/ph1618/i-found-3-real-accuracy-bugs-in-a-vedic-astrology-api-so-i-built-my-own-computation-layer-3i62</guid>
      <description>&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;I run a product that depends on Vedic astrology calculations — birth charts, planetary positions, dasha (planetary period) timing. It was calling a third-party API that does roughly $5.7M/year in revenue. Popular, established, trusted by a lot of developers.&lt;/p&gt;

&lt;p&gt;While cross-checking &lt;em&gt;their&lt;/em&gt; output against Jagannatha Hora — the reference software professional astrologers actually use to verify calculations — I found real, systematic errors in &lt;em&gt;their&lt;/em&gt; calculations. Not edge cases. Core math.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three bugs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Wrong divisional chart formula.&lt;/strong&gt; Divisional charts (D1 through D60) are derived from a planet's exact degree using specific per-chart formulas defined in classical texts (BPHS). The incumbent was applying a single generic formula (&lt;code&gt;degree * N&lt;/code&gt;) across all chart types. That's mathematically wrong for most of them — D9 (Navamsa) alone has three completely different starting-point rules depending on whether the sign is movable, fixed, or dual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Broken dasha-cycle loop.&lt;/strong&gt; Vimshottari Dasha is a 120-year cyclical system split across 9 planetary periods. Their cycle-advancement logic broke after the first full cycle — meaning any dasha calculation past ~40 years into a person's life was computing the wrong planetary lord entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Sunrise/sunset approximation error.&lt;/strong&gt; They were using a Spencer (1971) approximation formula, which has a known error margin of up to 15 minutes, plus a double-timezone-offset bug in a fallback path. I verified this against a real location (Mumbai, a specific date) — the approximation was off by nearly 6 hours in the worst case I found (returning an 11:52 AM "sunrise").&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix
&lt;/h2&gt;

&lt;p&gt;I rebuilt the whole computation layer locally using Swiss Ephemeris (the open astronomical computation library most serious astrology software is built on), rather than depending on someone else's server for math I could verify and own myself.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Divisional charts: implemented the actual BPHS-defined formula per chart type (movable/fixed/dual starting points, trikona rules, etc.) — verified 180/180 against JHora&lt;/li&gt;
&lt;li&gt;Dasha cycles: rewrote as a flat, correctly-looping sequence instead of a broken multi-cycle loop&lt;/li&gt;
&lt;li&gt;Sunrise/sunset: switched to Swiss Ephemeris's real &lt;code&gt;swe_rise_trans()&lt;/code&gt; calculation, verified against known-correct data&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;The scariest part wasn't finding the bugs — it was realizing how easy they'd be to miss. All three produce &lt;em&gt;plausible-looking&lt;/em&gt; output. A wrong divisional chart still shows a real zodiac sign and house number. A broken dasha calculation still shows a real planet name and a real-looking date range. Nothing errors. Nothing looks obviously broken. You only catch it by cross-referencing against independent ground truth, which most people integrating a third-party API never do.&lt;/p&gt;

&lt;p&gt;If you're depending on any external API for domain-specific calculations (finance, health, legal, astronomy, whatever), and you've never independently verified its output against a trusted reference: it's worth doing once. You might be surprised.&lt;/p&gt;

&lt;p&gt;The API is now live at &lt;a href="https://vedintelastroapi.com" rel="noopener noreferrer"&gt;vedintelastroapi.com&lt;/a&gt; — 133 endpoints, 7-day free trial. Happy to answer questions about the accuracy-verification process or the Swiss Ephemeris integration specifically.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
