A Tale of a Thermometer Between Cherry Blossoms and Satsuki Flowers

April 28, 2025

Takayuki HOSODA

Flag of JapanJapanese edition

At a recent digital signal processing workshop held in Shiba, Tokyo, I hesitantly began my update:

"This might sound a bit like bragging, so I apologize in advance, but... my wife really loves roast beef."
thermometer

My wife is a fan of roast beef.

"There's hardly anything tasty in British cuisine, but roast beef is the one exception I'll praise!"
That's what she says.
But when she tries to make it herself, she tends to overcook it because she's worried it might be underdone.
"That's exactly why Hewlett-Packard's old motto is so important: Don't guess — measure!"
My wife looked puzzled, but the engineers in the audience chuckled.
"…So yeah, I bought a cooking thermometer — no need to wait for permission!"
I hit "Buy Now!" before she could object.

yokohama-sakura

A cheap cooking thermometer soon arrived from A****n. But when I tried it, it couldn't measure temperature properly at the probe's tip — it only worked when inserted about 30 mm deep, and even then, the response was very slow.

When I disassembled it, I found that the wiring of the sensor inside the stainless steel probe was too short — it didn't even touch the tip. The missing length was exactly the length of the sheath cap, about 20 mm, so I'm pretty sure there was a mistake in the manufacturing spec.

"So that's the secret behind the low price."

I quickly extended the sensor wiring, reassembled it, and tested it again. To my surprise, the readings were quite accurate. It read exactly 0.0 °C in ice water and 100.0 °C in boiling distilled water, and matched a calibrated K-type thermocouple at around 20.0 °C.

After checking more closely, I found it used a DO-35 glass-encapsulated thermistor rated for 300 °C.

thermometer

"I often use chip-type thermistors, but I'd overlooked the DO-35 type with axial leads — like the 1N4148."
It turned out to be a 100 kΩ high-temperature NTC glass thermistor, and I could even buy one of that kind from Semitec at component stores in Akihabara. So, I tried applying the approximation formula Ifd devised years ago for chip thermistors.

But it didnft fit well outside the usual -40 to 125 °C range — I couldn't extend it to 300 °C.

While revisiting my 10-year-old formula, I found a mistake.

(Had I really confused sqrt with cbrt and used it like that for over a decade…?)

Bad function! I corrected the sqrt to cbrt, and just like the original, the three-coefficient model gave a good fit over -50 to 300 °C.

Next, I fixed my genetic algorithm–like program to search for optimal coefficients. For example, over -50 to 300 °C, it found a coefficient set that stayed within ±0.07 °C of representative values — possibly even better than the Steinhart–Hart model. I was delighted, thinking maybe it even hinted at something fundamental about thermistor physics, and shared the fix with a colleague.

"But embedded systems donft have cbrt — they barely have sqrt!"
True. Most embedded MCUs support sqrt, but not cbrt or even pow.

Since cbrt is just the 1/3 power, I tried approximating it using sqrt as √√x√√xx (= x11/32 ) and found it could approximate the cube root over the range 1e±40 with a relative error between -0.7 and +1.6 times, even without range reduction.

Then, I tried applying a (1,1) Padé approximation as a recurrence formula near the solution — essentially equivalent to Halley's method — and found it converged to nearly full double precision within three or four iterations.

The resulting cbrt function also worked for complex numbers without modification. When designing approximations for complex values, making them asymptotically match not just around the expansion point but also around singularities tends to yield good results. Though for use with real doubles, that might be overkill.

minatomirai-hazakura

One night, while half-asleep, I came up with a real-valued cbrt approximation inspired by Puiseux series and a constrained Chebyshev&endash;like approximation. When I tested it after waking up, I found that with just three terms, I could achieve 1.83 digits of precision over x ∈ [0.125, 8], and with four terms, 2.31 digits.

Using this initial approximation, just two iterations of the earlier (1,1) Padé — functionally equivalent to Halley's method — were enough to reach full double precision.

Curious whether there might be more clues, I checked the source code for the cbrt function in the GNU C library (version 2.41). Contrary to my expectations, it seemed surprisingly unrefined.

Testing with 1,000,000 random double-precision values showed that the IEEE dbl-64 version had a fairly poor accuracy of +9/-7 ULPs. It looked like they prioritized speed over precision. Even the gcc native version had +3/-2.5 ULPs — there seemed to be room for improvement.

In contrast, the version using my four-term initial approximation achieved ±2 ULPs accuracy for both double and extended precision, reaching the practical limit of numerical accuracy. The code was also simple and highly portable.

"Now itfs ready to be embedded!"
And so, a happy ending?
"By the way, I casually mentioned I 'fixed' the model earlier, but — estimating a smooth approximation curve from limited sample points over a five-order-dynamic-range nonlinear response — while accounting for error — is …

I was mid-sentence when someone interrupted me:

"So… did you at least get to eat some delicious roast beef?"
"Ah, about that…
'If you want delicious roast beef, don't buy a thermometer — buy better meat!'
… is what she told me. So… next step, genetic engineering?"

The audience replied:
"No, no, no!" "Just buy your lovely wife some good meat!"
And thus ended my humble brag disguised as a technical update.

roasted-beef

Technical Notes


www.finetune.co.jp [Mail] © 2000 Takayuki HOSODA.