指数演算の警告

フリートーク
返信する
メッセージ
作成者
彦左衛門

指数演算の警告

#1 投稿記事 by 彦左衛門 »

何処に書き込むか迷いましたが、ここに。

DWordNum1 = 10 ^ DWordNum2

上記の様な指数演算にて、

[警告] DoubleからDWordに強制変換されています。データが失われる可能性があります。

と出ますが、DWord 型 とリテラル値のみの演算で上記の様な警告が出るのは、そういうものなのですか。内部の演算が Double 型で扱われている様な話は聞いていますが、プログラマーから見た場合、明らかに DWord 型 の演算なのに警告が出るのはチョット変な気がします。恐らく、DWord 型 のレベルで失われるデータは、&hFFFFFFFF を超えた場合、0 を下回った場合以外は無いのではと思います。その点に関しては、DWord 型 とリテラル値の加減算でも同じで、そちらは警告が出ませんよね。

バグではなく、警告としなければ為らない理由が在るのでしたら、教えて頂けますか。
彦左衛門

#2 投稿記事 by 彦左衛門 »

使用バージョンは 4.24.00 です。
イグトランス
記事: 899
登録日時: 2005年5月31日(火) 17:59
お住まい: 東京都
連絡する:

#3 投稿記事 by イグトランス »

たしかに警告は不自然に感じますね。整数の指数演算に関する言語の規則を決めて,警告しないようにするほうがよいと私も思います。
今の挙動がどうしてそうなのかということは山本さんでないとわからないです……。
konisi
記事: 893
登録日時: 2005年7月25日(月) 13:27
お住まい: 埼玉県東松山市
連絡する:

#4 投稿記事 by konisi »

確かbasic/function.sbp内の関数powの仕様の関係でDouble型を返すことになってたはずです。(コンパイラ側の仕様で必ず内包される関数のひとつの筈。)
グローバル領域でのオーバーロードができれば対処できるかもしれません。
どちらにしても4.24だと無理だった気がするんですが。

具体的にはを定義(オーバーロード)する必要があるわけです。
直接書き換えるとDouble型の演算がうまくいかなくなると思うのでやめておいてください。

#Fixとかは組み込むのにこいつを組み込まないのはどうしてなんでしょうねぇ・・・。
Website→http://web1.nazca.co.jp/himajinn13sei/top.html
ここ以外の場所では「暇人13世」というHNを主として使用。

に署名を書き換えて欲しいと言われたので暇だしやってみるテスト。
彦左衛門

#5 投稿記事 by 彦左衛門 »

konisi さん、今日は。今回も返信有難う御座います。

パッと見て解るものではないようですので、とりあえずお礼のみで。

有難う御座いました。
彦左衛門

#6 投稿記事 by 彦左衛門 »

御免なさい。イグトランスさんの返信、後から気付きました。僅か三十分位の差のものでしたのに。

>>整数の指数演算に関する言語の規則を決めて,警告しないようにするほうがよいと私も思います。

ver.5 では改善されている事を願います。現状は、仕様と認識して置きます。

イグトランスさん、申し訳在りませんでした。有難う御座いました。
James227
記事: 2
登録日時: 2025年11月30日(日) 02:10

Re: 指数演算の警告

#7 投稿記事 by James227 »

My name is Anton, and my battleground is a checkered board of sixty-four squares. I teach chess to children and teenagers at a community center. My days are filled with the soft clack of pieces, whispered strategies, and the bright, sometimes frustrated, eyes of kids learning patience and foresight. I love the purity of it. Every move has a consequence. Every game is a story of cause and effect. But my world, for all its intellectual richness, is financially sparse. The center pays a modest stipend, and private lessons are a luxury few parents in our neighborhood can afford. My own apartment is a small, quiet place, its most prominent feature a bookshelf sagging with chess theory. My dream is to take my top students to a national youth tournament. The travel, hotels, entry fees—it’s a sum that feels as distant as grandmaster title.

The silence after the last student leaves is heavy. Not with peace, but with the echo of unmade moves, of potential I can’t afford to unlock. I’d set up my own board, analyze famous games, but my mind would wander to budgets and logistics, a mundane endgame I couldn’t solve.

The change came from the father of my most promising student, Misha. He was a logistics manager, a man who understood complex systems. He’d often stay to watch the lessons, fascinated. One evening, as we waited for Misha to finish a timed puzzle, he sighed. “All this calculation. My brain is tired of optimal routes and efficiency charts.” He pulled out his phone. “I need a system where the optimal move is to let go.” He showed me a site. “This is my reset. It’s on the vavada ua domain. Straightforward. Sometimes you just have to make a move and see what the universe responds with.”

Vavada ua. The Ukrainian domain. It felt specific, rooted somewhere. Not a nebulous .com, but a place. In my world of defined coordinates, this appealed to me. That night, after reviewing Misha’s brilliant sacrifice in a puzzle, I was too mentally alert to sleep. I typed it in. The vavada ua site was clean, no-nonsense. I registered as “KnightMove.” I deposited the cost of a new tournament chess clock—a professional expense, I reasoned. This was a study in anti-chess, a lesson in embracing chaos.

I didn’t touch the card games. I went straight to a game called “Checkmate Cash.” It was a slot, but the theme was a whimsical, animated chessboard. The symbols were cartoon kings, queens, knights, and pawns. The sound of capturing a piece was a satisfying thump. I set a tiny bet. I hit spin. The reels, designed like chess files (a-h), spun. It was silly, but charming. For twenty minutes after my last lesson, I’d play. It was the opposite of teaching. There was no strategy to impart, no mistake to correct. The vavada ua site was my mental sandbox where the only rule was randomness. The focus required to follow the game’s whims actually helped quiet the anxious planning part of my brain.

It became a ritual. A palate cleanser. I’d analyze a student’s disastrous opening, then I’d spin the cartoon chess reels, watching luck make its own, consequence-free “moves.”

The crisis was both bureaucratic and personal. The community center’s funding was cut. My stipend was halved, effective immediately. At the same time, Misha qualified for the national tournament. The look on his face—pure, unadulterated hope—crushed me even as it filled me with pride. I knew his family couldn’t afford it. I couldn’t afford to sponsor him. The right move, the moral move, was clear. But I lacked the material to make it.

That night, the silence in my apartment was suffocating. I felt like a king in check with no squares to run to. I logged into vavada ua, not for escape, but as a final, frivolous gesture before conceding defeat. I had a small bonus from a daily login. I went to Checkmate Cash. I set a bet, not my usual tiny one, but a meaningful chunk of my remaining entertainment budget. A desperate, unsound sacrifice.

One spin.

The cartoon pieces tumbled. They settled. Three “Golden Knight” symbols, their horses gleaming.

The screen didn’t just flash; it reconfigured. A bonus round, “Grandmaster’s Gambit,” initiated. I was shown a chessboard in a middle-game position. I wasn’t asked to solve it. I was asked to choose a piece to move for white. It was a completely random choice—no hint of the best move. I chose the queen’s knight, my favorite piece.

The knight moved. The board reacted. A path lit up, showing a sequence of captures. Each captured piece transformed into a multiplier: a pawn (2x), a bishop (5x), the opponent’s queen (10x). The sequence ended with a flashing “CHECKMATE” graphic, which unlocked a 50x multiplier for the ensuing 25 free spins.

The free spins were a masterclass in compounding advantage. Each win was multiplied by the growing total from the captured pieces, then finally by the 50x checkmate bonus. My desperate bet was the pawn pushed on the first move of a stunning, computer-like combination played by fate itself. The numbers escalated not arithmetically, but exponentially, like a perfectly executed attacking sequence on the board.

When the final spin settled, the total was not just “send Misha to the tournament” money. It was “secure the center’s chess program funding for a year, send Misha and two other deserving kids to the tournament with a proper coach (me), and finally buy that solid wood demonstration board” money.

I stared at the screen. In chess, we call a winning sequence a “forcing line.” This was the most forcing line life had ever presented me. Vavada ua had just delivered the resources to make all the right moves.

The money was real. The center’s director cried when I told her. Misha’s father shook my hand for a full minute, speechless.

Now, the community center’s chess program is thriving. We went to nationals. And sometimes, after a long day of teaching the Sicilian Defense, I’ll log in to that Ukrainian domain. I’ll play a few spins of Checkmate Cash, smiling at the cartoon knights. It’s not a game of chance to me anymore. It’s a monument to a single, perfect sequence. A reminder that even when the position seems hopeless, sometimes you just have to make a move—any move—and trust that the universe might just have a beautiful, forced mate in store.
返信する